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
14 WWWBASE
=/www
/gcc
/htdocs
15 WWWBASE_PREFORMATTED
=/www
/gcc
/htdocs-preformatted
16 WWWPREPROCESS
='/www/gcc/bin/preprocess -r'
18 # Process options -rrelease and -ddirectory
22 while [ $# -gt 0 ]; do
25 if [ -n "$RELEASE" ]; then
26 echo "Multiple releases specified" >&2
30 if [ -z "$RELEASE" ]; then
33 if [ -z "$RELEASE" ]; then
34 echo "No release specified with -r" >&2
40 if [ -n "$SUBDIR" ]; then
41 echo "Multiple subdirectories specified" >&2
45 if [ -z "$SUBDIR" ]; then
48 if [ -z "$SUBDIR" ]; then
49 echo "No subdirectory specified with -d" >&2
55 echo "Unknown argument \"$1\"" >&2
62 if [ -n "$RELEASE" ] && [ -z "$SUBDIR" ]; then
63 echo "Release specified without subdirectory" >&2
67 if [ -z "$SUBDIR" ]; then
68 DOCSDIR
=$WWWBASE/onlinedocs
70 DOCSDIR
=$WWWBASE/onlinedocs
/$SUBDIR
73 if [ ! -d $DOCSDIR ]; then
77 if [ -z "$RELEASE" ]; then
81 WORKDIR
=/tmp
/gcc-doc-update.$$
86 if [ "$RELEASE" = "trunk" ]; then
87 svn
-q export $SVNROOT/$RELEASE gcc
89 svn
-q export $SVNROOT/tags
/$RELEASE gcc
92 # Remove all unwanted files. This is needed (a) to build the Ada
93 # generator programs with the installed library, not the new one and
94 # (b) to avoid packaging all the sources instead of only documentation
96 find gcc
-type f \
( -name '*.texi' \
97 -o -path gcc
/gcc
/doc
/install.texi2html \
98 -o -path gcc
/gcc
/doc
/include
/texinfo.tex \
99 -o -path gcc
/gcc
/ada
/xgnatugn.adb \
100 -o -path gcc
/gcc
/ada
/ug_words \
101 -o -path gcc
/gcc
/BASE-VER \
102 -o -path gcc
/gcc
/DEV-PHASE \
103 -o -print0 \
) |
xargs -0 rm -f
105 # Build a tarball of the sources.
106 tar cf docs-sources.
tar gcc
108 # The directory to pass to -I; this is the one with texinfo.tex
110 includedir
=gcc
/gcc
/doc
/include
112 MANUALS
="cpp cppinternals fastjar gcc gccint gcj g77 gfortran gnat_ug_unx gnat_ug_vms gnat_ug_vxw gnat_ug_wnt gnat_ugn_unw gnat-style gnat_rm libgomp libiberty porting"
114 # Generate gnat_ugn_unw
116 if [ -f gcc
/gcc
/ada
/xgnatugn.adb
]; then
117 gnatmake
-q gcc
/gcc
/ada
/xgnatugn
118 .
/xgnatugn unw gcc
/gcc
/ada
/gnat_ugn.texi \
119 gcc
/gcc
/ada
/ug_words gnat_ugn_unw.texi
122 # Generate gcc-vers.texi.
124 echo "@set version-GCC $(cat gcc/gcc/BASE-VER)"
125 if [ "$(cat gcc/gcc/DEV-PHASE)" = "experimental" ]; then
126 echo "@set DEVELOPMENT"
128 echo "@clear DEVELOPMENT"
130 echo "@set srcdir $WORKDIR/gcc/gcc"
131 ) > $includedir/gcc-vers.texi
133 # Now convert the relevant files from texi to HTML, PDF and PostScript.
134 for file in $MANUALS; do
135 filename
=`find . -name ${file}.texi`
136 if [ "${filename}" ]; then
137 makeinfo
--html -I ${includedir} -I `dirname ${filename}` ${filename}
138 tar cf
${file}-html.
tar ${file}/*.html
139 texi2dvi
-I ${includedir} ${filename} </dev/null && dvips -o ${file}.ps ${file}.dvi
140 texi2pdf
-I ${includedir} ${filename} </dev
/null
141 mkdir
-p $DOCSDIR/$file
145 # Then build a gzipped copy of each of the resulting .html, .ps and .tar files
146 for file in */*.html
*.ps
*.pdf
*.
tar; do
147 cat $file |
gzip --best > $file.gz
150 # On the 15th of the month, wipe all the old files from the
153 if test $today = 15; then
154 find $DOCSDIR -type f
-maxdepth 1 -print |
grep -v index.html |
xargs rm
155 for m
in $MANUALS; do
156 rm -f $DOCSDIR/$m/*.html
$DOCSDIR/$m/*.html.gz
160 # And copy the resulting files to the web server
161 for file in */*.html
*.ps
*.pdf
*.
tar; do
162 if [ -f $DOCSDIR/$file ]; then
164 sed -e '/^<meta name=generator/d' \
165 -e '/^%DVIPSSource:/d' > file1
168 sed -e '/^<meta name=generator/d' \
169 -e '/^%DVIPSSource:/d' > file2
170 if cmp -s file1 file2
; then
173 cp $file $DOCSDIR/$file
174 cp $file.gz
$DOCSDIR/$file.gz
180 # Finally, generate the installation documentation
181 if [ "$RELEASE" = "trunk" ]; then
182 SOURCEDIR
=$WORKDIR/gcc
/gcc
/doc
183 DESTDIR
=$WWWBASE_PREFORMATTED/install
186 $WORKDIR/gcc
/gcc
/doc
/install.texi2html
188 # Preprocess the entire web site, not just the install docs!
189 echo "Invoking $WWWPREPROCESS"
190 $WWWPREPROCESS |
grep -v '^ Warning: Keeping'
193 # Clean up behind us.