3 # Generate HTML documentation from GCC Texinfo docs.
4 # This version is for GCC 3.1 and later versions.
7 SVNROOT=${SVNROOT:-"file:///svn/gcc"}
10 PATH=/usr/local/bin:$PATH
12 WWWBASE=/www/gcc/htdocs
13 WWWBASE_PREFORMATTED=/www/gcc/htdocs-preformatted
14 WWWPREPROCESS='/www/gcc/bin/preprocess -r'
16 # Process options -rrelease and -ddirectory
20 while [ $# -gt 0 ]; do
23 if [ -n "$RELEASE" ]; then
24 echo "Multiple releases specified" >&2
28 if [ -z "$RELEASE" ]; then
31 if [ -z "$RELEASE" ]; then
32 echo "No release specified with -r" >&2
38 if [ -n "$SUBDIR" ]; then
39 echo "Multiple subdirectories specified" >&2
43 if [ -z "$SUBDIR" ]; then
46 if [ -z "$SUBDIR" ]; then
47 echo "No subdirectory specified with -d" >&2
53 echo "Unknown argument \"$1\"" >&2
60 if [ -n "$RELEASE" ] && [ -z "$SUBDIR" ]; then
61 echo "Release specified without subdirectory" >&2
65 if [ -z "$SUBDIR" ]; then
66 DOCSDIR=$WWWBASE/onlinedocs
68 DOCSDIR=$WWWBASE/onlinedocs/$SUBDIR
71 if [ ! -d $DOCSDIR ]; then
75 if [ -z "$RELEASE" ]; then
79 WORKDIR=/tmp/gcc-doc-update.$$
84 # Find all the texi files in the repository, except those in directories
85 # we do not care about (texinfo, etc).
86 if [ "$RELEASE" = "trunk" ]; then
87 svn ls -R $SVNROOT/$RELEASE/gcc | grep "\.texi$" |fgrep -v -f/home/gccadmin/scripts/doc_exclude > FILES
88 # SVN export doesn't function like CVS, in that it doesn't create an entire empty path structure
89 # Thus, it's easiest to just export the entire tree
90 svn -q export $SVNROOT/$RELEASE gcc
91 # # Checkout all the texi files.
92 # for i in `cat FILES`; do
93 # svn -q export $SVNROOT/$RELEASE/gcc/$i
95 # svn -q export $SVNROOT/$RELEASE/gcc/doc/install.texi2html
96 # svn -q export $SVNROOT/$RELEASE/gcc/doc/include/texinfo.tex
97 # svn -q export $SVNROOT/$RELEASE/gcc/ada/xgnatugn.adb
98 # svn -q export $SVNROOT/$RELEASE/gcc/ada/ug_words
99 # svn -q export $SVNROOT/$RELEASE/gcc/BASE-VER
100 # svn -q export $SVNROOT/$RELEASE/gcc/DEV-PHASE
102 svn ls -R $SVNROOT/tags/$RELEASE/gcc | grep "\.texi$" |fgrep -v -f/home/gccadmin/scripts/doc_exclude > FILES
103 # SVN export doesn't function like CVS, in that it doesn't create an entire empty path structure
104 # Thus, it's easiest to just export the entire tree
105 svn -q export $SVNROOT/tags/$RELEASE gcc
106 # # Checkout all the texi files.
107 # for i in `cat FILES`; do
108 # svn -q export $SVNROOT/tags/$RELEASE/gcc/$i
110 # svn -q export $SVNROOT/tags/$RELEASE/gcc/doc/install.texi2html
111 # svn -q export $SVNROOT/tags/$RELEASE/gcc/doc/include/texinfo.tex
112 # svn -q export $SVNROOT/tags/$RELEASE/gcc/ada/xgnatugn.adb
113 # svn -q export $SVNROOT/tags/$RELEASE/gcc/ada/ug_words
114 # svn -q export $SVNROOT/tags/$RELEASE/gcc/BASE-VER
115 # svn -q export $SVNROOT/tags/$RELEASE/gcc/DEV-PHASE
118 # Build a tarball of the sources.
119 tar cf docs-sources.tar gcc
121 # The directory to pass to -I; this is the one with texinfo.tex
123 includedir=gcc/gcc/doc/include
125 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 libiberty porting"
127 # Generate gnat_ugn_unw
129 if [ -f gcc/gcc/ada/xgnatugn.adb ]; then
130 gnatmake -q gcc/gcc/ada/xgnatugn
131 ./xgnatugn unw gcc/gcc/ada/gnat_ugn.texi \
132 gcc/gcc/ada/ug_words gnat_ugn_unw.texi
135 # Generate gcc-vers.texi.
137 echo "@set version-GCC $(cat gcc/gcc/BASE-VER)"
138 if [ "$(cat gcc/gcc/DEV-PHASE)" = "experimental" ]; then
139 echo "@set DEVELOPMENT"
141 echo "@clear DEVELOPMENT"
143 ) > $includedir/gcc-vers.texi
145 # Now convert the relevant files from texi to HTML, PDF and PostScript.
146 for file in $MANUALS; do
147 filename=`find . -name ${file}.texi`
148 if [ "${filename}" ]; then
149 makeinfo --html -I ${includedir} -I `dirname ${filename}` ${filename}
150 tar cf ${file}-html.tar ${file}/*.html
151 texi2dvi -I ${includedir} ${filename} </dev/null && dvips -o ${file}.ps ${file}.dvi
152 texi2pdf -I ${includedir} ${filename} </dev/null
153 mkdir -p $DOCSDIR/$file
157 # Then build a gzipped copy of each of the resulting .html, .ps and .tar files
158 for file in */*.html *.ps *.pdf *.tar; do
159 cat $file | gzip --best > $file.gz
162 # On the 15th of the month, wipe all the old files from the
165 if test $today = 15; then
166 find $DOCSDIR -type f -maxdepth 1 -print | grep -v index.html | xargs rm
167 for m in $MANUALS; do
168 rm $DOCSDIR/$m/*.html $DOCSDIR/$m/*.html.gz
172 # And copy the resulting files to the web server
173 for file in */*.html *.ps *.pdf *.tar; do
175 sed -e '/^<meta name=generator/d' \
176 -e '/^%DVIPSSource:/d' > file1
178 sed -e '/^<meta name=generator/d' \
179 -e '/^%DVIPSSource:/d' > file2
180 if cmp -s file1 file2; then
183 cp $file $DOCSDIR/$file
184 cp $file.gz $DOCSDIR/$file.gz
190 # Finally, generate the installation documentation
191 if [ "$RELEASE" = "trunk" ]; then
192 SOURCEDIR=$WORKDIR/gcc/gcc/doc
193 DESTDIR=$WWWBASE_PREFORMATTED/install
196 $WORKDIR/gcc/gcc/doc/install.texi2html
198 # Preprocess the entire web site, not just the install docs!
199 echo "Invoking $WWWPREPROCESS"
200 $WWWPREPROCESS |grep -v '^ Warning: Keeping'
203 # Clean up behind us.