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