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
34 WWWBASE
=/www
/gcc
/htdocs
35 WWWBASE_PREFORMATTED
=/www
/gcc
/htdocs-preformatted
36 WWWPREPROCESS
='/www/gcc/bin/preprocess -r'
38 # Process options -rrelease and -ddirectory
42 while [ $# -gt 0 ]; do
45 if [ -n "$RELEASE" ]; then
46 echo "Multiple releases specified" >&2
50 if [ -z "$RELEASE" ]; then
53 if [ -z "$RELEASE" ]; then
54 echo "No release specified with -r" >&2
60 if [ -n "$SUBDIR" ]; then
61 echo "Multiple subdirectories specified" >&2
65 if [ -z "$SUBDIR" ]; then
68 if [ -z "$SUBDIR" ]; then
69 echo "No subdirectory specified with -d" >&2
75 echo "Unknown argument \"$1\"" >&2
82 if [ -n "$RELEASE" ] && [ -z "$SUBDIR" ]; then
83 echo "Release specified without subdirectory" >&2
87 if [ -z "$SUBDIR" ]; then
88 DOCSDIR
=$WWWBASE/onlinedocs
90 DOCSDIR
=$WWWBASE/onlinedocs
/$SUBDIR
93 if [ ! -d $DOCSDIR ]; then
97 if [ -z "$RELEASE" ]; then
101 WORKDIR
=/tmp
/gcc-doc-update.$$
106 if [ "$RELEASE" = "trunk" ]; then
107 svn
-q export $SVNROOT/$RELEASE gcc
109 svn
-q export $SVNROOT/tags
/$RELEASE gcc
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
116 find 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
125 # Build a tarball of the sources.
126 tar cf docs-sources.
tar gcc
128 # The directory to pass to -I; this is the one with texinfo.tex
130 includedir
=gcc
/gcc
/doc
/include
132 # Generate gnat_ugn_unw
134 if [ -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
140 # Generate gcc-vers.texi.
142 echo "@set version-GCC $(cat gcc/gcc/BASE-VER)"
143 if [ "$(cat gcc/gcc/DEV-PHASE)" = "experimental" ]; then
144 echo "@set DEVELOPMENT"
146 echo "@clear DEVELOPMENT"
148 echo "@set srcdir $WORKDIR/gcc/gcc"
149 ) > $includedir/gcc-vers.texi
151 # Now convert the relevant files from texi to HTML, PDF and PostScript.
152 for file in $MANUALS; do
153 filename
=`find . -name ${file}.texi`
154 if [ "${filename}" ]; then
155 makeinfo
--html -I ${includedir} -I `dirname ${filename}` ${filename}
156 tar cf
${file}-html.
tar ${file}/*.html
157 texi2dvi
-I ${includedir} ${filename} </dev/null && dvips -o ${file}.ps ${file}.dvi
158 texi2pdf
-I ${includedir} ${filename} </dev
/null
159 mkdir
-p $DOCSDIR/$file
163 # Then build a gzipped copy of each of the resulting .html, .ps and .tar files
164 for file in */*.html
*.ps
*.pdf
*.
tar; do
165 cat $file |
gzip --best > $file.gz
168 # On the 15th of the month, wipe all the old files from the
171 if test $today = 15; then
172 find $DOCSDIR -type f
-maxdepth 1 -print |
grep -v index.html |
xargs rm
173 for m
in $MANUALS; do
174 rm -f $DOCSDIR/$m/*.html
$DOCSDIR/$m/*.html.gz
178 # And copy the resulting files to the web server
179 for file in */*.html
*.ps
*.pdf
*.
tar; do
180 if [ -f $DOCSDIR/$file ]; then
182 sed -e '/^<meta name=generator/d' \
183 -e '/^%DVIPSSource:/d' > file1
186 sed -e '/^<meta name=generator/d' \
187 -e '/^%DVIPSSource:/d' > file2
188 if cmp -s file1 file2
; then
191 cp $file $DOCSDIR/$file
192 cp $file.gz
$DOCSDIR/$file.gz
198 # Finally, generate the installation documentation
199 if [ "$RELEASE" = "trunk" ]; then
200 SOURCEDIR
=$WORKDIR/gcc
/gcc
/doc
201 DESTDIR
=$WWWBASE_PREFORMATTED/install
204 $WORKDIR/gcc
/gcc
/doc
/install.texi2html
206 # Preprocess the entire web site, not just the install docs!
207 echo "Invoking $WWWPREPROCESS"
208 $WWWPREPROCESS |
grep -v '^ Warning: Keeping'
211 # Clean up behind us.