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
34 WWWBASE
=/www
/gcc
/htdocs
35 WWWBASE_PREFORMATTED
=/www
/gcc
/htdocs-preformatted
36 WWWPREPROCESS
='/www/gcc/bin/preprocess -r'
38 # Process options -rrelease and -ddirectory
42 while [ $# -gt 0 ]; do
45 if [ -n "$RELEASE" ]; then
46 echo "Multiple releases specified" >&2
50 if [ -z "$RELEASE" ]; then
53 if [ -z "$RELEASE" ]; then
54 echo "No release specified with -r" >&2
60 if [ -n "$SUBDIR" ]; then
61 echo "Multiple subdirectories specified" >&2
65 if [ -z "$SUBDIR" ]; then
68 if [ -z "$SUBDIR" ]; then
69 echo "No subdirectory specified with -d" >&2
75 echo "Unknown argument \"$1\"" >&2
82 if [ -n "$RELEASE" ] && [ -z "$SUBDIR" ]; then
83 echo "Release specified without subdirectory" >&2
87 if [ -z "$SUBDIR" ]; then
88 DOCSDIR
=$WWWBASE/onlinedocs
90 DOCSDIR
=$WWWBASE/onlinedocs
/$SUBDIR
93 if [ ! -d $DOCSDIR ]; then
98 if [ -z "$RELEASE" ]; then
102 WORKDIR
=/tmp
/gcc-doc-update.$$
107 if [ "$RELEASE" = "trunk" ]; then
108 svn
-q export $SVNROOT/$RELEASE gcc
110 svn
-q export $SVNROOT/tags
/$RELEASE gcc
113 # Remove all unwanted files. This is needed to avoid packaging all the
114 # sources instead of only documentation sources.
115 # Note that we have to preserve gcc/jit/docs since the jit docs are
116 # not .texi files (Makefile, .rst and .png), and the jit docs use
117 # include directives to pull in content from jit/jit-common.h and
118 # jit/notes.txt, so we have to preserve those also.
119 find gcc
-type f \
( -name '*.texi' \
120 -o -path gcc
/gcc
/doc
/install.texi2html \
121 -o -path gcc
/gcc
/doc
/include
/texinfo.tex \
122 -o -path gcc
/gcc
/BASE-VER \
123 -o -path gcc
/gcc
/DEV-PHASE \
124 -o -path "gcc/gcc/ada/doc/gnat_ugn/*.png" \
125 -o -path "gcc/gcc/jit/docs/*" \
126 -o -path "gcc/gcc/jit/jit-common.h" \
127 -o -path "gcc/gcc/jit/notes.txt" \
128 -o -print0 \
) |
xargs -0 rm -f
130 # Build a tarball of the sources.
131 tar cf docs-sources.
tar gcc
133 # The directory to pass to -I; this is the one with texinfo.tex
135 includedir
=gcc
/gcc
/doc
/include
137 # Generate gcc-vers.texi.
139 echo "@set version-GCC $(cat gcc/gcc/BASE-VER)"
140 if [ "$(cat gcc/gcc/DEV-PHASE)" = "experimental" ]; then
141 echo "@set DEVELOPMENT"
143 echo "@clear DEVELOPMENT"
145 echo "@set srcdir $WORKDIR/gcc/gcc"
146 echo "@set VERSION_PACKAGE (GCC)"
147 echo "@set BUGURL @uref{http://gcc.gnu.org/bugs/}"
148 ) > $includedir/gcc-vers.texi
150 # Generate libquadmath-vers.texi.
151 echo "@set BUGURL @uref{http://gcc.gnu.org/bugs/}" \
152 > $includedir/libquadmath-vers.texi
154 # Now convert the relevant files from texi to HTML, PDF and PostScript.
155 for file in $MANUALS; do
156 filename
=`find . -name ${file}.texi`
157 if [ "${filename}" ]; then
158 includes
="-I ${includedir} -I `dirname ${filename}`"
159 if [ "$file" = "gnat_ugn" ]; then
160 includes
="$includes -I gcc/gcc/ada -I gcc/gcc/ada/doc/gnat_ugn"
162 makeinfo
--html --css-ref $CSS $includes -o ${file} ${filename}
163 tar cf
${file}-html.
tar ${file}/*.html
164 texi2dvi
$includes -o ${file}.dvi ${filename} </dev/null >/dev/null && dvips -o ${file}.ps ${file}.dvi
165 texi2pdf
$includes -o ${file}.pdf
${filename} </dev
/null
166 mkdir
-p $DOCSDIR/$file
170 # The jit is a special-case, using sphinx rather than texinfo.
171 # Specifically, the jit docs need sphinx 1.0 or later.
173 # The jit/docs Makefile uses the executable $(SPHINXBUILD),
174 # defaulting to "sphinx-build".
176 # sphinx is packaged in Fedora and EPEL 6 within "python-sphinx",
177 # and in openSUSE within "python-Sphinx".
179 # For EPEL6, python-sphinx is sphinx 0.6.6, which is missing various
180 # directives (e.g. ":c:macro:"), so we need the variant
181 # python-sphinx10 package. The latter installs its executable as
182 # /usr/bin/sphinx-1.0-build
183 # so we need to override SPHINXBUILD with this when invoking "make".
184 pushd gcc
/gcc
/jit
/docs
185 make SPHINXBUILD
=/usr
/bin
/sphinx-1.0
-build html
187 cp -a gcc
/gcc
/jit
/docs
/_build
/html jit
188 mkdir
-p $DOCSDIR/jit
190 # Work around makeinfo generated file names and references with
191 # "_002d" instead of "-".
192 find .
-name '*.html' |
while read f
; do
193 # Do this for the contents of each file.
194 sed -i -e 's/_002d/-/g' "$f"
195 # And rename files if necessary.
196 ff
=`echo $f | sed -e 's/_002d/-/g'`;
197 if [ "$f" != "$ff" ]; then
198 printf "Renaming %s to %s\n" "$f" "$ff"
203 # Then build a gzipped copy of each of the resulting .html, .ps and .tar files
204 for file in */*.html
*.ps
*.pdf
*.
tar; do
205 cat $file |
gzip --best > $file.gz
208 # On the 15th of the month, wipe all the old files from the
211 if test $today = 15; then
212 find $DOCSDIR -type f
-maxdepth 1 -print |
grep -v index.html |
xargs rm
213 for m
in $MANUALS; do
214 rm -f $DOCSDIR/$m/*.html
$DOCSDIR/$m/*.html.gz
218 # And copy the resulting files to the web server
219 for file in */*.html
*.ps
*.pdf
*.
tar; do
220 if [ -f $DOCSDIR/$file ]; then
222 sed -e '/^<meta name=generator/d' \
223 -e '/^%DVIPSSource:/d' > file1
226 sed -e '/^<meta name=generator/d' \
227 -e '/^%DVIPSSource:/d' > file2
228 if cmp -s file1 file2
; then
231 cp $file $DOCSDIR/$file
232 cp $file.gz
$DOCSDIR/$file.gz
236 # Again, the jit is a special case, with nested subdirectories
237 # below "jit", and with some non-HTML files (.png images from us,
238 # plus .css and .js supplied by sphinx, and source files, renamed
239 # from .rst to .txt).
241 -name "*.html" -o -name "*.png" \
242 -o -name "*.css" -o -name "*.js" \
245 # Note that $file here will contain path fragments beginning
246 # with "jit/", e.g. "jit/cp/topics/functions.html"
247 mkdir
-p $
(dirname $DOCSDIR/$file)
248 cp $file $DOCSDIR/$file
253 # Finally, generate the installation documentation
254 if [ "$RELEASE" = "trunk" ]; then
255 SOURCEDIR
=$WORKDIR/gcc
/gcc
/doc
256 DESTDIR
=$WWWBASE_PREFORMATTED/install
259 $WORKDIR/gcc
/gcc
/doc
/install.texi2html
261 # Preprocess the entire web site, not just the install docs!
262 echo "Invoking $WWWPREPROCESS"
263 $WWWPREPROCESS |
grep -v '^ Warning: Keeping'
266 # Clean up behind us.