1 | #! /bin/sh |
---|
2 | # |
---|
3 | # This script is intended to be run in the build directory of a software |
---|
4 | # package including documentation in texinfo format. The basic operation |
---|
5 | # of this script is to: |
---|
6 | # + find all ".dvi" files from the current directory down, |
---|
7 | # + for each dvi file |
---|
8 | # + install the dvi file |
---|
9 | # + generate PostScript files for the dvi file |
---|
10 | # + install the PostScript file |
---|
11 | # + if there is texinfo source for this dvi file |
---|
12 | # install the info files |
---|
13 | # generate PDF from the texinfo source |
---|
14 | # install the PDF file |
---|
15 | # generate HTML from the texinfo source |
---|
16 | # install the HTML file |
---|
17 | # |
---|
18 | # |
---|
19 | |
---|
20 | texi2www=/usr1/rtems/rtemsdoc-work/tools/texi2www/texi2www |
---|
21 | install=/usr3/rtems_cds/test_cd/doc/tools/html |
---|
22 | |
---|
23 | #if [ $? -ne 1 ] ; then |
---|
24 | # echo "Usage: $0 install_directory" |
---|
25 | # exit 1 |
---|
26 | #fi |
---|
27 | |
---|
28 | if [ ! -d ${install} ] ; then |
---|
29 | echo "${install} is not a directory" |
---|
30 | exit 1 |
---|
31 | fi |
---|
32 | |
---|
33 | #ECHO=echo |
---|
34 | |
---|
35 | STARTDIR=`pwd` |
---|
36 | find . -name "*.dvi" | while read file |
---|
37 | do |
---|
38 | cd $STARTDIR |
---|
39 | cd `dirname $file` |
---|
40 | echo $file |
---|
41 | i=`basename $file` |
---|
42 | #### |
---|
43 | b=`echo $i | cut -d'.' -f1` |
---|
44 | echo $b |
---|
45 | |
---|
46 | if [ -d ${install}/${b} ] ; then |
---|
47 | echo "Cleaning install point for ${b}" |
---|
48 | ${ECHO} rm -rf ${install}/${b} |
---|
49 | fi |
---|
50 | ${ECHO} mkdir ${install}/${b} |
---|
51 | |
---|
52 | echo "Copying DVI for ${b}" |
---|
53 | ${ECHO} cp ${b}.dvi ${install}/${b} |
---|
54 | |
---|
55 | echo "Generating PS for ${b}" |
---|
56 | ${ECHO} dvips -o ${install}/${b}/${b}.ps ${b}.dvi |
---|
57 | |
---|
58 | # unfortunately the .dvi names are not always the same. :( |
---|
59 | case ${b} in |
---|
60 | history) tsrc=hist ;; |
---|
61 | readline) tsrc=rlman ;; |
---|
62 | *) tsrc=${b} ;; |
---|
63 | esac |
---|
64 | |
---|
65 | case ${b} in |
---|
66 | refcard) |
---|
67 | cp $d/gnu_docs/refcard.html ${install}/${b} |
---|
68 | ;; |
---|
69 | *) |
---|
70 | if [ -r ${tsrc}.texi ] ; then |
---|
71 | ext=texi |
---|
72 | elif [ -r ${tsrc}.texinfo ] ; then |
---|
73 | ext=texinfo |
---|
74 | else |
---|
75 | echo "*** |
---|
76 | echo "*** Cannot find a texi or texinfo file for ${b}" |
---|
77 | echo "*** |
---|
78 | exit 1 |
---|
79 | fi |
---|
80 | |
---|
81 | echo "Copying INFO for ${b}" |
---|
82 | ${ECHO} cp ${b}.info* ${install}/../info |
---|
83 | |
---|
84 | case ${b} in |
---|
85 | g77) bad_for_pdf="yes" ;; |
---|
86 | *) bad_for_pdf="no" ;; |
---|
87 | esac |
---|
88 | |
---|
89 | case ${b} in |
---|
90 | gdb) extraargs_for_pdf="-I ../../readline/doc" ;; |
---|
91 | *) extraargs_for_pdf="" ;; |
---|
92 | esac |
---|
93 | if [ ${bad_for_pdf} = "yes" ] ; then |
---|
94 | echo "*** " |
---|
95 | echo "*** Skipping PDF for ${b}" |
---|
96 | echo "*** " |
---|
97 | else |
---|
98 | echo "Generating PDF for ${b}" |
---|
99 | ${ECHO} texi2pdf ${extraargs_for_pdf} ${tsrc}.${ext} && \ |
---|
100 | ${ECHO} cp ${tsrc}.pdf ${install}/${b}/${b}.pdf |
---|
101 | fi |
---|
102 | |
---|
103 | # until texi2www is modified to take a search path |
---|
104 | case ${b} in |
---|
105 | gdb) |
---|
106 | sed -e 's/^ @/@/' <../../readline/doc/rluser.texinfo >rluser.texinfo |
---|
107 | cp ../../readline/doc/inc-hist.texi . |
---|
108 | ;; |
---|
109 | readline) |
---|
110 | cp rluser.texinfo rluser.texinfo.tmp |
---|
111 | sed -e 's/^ @/@/' <../../readline/doc/rluser.texinfo >rluser.texinfo |
---|
112 | rm -f rluser.texinfo.tmp |
---|
113 | ;; |
---|
114 | *) ;; |
---|
115 | esac |
---|
116 | echo "Generating HTML for ${b}" |
---|
117 | ${ECHO} ${texi2www} \ |
---|
118 | -dirfile ../index.html \ |
---|
119 | -header $d/gnu_docs/gnu_header.html \ |
---|
120 | -footer $d/gnu_docs/gnu_footer.html \ |
---|
121 | -icons .. -dir ${install}/${b} \ |
---|
122 | ${tsrc}.${ext} |
---|
123 | ;; |
---|
124 | esac |
---|
125 | done |
---|