3 # Generate HTML documentation from GCC Texinfo docs.
4 # This version is for GCC 3.1 and later versions.
9 SVNROOT
=${SVNROOT:-"file:///svn/gcc"}
12 PATH
=/usr
/local
/bin
:$PATH
35 WWWBASE
=/www
/gcc
/htdocs
36 WWWBASE_PREFORMATTED
=/www
/gcc
/htdocs-preformatted
37 WWWPREPROCESS
='/www/gcc/bin/preprocess -r'
39 # Process options -rrelease and -ddirectory
43 while [ $# -gt 0 ]; do
46 if [ -n "$RELEASE" ]; then
47 echo "Multiple releases specified" >&2
51 if [ -z "$RELEASE" ]; then
54 if [ -z "$RELEASE" ]; then
55 echo "No release specified with -r" >&2
61 if [ -n "$SUBDIR" ]; then
62 echo "Multiple subdirectories specified" >&2
66 if [ -z "$SUBDIR" ]; then
69 if [ -z "$SUBDIR" ]; then
70 echo "No subdirectory specified with -d" >&2
76 echo "Unknown argument \"$1\"" >&2
83 if [ -n "$RELEASE" ] && [ -z "$SUBDIR" ]; then
84 echo "Release specified without subdirectory" >&2
88 if [ -z "$SUBDIR" ]; then
89 DOCSDIR
=$WWWBASE/onlinedocs
91 DOCSDIR
=$WWWBASE/onlinedocs
/$SUBDIR
94 if [ ! -d $DOCSDIR ]; then
99 if [ -z "$RELEASE" ]; then
103 WORKDIR
=/tmp
/gcc-doc-update.$$
108 if [ "$RELEASE" = "trunk" ]; then
109 svn
-q export $SVNROOT/$RELEASE gcc
111 svn
-q export $SVNROOT/tags
/$RELEASE gcc
114 # Remove all unwanted files. This is needed (a) to build the Ada
115 # generator programs with the installed library, not the new one and
116 # (b) to avoid packaging all the sources instead of only documentation
118 find gcc
-type f \
( -name '*.texi' \
119 -o -path gcc
/gcc
/doc
/install.texi2html \
120 -o -path gcc
/gcc
/doc
/include
/texinfo.tex \
121 -o -path gcc
/gcc
/ada
/xgnatugn.adb \
122 -o -path gcc
/gcc
/ada
/ug_words \
123 -o -path gcc
/gcc
/BASE-VER \
124 -o -path gcc
/gcc
/DEV-PHASE \
125 -o -print0 \
) |
xargs -0 rm -f
127 # Build a tarball of the sources.
128 tar cf docs-sources.
tar gcc
130 # The directory to pass to -I; this is the one with texinfo.tex
132 includedir
=gcc
/gcc
/doc
/include
134 # Generate gnat_ugn_unw
136 if [ -f gcc
/gcc
/ada
/xgnatugn.adb
]; then
137 gnatmake
-q gcc
/gcc
/ada
/xgnatugn
138 .
/xgnatugn unw gcc
/gcc
/ada
/gnat_ugn.texi \
139 gcc
/gcc
/ada
/ug_words gnat_ugn_unw.texi
142 # Generate gcc-vers.texi.
144 echo "@set version-GCC $(cat gcc/gcc/BASE-VER)"
145 if [ "$(cat gcc/gcc/DEV-PHASE)" = "experimental" ]; then
146 echo "@set DEVELOPMENT"
148 echo "@clear DEVELOPMENT"
150 echo "@set srcdir $WORKDIR/gcc/gcc"
151 echo "@set VERSION_PACKAGE (GCC)"
152 echo "@set BUGURL @uref{http://gcc.gnu.org/bugs/}"
153 ) > $includedir/gcc-vers.texi
155 # Generate libquadmath-vers.texi.
156 echo "@set BUGURL @uref{http://gcc.gnu.org/bugs/}" \
157 > $includedir/libquadmath-vers.texi
159 # Now convert the relevant files from texi to HTML, PDF and PostScript.
160 for file in $MANUALS; do
161 filename
=`find . -name ${file}.texi`
162 if [ "${filename}" ]; then
163 includes
="-I ${includedir} -I `dirname ${filename}`"
164 if [ "$file" = "gnat_ugn_unw" ]; then
165 includes
="$includes -I gcc/gcc/ada"
167 makeinfo
--html $includes -o ${file} ${filename}
168 tar cf
${file}-html.
tar ${file}/*.html
169 texi2dvi
$includes -o ${file}.dvi ${filename} </dev/null >/dev/null && dvips -o ${file}.ps ${file}.dvi
170 texi2pdf
$includes -o ${file}.pdf
${filename} </dev
/null
171 mkdir
-p $DOCSDIR/$file
175 # Work around makeinfo generated file names and references with
176 # "_002d" instead of "-".
177 find .
-name '*.html' |
while read f
; do
178 # Do this for the contents of each file.
179 sed -i -e 's/_002d/-/g' "$f"
180 # And rename files if necessary.
181 ff
=`echo $f | sed -e 's/_002d/-/g'`;
182 if [ "$f" != "$ff" ]; then
183 printf "Renaming %s to %s\n" "$f" "$ff"
188 # Then build a gzipped copy of each of the resulting .html, .ps and .tar files
189 for file in */*.html
*.ps
*.pdf
*.
tar; do
190 cat $file |
gzip --best > $file.gz
193 # On the 15th of the month, wipe all the old files from the
196 if test $today = 15; then
197 find $DOCSDIR -type f
-maxdepth 1 -print |
grep -v index.html |
xargs rm
198 for m
in $MANUALS; do
199 rm -f $DOCSDIR/$m/*.html
$DOCSDIR/$m/*.html.gz
203 # And copy the resulting files to the web server
204 for file in */*.html
*.ps
*.pdf
*.
tar; do
205 if [ -f $DOCSDIR/$file ]; then
207 sed -e '/^<meta name=generator/d' \
208 -e '/^%DVIPSSource:/d' > file1
211 sed -e '/^<meta name=generator/d' \
212 -e '/^%DVIPSSource:/d' > file2
213 if cmp -s file1 file2
; then
216 cp $file $DOCSDIR/$file
217 cp $file.gz
$DOCSDIR/$file.gz
223 # Finally, generate the installation documentation
224 if [ "$RELEASE" = "trunk" ]; then
225 SOURCEDIR
=$WORKDIR/gcc
/gcc
/doc
226 DESTDIR
=$WWWBASE_PREFORMATTED/install
229 $WORKDIR/gcc
/gcc
/doc
/install.texi2html
231 # Preprocess the entire web site, not just the install docs!
232 echo "Invoking $WWWPREPROCESS"
233 $WWWPREPROCESS |
grep -v '^ Warning: Keeping'
236 # Clean up behind us.