source: trunk/src/gcc/maintainer-scripts/update_web_docs@ 734

Last change on this file since 734 was 2, checked in by bird, 23 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 3.9 KB
Line 
1#!/bin/sh -x
2
3# Generate HTML documentation from GCC Texinfo docs.
4# This version is for GCC 3.1 and later versions.
5
6# Run this from /tmp.
7CVSROOT=/cvs/gcc
8export CVSROOT
9
10PATH=/usr/local/bin:$PATH
11
12WWWBASE=/www/gcc/htdocs
13WWWBASE_PREFORMATTED=/www/gcc/htdocs-preformatted
14WWWPREPROCESS='/www/gcc/bin/preprocess -r'
15
16# Process options -rrelease and -ddirectory
17RELEASE=""
18SUBDIR=""
19
20while [ $# -gt 0 ]; do
21 case $1 in
22 -r*)
23 if [ -n "$RELEASE" ]; then
24 echo "Multiple releases specified" >&2
25 exit 1
26 fi
27 RELEASE="${1#-r}"
28 if [ -z "$RELEASE" ]; then
29 shift
30 RELEASE="$1"
31 if [ -z "$RELEASE" ]; then
32 echo "No release specified with -r" >&2
33 exit 1
34 fi
35 fi
36 ;;
37 -d*)
38 if [ -n "$SUBDIR" ]; then
39 echo "Multiple subdirectories specified" >&2
40 exit 1
41 fi
42 SUBDIR="${1#-d}"
43 if [ -z "$SUBDIR" ]; then
44 shift
45 SUBDIR="$1"
46 if [ -z "$SUBDIR" ]; then
47 echo "No subdirectory specified with -d" >&2
48 exit 1
49 fi
50 fi
51 ;;
52 *)
53 echo "Unknown argument \"$1\"" >&2
54 exit 1
55 ;;
56 esac
57 shift
58done
59
60if [ -n "$RELEASE" ] && [ -z "$SUBDIR" ]; then
61 echo "Release specified without subdirectory" >&2
62 exit 1
63fi
64
65if [ -z "$SUBDIR" ]; then
66 DOCSDIR=$WWWBASE/onlinedocs
67else
68 DOCSDIR=$WWWBASE/onlinedocs/$SUBDIR
69fi
70
71if [ ! -d $DOCSDIR ]; then
72 mkdir $DOCSDIR
73fi
74
75if [ -z "$RELEASE" ]; then
76 RELEASE=HEAD
77fi
78
79WORKDIR=/tmp/gcc-doc-update.$$
80
81/bin/rm -rf $WORKDIR
82/bin/mkdir $WORKDIR
83cd $WORKDIR
84
85# Find all the texi files in the repository, except those in directories
86# we do not care about (texinfo, etc).
87find $CVSROOT/gcc -name \*.texi,v -print | fgrep -v -f/home/gccadmin/scripts/doc_exclude | sed -e s#$CVSROOT/##g -e s#,v##g -e s#Attic/##g > FILES
88
89
90# Checkout all the texi files.
91cvs -Q co -r$RELEASE `cat FILES` gcc/gcc/doc/install.texi2html gcc/gcc/doc/include/texinfo.tex
92
93# The directory to pass to -I; this is the one with texinfo.tex
94# and fdl.texi.
95includedir=gcc/gcc/doc/include
96
97MANUALS="cpp chill cppinternals gcc gccint gcj g77 gnat-style libiberty porting"
98
99# Now convert the relevant files from texi to HTML and PostScript.
100for file in $MANUALS; do
101 filename=`find . -name ${file}.texi`
102 if [ "${filename}" ]; then
103 makeinfo --html -I ${includedir} -I `dirname ${filename}` ${filename}
104 texi2dvi -I ${includedir} ${filename} </dev/null && dvips -o ${file}.ps ${file}.dvi
105 mkdir -p $DOCSDIR/$file
106 fi
107done
108
109# Then build a gzipped copy of each of the resulting .html and .ps files
110for file in */*.html *.ps; do
111 cat $file | gzip --best > $file.gz
112done
113
114# On the 15th of the month, wipe all the old files from the
115# web server.
116today=`date +%d`
117if test $today = 15; then
118 find $DOCSDIR -type f -maxdepth 1 -print | grep -v index.html | xargs rm
119 for m in $MANUALS; do
120 rm $DOCSDIR/$m/*.html
121 done
122fi
123
124# And copy the resulting html files to the web server
125for file in */*.html *.ps; do
126 cat $DOCSDIR/$file |
127 sed -e '/^<meta name=generator/d' \
128 -e '/^%DVIPSSource:/d' > file1
129 cat $file |
130 sed -e '/^<meta name=generator/d' \
131 -e '/^%DVIPSSource:/d' > file2
132 if cmp -s file1 file2; then
133 :
134 else
135 cp $file $DOCSDIR/$file
136 cp $file.gz $DOCSDIR/$file.gz
137 fi
138done
139
140news_file=g77/News.html
141bugs_file=g77/Trouble.html
142
143cd $DOCSDIR
144
145rm -f g77_news.html
146rm -f g77_bugs.html
147rm -f g77_news.html.gz
148rm -f g77_bugs.html.gz
149ln $news_file g77_news.html
150ln $bugs_file g77_bugs.html
151ln ${news_file}.gz g77_news.html.gz
152ln ${bugs_file}.gz g77_bugs.html.gz
153
154# Finally, generate the installation documentation (but only for CVS HEAD).
155if [ "$RELEASE" = "HEAD" ]; then
156 SOURCEDIR=$WORKDIR/gcc/gcc/doc
157 DESTDIR=$WWWBASE_PREFORMATTED/install
158 export SOURCEDIR
159 export DESTDIR
160 $WORKDIR/gcc/gcc/doc/install.texi2html
161
162 # Preprocess the entire web site, not just the install docs!
163 echo "Invoking $WWWPREPROCESS"
164 $WWWPREPROCESS |grep -v '^ Warning: Keeping'
165fi
166
167# Clean up behind us.
168
169rm -rf $WORKDIR
Note: See TracBrowser for help on using the repository browser.