Use rtx_expr_list for expr_status.x_forced_labels
[official-gcc.git] / maintainer-scripts / update_web_docs_svn
blobc66122068bf71d0434446917a7e4dce38248bea9
1 #!/bin/sh
3 # Generate HTML documentation from GCC Texinfo docs.
4 # This version is for GCC 3.1 and later versions.
6 set -e
8 # Run this from /tmp.
9 SVNROOT=${SVNROOT:-"file:///svn/gcc"}
10 export SVNROOT
12 PATH=/usr/local/bin:$PATH
14 MANUALS="cpp
15 cppinternals
16 fastjar
17 gcc
18 gccgo
19 gccint
20 gcj
21 gfortran
22 gfc-internals
23 gnat_ugn
24 gnat-style
25 gnat_rm
26 libgomp
27 libquadmath
28 libiberty
29 porting"
31 WWWBASE=/www/gcc/htdocs
32 WWWBASE_PREFORMATTED=/www/gcc/htdocs-preformatted
33 WWWPREPROCESS='/www/gcc/bin/preprocess -r'
35 # Process options -rrelease and -ddirectory
36 RELEASE=""
37 SUBDIR=""
39 while [ $# -gt 0 ]; do
40 case $1 in
41 -r*)
42 if [ -n "$RELEASE" ]; then
43 echo "Multiple releases specified" >&2
44 exit 1
46 RELEASE="${1#-r}"
47 if [ -z "$RELEASE" ]; then
48 shift
49 RELEASE="$1"
50 if [ -z "$RELEASE" ]; then
51 echo "No release specified with -r" >&2
52 exit 1
56 -d*)
57 if [ -n "$SUBDIR" ]; then
58 echo "Multiple subdirectories specified" >&2
59 exit 1
61 SUBDIR="${1#-d}"
62 if [ -z "$SUBDIR" ]; then
63 shift
64 SUBDIR="$1"
65 if [ -z "$SUBDIR" ]; then
66 echo "No subdirectory specified with -d" >&2
67 exit 1
72 echo "Unknown argument \"$1\"" >&2
73 exit 1
75 esac
76 shift
77 done
79 if [ -n "$RELEASE" ] && [ -z "$SUBDIR" ]; then
80 echo "Release specified without subdirectory" >&2
81 exit 1
84 if [ -z "$SUBDIR" ]; then
85 DOCSDIR=$WWWBASE/onlinedocs
86 else
87 DOCSDIR=$WWWBASE/onlinedocs/$SUBDIR
90 if [ ! -d $DOCSDIR ]; then
91 mkdir $DOCSDIR
92 chmod g+w $DOCSDIR
95 if [ -z "$RELEASE" ]; then
96 RELEASE=trunk
99 WORKDIR=/tmp/gcc-doc-update.$$
101 rm -rf $WORKDIR
102 mkdir $WORKDIR
103 cd $WORKDIR
104 if [ "$RELEASE" = "trunk" ]; then
105 svn -q export $SVNROOT/$RELEASE gcc
106 else
107 svn -q export $SVNROOT/tags/$RELEASE gcc
110 # Remove all unwanted files. This is needed (a) to build the Ada
111 # generator programs with the installed library, not the new one and
112 # (b) to avoid packaging all the sources instead of only documentation
113 # sources.
114 find gcc -type f \( -name '*.texi' \
115 -o -path gcc/gcc/doc/install.texi2html \
116 -o -path gcc/gcc/doc/include/texinfo.tex \
117 -o -path gcc/gcc/BASE-VER \
118 -o -path gcc/gcc/DEV-PHASE \
119 -o -print0 \) | xargs -0 rm -f
121 # Build a tarball of the sources.
122 tar cf docs-sources.tar gcc
124 # The directory to pass to -I; this is the one with texinfo.tex
125 # and fdl.texi.
126 includedir=gcc/gcc/doc/include
128 # Generate gcc-vers.texi.
130 echo "@set version-GCC $(cat gcc/gcc/BASE-VER)"
131 if [ "$(cat gcc/gcc/DEV-PHASE)" = "experimental" ]; then
132 echo "@set DEVELOPMENT"
133 else
134 echo "@clear DEVELOPMENT"
136 echo "@set srcdir $WORKDIR/gcc/gcc"
137 echo "@set VERSION_PACKAGE (GCC)"
138 echo "@set BUGURL @uref{http://gcc.gnu.org/bugs/}"
139 ) > $includedir/gcc-vers.texi
141 # Generate libquadmath-vers.texi.
142 echo "@set BUGURL @uref{http://gcc.gnu.org/bugs/}" \
143 > $includedir/libquadmath-vers.texi
145 # Now convert the relevant files from texi to HTML, PDF and PostScript.
146 for file in $MANUALS; do
147 filename=`find . -name ${file}.texi`
148 if [ "${filename}" ]; then
149 includes="-I ${includedir} -I `dirname ${filename}`"
150 if [ "$file" = "gnat_ugn" ]; then
151 includes="$includes -I gcc/gcc/ada"
153 makeinfo --html $includes -o ${file} ${filename}
154 tar cf ${file}-html.tar ${file}/*.html
155 texi2dvi $includes -o ${file}.dvi ${filename} </dev/null >/dev/null && dvips -o ${file}.ps ${file}.dvi
156 texi2pdf $includes -o ${file}.pdf ${filename} </dev/null
157 mkdir -p $DOCSDIR/$file
159 done
161 # Work around makeinfo generated file names and references with
162 # "_002d" instead of "-".
163 find . -name '*.html' | while read f; do
164 # Do this for the contents of each file.
165 sed -i -e 's/_002d/-/g' "$f"
166 # And rename files if necessary.
167 ff=`echo $f | sed -e 's/_002d/-/g'`;
168 if [ "$f" != "$ff" ]; then
169 printf "Renaming %s to %s\n" "$f" "$ff"
170 mv "$f" "$ff"
172 done
174 # Then build a gzipped copy of each of the resulting .html, .ps and .tar files
175 for file in */*.html *.ps *.pdf *.tar; do
176 cat $file | gzip --best > $file.gz
177 done
179 # On the 15th of the month, wipe all the old files from the
180 # web server.
181 today=`date +%d`
182 if test $today = 15; then
183 find $DOCSDIR -type f -maxdepth 1 -print | grep -v index.html | xargs rm
184 for m in $MANUALS; do
185 rm -f $DOCSDIR/$m/*.html $DOCSDIR/$m/*.html.gz
186 done
189 # And copy the resulting files to the web server
190 for file in */*.html *.ps *.pdf *.tar; do
191 if [ -f $DOCSDIR/$file ]; then
192 cat $DOCSDIR/$file |
193 sed -e '/^<meta name=generator/d' \
194 -e '/^%DVIPSSource:/d' > file1
196 cat $file |
197 sed -e '/^<meta name=generator/d' \
198 -e '/^%DVIPSSource:/d' > file2
199 if cmp -s file1 file2; then
201 else
202 cp $file $DOCSDIR/$file
203 cp $file.gz $DOCSDIR/$file.gz
205 done
207 cd $DOCSDIR
209 # Finally, generate the installation documentation
210 if [ "$RELEASE" = "trunk" ]; then
211 SOURCEDIR=$WORKDIR/gcc/gcc/doc
212 DESTDIR=$WWWBASE_PREFORMATTED/install
213 export SOURCEDIR
214 export DESTDIR
215 $WORKDIR/gcc/gcc/doc/install.texi2html
217 # Preprocess the entire web site, not just the install docs!
218 echo "Invoking $WWWPREPROCESS"
219 $WWWPREPROCESS |grep -v '^ Warning: Keeping'
222 # Clean up behind us.
224 rm -rf $WORKDIR