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