Move ChangeLog entry for testsuite/gcc.dg/20050922-1.c from
[official-gcc.git] / maintainer-scripts / update_web_docs_svn
blob94f78ae5fd9f8e5909294301c8271b71acddd7df
1 #!/bin/sh -x
3 # Generate HTML documentation from GCC Texinfo docs.
4 # This version is for GCC 3.1 and later versions.
6 set -e
8 # Run this from /tmp.
9 SVNROOT=${SVNROOT:-"file:///svn/gcc"}
10 export SVNROOT
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
19 RELEASE=""
20 SUBDIR=""
22 while [ $# -gt 0 ]; do
23 case $1 in
24 -r*)
25 if [ -n "$RELEASE" ]; then
26 echo "Multiple releases specified" >&2
27 exit 1
29 RELEASE="${1#-r}"
30 if [ -z "$RELEASE" ]; then
31 shift
32 RELEASE="$1"
33 if [ -z "$RELEASE" ]; then
34 echo "No release specified with -r" >&2
35 exit 1
39 -d*)
40 if [ -n "$SUBDIR" ]; then
41 echo "Multiple subdirectories specified" >&2
42 exit 1
44 SUBDIR="${1#-d}"
45 if [ -z "$SUBDIR" ]; then
46 shift
47 SUBDIR="$1"
48 if [ -z "$SUBDIR" ]; then
49 echo "No subdirectory specified with -d" >&2
50 exit 1
55 echo "Unknown argument \"$1\"" >&2
56 exit 1
58 esac
59 shift
60 done
62 if [ -n "$RELEASE" ] && [ -z "$SUBDIR" ]; then
63 echo "Release specified without subdirectory" >&2
64 exit 1
67 if [ -z "$SUBDIR" ]; then
68 DOCSDIR=$WWWBASE/onlinedocs
69 else
70 DOCSDIR=$WWWBASE/onlinedocs/$SUBDIR
73 if [ ! -d $DOCSDIR ]; then
74 mkdir $DOCSDIR
77 if [ -z "$RELEASE" ]; then
78 RELEASE=trunk
81 WORKDIR=/tmp/gcc-doc-update.$$
83 rm -rf $WORKDIR
84 mkdir $WORKDIR
85 cd $WORKDIR
86 if [ "$RELEASE" = "trunk" ]; then
87 svn -q export $SVNROOT/$RELEASE gcc
88 else
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
95 # sources.
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
109 # and fdl.texi.
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"
127 else
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
143 done
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
148 done
150 # On the 15th of the month, wipe all the old files from the
151 # web server.
152 today=`date +%d`
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
157 done
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
163 cat $DOCSDIR/$file |
164 sed -e '/^<meta name=generator/d' \
165 -e '/^%DVIPSSource:/d' > file1
167 cat $file |
168 sed -e '/^<meta name=generator/d' \
169 -e '/^%DVIPSSource:/d' > file2
170 if cmp -s file1 file2; then
172 else
173 cp $file $DOCSDIR/$file
174 cp $file.gz $DOCSDIR/$file.gz
176 done
178 cd $DOCSDIR
180 # Finally, generate the installation documentation
181 if [ "$RELEASE" = "trunk" ]; then
182 SOURCEDIR=$WORKDIR/gcc/gcc/doc
183 DESTDIR=$WWWBASE_PREFORMATTED/install
184 export SOURCEDIR
185 export DESTDIR
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.
195 rm -rf $WORKDIR