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
33 WWWBASE
=/www
/gcc
/htdocs
34 WWWBASE_PREFORMATTED
=/www
/gcc
/htdocs-preformatted
35 WWWPREPROCESS
='/www/gcc/bin/preprocess -r'
37 # Process options -rrelease and -ddirectory
41 while [ $# -gt 0 ]; do
44 if [ -n "$RELEASE" ]; then
45 echo "Multiple releases specified" >&2
49 if [ -z "$RELEASE" ]; then
52 if [ -z "$RELEASE" ]; then
53 echo "No release specified with -r" >&2
59 if [ -n "$SUBDIR" ]; then
60 echo "Multiple subdirectories specified" >&2
64 if [ -z "$SUBDIR" ]; then
67 if [ -z "$SUBDIR" ]; then
68 echo "No subdirectory specified with -d" >&2
74 echo "Unknown argument \"$1\"" >&2
81 if [ -n "$RELEASE" ] && [ -z "$SUBDIR" ]; then
82 echo "Release specified without subdirectory" >&2
86 if [ -z "$SUBDIR" ]; then
87 DOCSDIR
=$WWWBASE/onlinedocs
89 DOCSDIR
=$WWWBASE/onlinedocs
/$SUBDIR
92 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 to avoid packaging all the
113 # sources instead of only documentation sources.
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/ada/doc/gnat_ugn/*.png" \
124 -o -path "gcc/gcc/jit/docs/*" \
125 -o -path "gcc/gcc/jit/jit-common.h" \
126 -o -path "gcc/gcc/jit/notes.txt" \
127 -o -print0 \
) |
xargs -0 rm -f
129 # Build a tarball of the sources.
130 tar cf docs-sources.
tar gcc
132 # The directory to pass to -I; this is the one with texinfo.tex
134 includedir
=gcc
/gcc
/doc
/include
136 # Generate gcc-vers.texi.
138 echo "@set version-GCC $(cat gcc/gcc/BASE-VER)"
139 if [ "$(cat gcc/gcc/DEV-PHASE)" = "experimental" ]; then
140 echo "@set DEVELOPMENT"
142 echo "@clear DEVELOPMENT"
144 echo "@set srcdir $WORKDIR/gcc/gcc"
145 echo "@set VERSION_PACKAGE (GCC)"
146 echo "@set BUGURL @uref{http://gcc.gnu.org/bugs/}"
147 ) > $includedir/gcc-vers.texi
149 # Generate libquadmath-vers.texi.
150 echo "@set BUGURL @uref{http://gcc.gnu.org/bugs/}" \
151 > $includedir/libquadmath-vers.texi
153 # Now convert the relevant files from texi to HTML, PDF and PostScript.
154 for file in $MANUALS; do
155 filename
=`find . -name ${file}.texi`
156 if [ "${filename}" ]; then
157 includes
="-I ${includedir} -I `dirname ${filename}`"
158 if [ "$file" = "gnat_ugn" ]; then
159 includes
="$includes -I gcc/gcc/ada -I gcc/gcc/ada/doc/gnat_ugn"
161 makeinfo
--html --css-ref $CSS $includes -o ${file} ${filename}
162 tar cf
${file}-html.
tar ${file}/*.html
163 texi2dvi
$includes -o ${file}.dvi ${filename} </dev/null >/dev/null && dvips -o ${file}.ps ${file}.dvi
164 texi2pdf
$includes -o ${file}.pdf
${filename} </dev
/null
165 mkdir
-p $DOCSDIR/$file
169 # The jit is a special-case, using sphinx rather than texinfo.
170 # Specifically, the jit docs need sphinx 1.0 or later.
172 # The jit/docs Makefile uses the executable $(SPHINXBUILD),
173 # defaulting to "sphinx-build".
175 # sphinx is packaged in Fedora and EPEL 6 within "python-sphinx",
176 # and in openSUSE within "python-Sphinx".
178 # For EPEL6, python-sphinx is sphinx 0.6.6, which is missing various
179 # directives (e.g. ":c:macro:"), so we need the variant
180 # python-sphinx10 package. The latter installs its executable as
181 # /usr/bin/sphinx-1.0-build
182 # so we need to override SPHINXBUILD with this when invoking "make".
183 pushd gcc
/gcc
/jit
/docs
184 make SPHINXBUILD
=/usr
/bin
/sphinx-1.0
-build html
186 cp -a gcc
/gcc
/jit
/docs
/_build
/html jit
187 mkdir
-p $DOCSDIR/jit
189 # Work around makeinfo generated file names and references with
190 # "_002d" instead of "-".
191 find .
-name '*.html' |
while read f
; do
192 # Do this for the contents of each file.
193 sed -i -e 's/_002d/-/g' "$f"
194 # And rename files if necessary.
195 ff
=`echo $f | sed -e 's/_002d/-/g'`;
196 if [ "$f" != "$ff" ]; then
197 printf "Renaming %s to %s\n" "$f" "$ff"
202 # Then build a gzipped copy of each of the resulting .html, .ps and .tar files
203 for file in */*.html
*.ps
*.pdf
*.
tar; do
204 cat $file |
gzip --best > $file.gz
207 # On the 15th of the month, wipe all the old files from the
210 if test $today = 15; then
211 find $DOCSDIR -type f
-maxdepth 1 -print |
grep -v index.html |
xargs rm
212 for m
in $MANUALS; do
213 rm -f $DOCSDIR/$m/*.html
$DOCSDIR/$m/*.html.gz
217 # And copy the resulting files to the web server
218 for file in */*.html
*.ps
*.pdf
*.
tar; do
219 if [ -f $DOCSDIR/$file ]; then
221 sed -e '/^<meta name=generator/d' \
222 -e '/^%DVIPSSource:/d' > file1
225 sed -e '/^<meta name=generator/d' \
226 -e '/^%DVIPSSource:/d' > file2
227 if cmp -s file1 file2
; then
230 cp $file $DOCSDIR/$file
231 cp $file.gz
$DOCSDIR/$file.gz
235 # Again, the jit is a special case, with nested subdirectories
236 # below "jit", and with some non-HTML files (.png images from us,
237 # plus .css and .js supplied by sphinx, and source files, renamed
238 # from .rst to .txt).
240 -name "*.html" -o -name "*.png" \
241 -o -name "*.css" -o -name "*.js" \
244 # Note that $file here will contain path fragments beginning
245 # with "jit/", e.g. "jit/cp/topics/functions.html"
246 mkdir
-p $
(dirname $DOCSDIR/$file)
247 cp $file $DOCSDIR/$file
252 # Finally, generate the installation documentation
253 if [ "$RELEASE" = "trunk" ]; then
254 SOURCEDIR
=$WORKDIR/gcc
/gcc
/doc
255 DESTDIR
=$WWWBASE_PREFORMATTED/install
258 $WORKDIR/gcc
/gcc
/doc
/install.texi2html
260 # Preprocess the entire web site, not just the install docs!
261 echo "Invoking $WWWPREPROCESS"
262 $WWWPREPROCESS |
grep -v '^ Warning: Keeping'
265 # Clean up behind us.