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
31 WWWBASE
=/www
/gcc
/htdocs
32 WWWBASE_PREFORMATTED
=/www
/gcc
/htdocs-preformatted
33 WWWPREPROCESS
='/www/gcc/bin/preprocess -r'
35 # Process options -rrelease and -ddirectory
39 while [ $# -gt 0 ]; do
42 if [ -n "$RELEASE" ]; then
43 echo "Multiple releases specified" >&2
47 if [ -z "$RELEASE" ]; then
50 if [ -z "$RELEASE" ]; then
51 echo "No release specified with -r" >&2
57 if [ -n "$SUBDIR" ]; then
58 echo "Multiple subdirectories specified" >&2
62 if [ -z "$SUBDIR" ]; then
65 if [ -z "$SUBDIR" ]; then
66 echo "No subdirectory specified with -d" >&2
72 echo "Unknown argument \"$1\"" >&2
79 if [ -n "$RELEASE" ] && [ -z "$SUBDIR" ]; then
80 echo "Release specified without subdirectory" >&2
84 if [ -z "$SUBDIR" ]; then
85 DOCSDIR
=$WWWBASE/onlinedocs
87 DOCSDIR
=$WWWBASE/onlinedocs
/$SUBDIR
90 if [ ! -d $DOCSDIR ]; then
95 if [ -z "$RELEASE" ]; then
99 WORKDIR
=/tmp
/gcc-doc-update.$$
104 if [ "$RELEASE" = "trunk" ]; then
105 svn
-q export $SVNROOT/$RELEASE gcc
107 svn
-q export $SVNROOT/tags
/$RELEASE gcc
110 # Remove all unwanted files. This is needed (a) to build the Ada
111 # generator programs with the installed library, not the new one and
112 # (b) to avoid packaging all the sources instead of only documentation
114 # Note that we have to preserve gcc/jit/docs since the jit docs are
115 # not .texi files (Makefile, .rst and .png), and the jit docs use
116 # include directives to pull in content from jit/jit-common.h and
117 # jit/notes.txt, so we have to preserve those also.
118 find gcc
-type f \
( -name '*.texi' \
119 -o -path gcc
/gcc
/doc
/install.texi2html \
120 -o -path gcc
/gcc
/doc
/include
/texinfo.tex \
121 -o -path gcc
/gcc
/BASE-VER \
122 -o -path gcc
/gcc
/DEV-PHASE \
123 -o -path "gcc/gcc/jit/docs/*" \
124 -o -path "gcc/gcc/jit/jit-common.h" \
125 -o -path "gcc/gcc/jit/notes.txt" \
126 -o -print0 \
) |
xargs -0 rm -f
128 # Build a tarball of the sources.
129 tar cf docs-sources.
tar gcc
131 # The directory to pass to -I; this is the one with texinfo.tex
133 includedir
=gcc
/gcc
/doc
/include
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 echo "@set srcdir $WORKDIR/gcc/gcc"
144 echo "@set VERSION_PACKAGE (GCC)"
145 echo "@set BUGURL @uref{http://gcc.gnu.org/bugs/}"
146 ) > $includedir/gcc-vers.texi
148 # Generate libquadmath-vers.texi.
149 echo "@set BUGURL @uref{http://gcc.gnu.org/bugs/}" \
150 > $includedir/libquadmath-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" ]; 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 # The jit is a special-case, using sphinx rather than texinfo.
169 # The jit Makefile uses "sphinx-build". This is packaged in
170 # Fedora and EPEL 6 within "python-sphinx", and in openSUSE
171 # within "python-Sphinx".
172 pushd gcc
/gcc
/jit
/docs
175 cp -a gcc
/gcc
/jit
/docs
/_build
/html jit
176 mkdir
-p $DOCSDIR/jit
178 # Work around makeinfo generated file names and references with
179 # "_002d" instead of "-".
180 find .
-name '*.html' |
while read f
; do
181 # Do this for the contents of each file.
182 sed -i -e 's/_002d/-/g' "$f"
183 # And rename files if necessary.
184 ff
=`echo $f | sed -e 's/_002d/-/g'`;
185 if [ "$f" != "$ff" ]; then
186 printf "Renaming %s to %s\n" "$f" "$ff"
191 # Then build a gzipped copy of each of the resulting .html, .ps and .tar files
192 for file in */*.html
*.ps
*.pdf
*.
tar; do
193 cat $file |
gzip --best > $file.gz
196 # On the 15th of the month, wipe all the old files from the
199 if test $today = 15; then
200 find $DOCSDIR -type f
-maxdepth 1 -print |
grep -v index.html |
xargs rm
201 for m
in $MANUALS; do
202 rm -f $DOCSDIR/$m/*.html
$DOCSDIR/$m/*.html.gz
206 # And copy the resulting files to the web server
207 for file in */*.html
*.ps
*.pdf
*.
tar; do
208 if [ -f $DOCSDIR/$file ]; then
210 sed -e '/^<meta name=generator/d' \
211 -e '/^%DVIPSSource:/d' > file1
214 sed -e '/^<meta name=generator/d' \
215 -e '/^%DVIPSSource:/d' > file2
216 if cmp -s file1 file2
; then
219 cp $file $DOCSDIR/$file
220 cp $file.gz
$DOCSDIR/$file.gz
224 # Again, the jit is a special case, with nested subdirectories
225 # below "jit", and with some non-HTML files (.png images from us,
226 # plus .css and .js supplied by sphinx).
228 -name "*.html" -o -name "*.png" \
229 -o -name "*.css" -o -name "*.js" |
231 # Note that $file here will contain path fragments beginning
232 # with "jit/", e.g. "jit/cp/topics/functions.html"
233 mkdir
-p $
(dirname $DOCSDIR/$file)
234 cp $file $DOCSDIR/$file
239 # Finally, generate the installation documentation
240 if [ "$RELEASE" = "trunk" ]; then
241 SOURCEDIR
=$WORKDIR/gcc
/gcc
/doc
242 DESTDIR
=$WWWBASE_PREFORMATTED/install
245 $WORKDIR/gcc
/gcc
/doc
/install.texi2html
247 # Preprocess the entire web site, not just the install docs!
248 echo "Invoking $WWWPREPROCESS"
249 $WWWPREPROCESS |
grep -v '^ Warning: Keeping'
252 # Clean up behind us.