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
33 WWWBASE
=/www
/gcc
/htdocs
34 WWWBASE_PREFORMATTED
=/www
/gcc
/htdocs-preformatted
35 WWWPREPROCESS
='/www/gcc/bin/preprocess -r'
37 # Process options -rrelease and -ddirectory
41 while [ $# -gt 0 ]; do
44 if [ -n "$RELEASE" ]; then
45 echo "Multiple releases specified" >&2
49 if [ -z "$RELEASE" ]; then
52 if [ -z "$RELEASE" ]; then
53 echo "No release specified with -r" >&2
59 if [ -n "$SUBDIR" ]; then
60 echo "Multiple subdirectories specified" >&2
64 if [ -z "$SUBDIR" ]; then
67 if [ -z "$SUBDIR" ]; then
68 echo "No subdirectory specified with -d" >&2
74 echo "Unknown argument \"$1\"" >&2
81 if [ -n "$RELEASE" ] && [ -z "$SUBDIR" ]; then
82 echo "Release specified without subdirectory" >&2
86 if [ -z "$SUBDIR" ]; then
87 DOCSDIR
=$WWWBASE/onlinedocs
89 DOCSDIR
=$WWWBASE/onlinedocs
/$SUBDIR
92 if [ ! -d $DOCSDIR ]; then
96 if [ -z "$RELEASE" ]; then
100 WORKDIR
=/tmp
/gcc-doc-update.$$
105 if [ "$RELEASE" = "trunk" ]; then
106 svn
-q export $SVNROOT/$RELEASE gcc
108 svn
-q export $SVNROOT/tags
/$RELEASE gcc
111 # Remove all unwanted files. This is needed (a) to build the Ada
112 # generator programs with the installed library, not the new one and
113 # (b) to avoid packaging all the sources instead of only documentation
115 find gcc
-type f \
( -name '*.texi' \
116 -o -path gcc
/gcc
/doc
/install.texi2html \
117 -o -path gcc
/gcc
/doc
/include
/texinfo.tex \
118 -o -path gcc
/gcc
/ada
/xgnatugn.adb \
119 -o -path gcc
/gcc
/ada
/ug_words \
120 -o -path gcc
/gcc
/BASE-VER \
121 -o -path gcc
/gcc
/DEV-PHASE \
122 -o -print0 \
) |
xargs -0 rm -f
124 # Build a tarball of the sources.
125 tar cf docs-sources.
tar gcc
127 # The directory to pass to -I; this is the one with texinfo.tex
129 includedir
=gcc
/gcc
/doc
/include
131 # Generate gnat_ugn_unw
133 if [ -f gcc
/gcc
/ada
/xgnatugn.adb
]; then
134 gnatmake
-q gcc
/gcc
/ada
/xgnatugn
135 .
/xgnatugn unw gcc
/gcc
/ada
/gnat_ugn.texi \
136 gcc
/gcc
/ada
/ug_words gnat_ugn_unw.texi
139 # Generate gcc-vers.texi.
141 echo "@set version-GCC $(cat gcc/gcc/BASE-VER)"
142 if [ "$(cat gcc/gcc/DEV-PHASE)" = "experimental" ]; then
143 echo "@set DEVELOPMENT"
145 echo "@clear DEVELOPMENT"
147 echo "@set srcdir $WORKDIR/gcc/gcc"
148 echo "@set VERSION_PACKAGE (GCC)"
149 echo "@set BUGURL @uref{http://gcc.gnu.org/bugs/}"
150 ) > $includedir/gcc-vers.texi
152 # Now convert the relevant files from texi to HTML, PDF and PostScript.
153 for file in $MANUALS; do
154 filename
=`find . -name ${file}.texi`
155 if [ "${filename}" ]; then
156 includes
="-I ${includedir} -I `dirname ${filename}`"
157 if [ "$file" = "gnat_ugn_unw" ]; then
158 includes
="$includes -I gcc/gcc/ada"
160 makeinfo
--html $includes -o ${file} ${filename}
161 tar cf
${file}-html.
tar ${file}/*.html
162 texi2dvi
$includes -o ${file}.dvi ${filename} </dev/null >/dev/null && dvips -o ${file}.ps ${file}.dvi
163 texi2pdf
$includes -o ${file}.pdf
${filename} </dev
/null
164 mkdir
-p $DOCSDIR/$file
168 # Then build a gzipped copy of each of the resulting .html, .ps and .tar files
169 for file in */*.html
*.ps
*.pdf
*.
tar; do
170 cat $file |
gzip --best > $file.gz
173 # On the 15th of the month, wipe all the old files from the
176 if test $today = 15; then
177 find $DOCSDIR -type f
-maxdepth 1 -print |
grep -v index.html |
xargs rm
178 for m
in $MANUALS; do
179 rm -f $DOCSDIR/$m/*.html
$DOCSDIR/$m/*.html.gz
183 # And copy the resulting files to the web server
184 for file in */*.html
*.ps
*.pdf
*.
tar; do
185 if [ -f $DOCSDIR/$file ]; then
187 sed -e '/^<meta name=generator/d' \
188 -e '/^%DVIPSSource:/d' > file1
191 sed -e '/^<meta name=generator/d' \
192 -e '/^%DVIPSSource:/d' > file2
193 if cmp -s file1 file2
; then
196 cp $file $DOCSDIR/$file
197 cp $file.gz
$DOCSDIR/$file.gz
203 # Finally, generate the installation documentation
204 if [ "$RELEASE" = "trunk" ]; then
205 SOURCEDIR
=$WORKDIR/gcc
/gcc
/doc
206 DESTDIR
=$WWWBASE_PREFORMATTED/install
209 $WORKDIR/gcc
/gcc
/doc
/install.texi2html
211 # Preprocess the entire web site, not just the install docs!
212 echo "Invoking $WWWPREPROCESS"
213 $WWWPREPROCESS |
grep -v '^ Warning: Keeping'
216 # Clean up behind us.