]>
Commit | Line | Data |
---|---|---|
2d2ade2a JM |
1 | #!/bin/sh -x |
2 | ||
f488ffcb JM |
3 | # Generate HTML documentation from GCC Texinfo docs. |
4 | # This version is for GCC 3.1 and later versions. | |
5 | ||
2d2ade2a JM |
6 | # Run this from /tmp. |
7 | CVSROOT=/cvs/gcc | |
8 | export CVSROOT | |
9 | ||
10 | PATH=/usr/local/bin:$PATH | |
95307c8e | 11 | |
2d2ade2a | 12 | WWWBASE=/www/gcc/htdocs |
95307c8e | 13 | WWWBASE_PREFORMATTED=/www/gcc/htdocs-preformatted |
bba9ba9e | 14 | WWWPREPROCESS='/www/gcc/bin/preprocess -r' |
2d2ade2a | 15 | |
832013cd JM |
16 | # Process options -rrelease and -ddirectory |
17 | RELEASE="" | |
18 | SUBDIR="" | |
19 | ||
20 | while [ $# -gt 0 ]; do | |
21 | case $1 in | |
22 | -r*) | |
23 | if [ -n "$RELEASE" ]; then | |
24 | echo "Multiple releases specified" >&2 | |
25 | exit 1 | |
26 | fi | |
27 | RELEASE="${1#-r}" | |
28 | if [ -z "$RELEASE" ]; then | |
29 | shift | |
655e4aee | 30 | RELEASE="$1" |
832013cd JM |
31 | if [ -z "$RELEASE" ]; then |
32 | echo "No release specified with -r" >&2 | |
33 | exit 1 | |
34 | fi | |
35 | fi | |
36 | ;; | |
37 | -d*) | |
38 | if [ -n "$SUBDIR" ]; then | |
39 | echo "Multiple subdirectories specified" >&2 | |
40 | exit 1 | |
41 | fi | |
42 | SUBDIR="${1#-d}" | |
43 | if [ -z "$SUBDIR" ]; then | |
44 | shift | |
655e4aee | 45 | SUBDIR="$1" |
832013cd JM |
46 | if [ -z "$SUBDIR" ]; then |
47 | echo "No subdirectory specified with -d" >&2 | |
48 | exit 1 | |
49 | fi | |
50 | fi | |
51 | ;; | |
52 | *) | |
53 | echo "Unknown argument \"$1\"" >&2 | |
54 | exit 1 | |
55 | ;; | |
56 | esac | |
57 | shift | |
58 | done | |
59 | ||
60 | if [ -n "$RELEASE" ] && [ -z "$SUBDIR" ]; then | |
61 | echo "Release specified without subdirectory" >&2 | |
62 | exit 1 | |
63 | fi | |
64 | ||
65 | if [ -z "$SUBDIR" ]; then | |
66 | DOCSDIR=$WWWBASE/onlinedocs | |
67 | else | |
68 | DOCSDIR=$WWWBASE/onlinedocs/$SUBDIR | |
69 | fi | |
70 | ||
71 | if [ ! -d $DOCSDIR ]; then | |
72 | mkdir $DOCSDIR | |
73 | fi | |
74 | ||
75 | if [ -z "$RELEASE" ]; then | |
76 | RELEASE=HEAD | |
832013cd JM |
77 | fi |
78 | ||
2d2ade2a JM |
79 | WORKDIR=/tmp/gcc-doc-update.$$ |
80 | ||
81 | /bin/rm -rf $WORKDIR | |
82 | /bin/mkdir $WORKDIR | |
83 | cd $WORKDIR | |
84 | ||
85 | # Find all the texi files in the repository, except those in directories | |
f890c4fd JM |
86 | # we do not care about (texinfo, etc). |
87 | find $CVSROOT/gcc -name \*.texi,v -print | fgrep -v -f/home/gccadmin/scripts/doc_exclude | sed -e s#$CVSROOT/##g -e s#,v##g -e s#Attic/##g > FILES | |
2d2ade2a JM |
88 | |
89 | ||
286970ee | 90 | # Checkout all the texi files. |
014251ea | 91 | cvs -Q export -r$RELEASE `cat FILES` gcc/gcc/doc/install.texi2html gcc/gcc/doc/include/texinfo.tex gcc/gcc/ada/xgnatugn.adb gcc/gcc/ada/ug_words |
879b7101 JM |
92 | |
93 | # Build a tarball of the sources. | |
94 | tar cf docs-sources.tar gcc | |
286970ee | 95 | |
f488ffcb | 96 | # The directory to pass to -I; this is the one with texinfo.tex |
286970ee | 97 | # and fdl.texi. |
f488ffcb JM |
98 | includedir=gcc/gcc/doc/include |
99 | ||
28204309 | 100 | MANUALS="cpp cppinternals fastjar gcc gccint gcj g77 gfortran gnat_ug_unx gnat_ug_vms gnat_ug_vxw gnat_ug_wnt gnat_ugn_unw gnat-style gnat_rm libiberty porting" |
014251ea AC |
101 | |
102 | # Generate gnat_ugn_unw | |
103 | ||
104 | if [ -f gcc/gcc/ada/xgnatugn.adb ]; then | |
105 | gnatmake -q gcc/gcc/ada/xgnatugn | |
106 | ./xgnatugn unw gcc/gcc/ada/gnat_ugn.texi \ | |
107 | gcc/gcc/ada/ug_words gnat_ugn_unw.texi | |
108 | fi | |
2d2ade2a | 109 | |
f890c4fd | 110 | # Now convert the relevant files from texi to HTML and PostScript. |
f488ffcb | 111 | for file in $MANUALS; do |
286970ee JM |
112 | filename=`find . -name ${file}.texi` |
113 | if [ "${filename}" ]; then | |
f488ffcb | 114 | makeinfo --html -I ${includedir} -I `dirname ${filename}` ${filename} |
879b7101 | 115 | tar cf ${file}-html.tar ${file}/*.html |
286970ee | 116 | texi2dvi -I ${includedir} ${filename} </dev/null && dvips -o ${file}.ps ${file}.dvi |
f488ffcb | 117 | mkdir -p $DOCSDIR/$file |
371d5d2e | 118 | fi |
2d2ade2a JM |
119 | done |
120 | ||
879b7101 JM |
121 | # Then build a gzipped copy of each of the resulting .html, .ps and .tar files |
122 | for file in */*.html *.ps *.tar; do | |
2d2ade2a JM |
123 | cat $file | gzip --best > $file.gz |
124 | done | |
125 | ||
2d2ade2a JM |
126 | # On the 15th of the month, wipe all the old files from the |
127 | # web server. | |
128 | today=`date +%d` | |
129 | if test $today = 15; then | |
832013cd | 130 | find $DOCSDIR -type f -maxdepth 1 -print | grep -v index.html | xargs rm |
f488ffcb | 131 | for m in $MANUALS; do |
61995575 | 132 | rm $DOCSDIR/$m/*.html $DOCSDIR/$m/*.html.gz |
f488ffcb | 133 | done |
2d2ade2a JM |
134 | fi |
135 | ||
879b7101 JM |
136 | # And copy the resulting files to the web server |
137 | for file in */*.html *.ps *.tar; do | |
832013cd | 138 | cat $DOCSDIR/$file | |
f488ffcb | 139 | sed -e '/^<meta name=generator/d' \ |
f890c4fd | 140 | -e '/^%DVIPSSource:/d' > file1 |
2d2ade2a | 141 | cat $file | |
f488ffcb | 142 | sed -e '/^<meta name=generator/d' \ |
f890c4fd | 143 | -e '/^%DVIPSSource:/d' > file2 |
2d2ade2a JM |
144 | if cmp -s file1 file2; then |
145 | : | |
146 | else | |
f488ffcb JM |
147 | cp $file $DOCSDIR/$file |
148 | cp $file.gz $DOCSDIR/$file.gz | |
2d2ade2a JM |
149 | fi |
150 | done | |
151 | ||
832013cd | 152 | cd $DOCSDIR |
2d2ade2a | 153 | |
df7ad044 GP |
154 | # Finally, generate the installation documentation (but only for CVS HEAD). |
155 | if [ "$RELEASE" = "HEAD" ]; then | |
e180d2b0 | 156 | SOURCEDIR=$WORKDIR/gcc/gcc/doc |
df7ad044 GP |
157 | DESTDIR=$WWWBASE_PREFORMATTED/install |
158 | export SOURCEDIR | |
159 | export DESTDIR | |
160 | $WORKDIR/gcc/gcc/doc/install.texi2html | |
161 | ||
bba9ba9e GP |
162 | # Preprocess the entire web site, not just the install docs! |
163 | echo "Invoking $WWWPREPROCESS" | |
3b0c635f | 164 | $WWWPREPROCESS |grep -v '^ Warning: Keeping' |
df7ad044 | 165 | fi |
95307c8e GP |
166 | |
167 | # Clean up behind us. | |
168 | ||
2d2ade2a | 169 | rm -rf $WORKDIR |