]>
Commit | Line | Data |
---|---|---|
f438273e JM |
1 | #!/bin/sh -x |
2 | ||
3 | # Generate HTML documentation from GCC Texinfo docs. | |
4 | # This version is for GCC 3.0.x and earlier versions. | |
5 | ||
6 | # Run this from /tmp. | |
7 | CVSROOT=/cvs/gcc | |
8 | export CVSROOT | |
9 | ||
10 | PATH=/usr/local/bin:$PATH | |
11 | ||
12 | WWWBASE=/www/gcc/htdocs | |
13 | WWWBASE_PREFORMATTED=/www/gcc/htdocs-preformatted | |
14 | WWWPREPROCESS='/www/gcc/bin/preprocess -r' | |
15 | ||
16 | # Process options -rrelease and -ddirectory | |
17 | RELEASE="" | |
18 | SUBDIR="" | |
19 | ||
20 | while [ $# -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 | |
58 | done | |
59 | ||
60 | if [ -n "$RELEASE" ] && [ -z "$SUBDIR" ]; then | |
61 | echo "Release specified without subdirectory" >&2 | |
62 | exit 1 | |
63 | fi | |
64 | ||
65 | if [ -z "$SUBDIR" ]; then | |
66 | DOCSDIR=$WWWBASE/onlinedocs | |
67 | else | |
68 | DOCSDIR=$WWWBASE/onlinedocs/$SUBDIR | |
69 | fi | |
70 | ||
71 | if [ ! -d $DOCSDIR ]; then | |
72 | mkdir $DOCSDIR | |
73 | fi | |
74 | ||
75 | if [ -z "$RELEASE" ]; then | |
76 | RELEASE=HEAD | |
f438273e JM |
77 | fi |
78 | ||
79 | WORKDIR=/tmp/gcc-doc-update.$$ | |
80 | ||
81 | /bin/rm -rf $WORKDIR | |
82 | /bin/mkdir $WORKDIR | |
83 | cd $WORKDIR | |
84 | ||
85 | # Find all the texi files in the repository, except those in directories | |
86 | # we do not care about (texinfo, etc). | |
87 | find $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. | |
91 | cvs -Q co -r$RELEASE `cat FILES` gcc/gcc/doc/install.texi2html gcc/gcc/texinfo.tex gcc/gcc/doc/texinfo.tex gcc/gcc/doc/include/texinfo.tex | |
92 | ||
93 | # Find the directory to pass to -I; this is the one with texinfo.tex | |
94 | # and fdl.texi. | |
95 | texitexloc=`find . -name texinfo.tex` | |
96 | includedir=${texitexloc%/*} | |
97 | ||
98 | # Now convert the relevant files from texi to HTML and PostScript. | |
99 | for file in cpp chill cppinternals gcc gcj g77 gnat-style libiberty \ | |
100 | objc-features porting; do | |
101 | filename=`find . -name ${file}.texi` | |
102 | if [ "${filename}" ]; then | |
103 | /usr/local/bin/texi2html -glossary -menu -split_chapter -I ${includedir} ${filename} | |
104 | texi2dvi -I ${includedir} ${filename} </dev/null && dvips -o ${file}.ps ${file}.dvi | |
105 | fi | |
106 | done | |
107 | ||
108 | # Then build a gzipped copy of each of the resulting .html and .ps files | |
109 | for file in *.html *.ps; do | |
110 | cat $file | gzip --best > $file.gz | |
111 | done | |
112 | ||
113 | # On the 15th of the month, wipe all the old files from the | |
114 | # web server. | |
115 | today=`date +%d` | |
116 | if test $today = 15; then | |
117 | find $DOCSDIR -type f -maxdepth 1 -print | grep -v index.html | xargs rm | |
118 | fi | |
119 | ||
120 | # And copy the resulting html files to the web server | |
121 | for file in *.html *.ps; do | |
122 | cat $DOCSDIR/$file | | |
123 | sed -e '/^<!-- Created on/d' \ | |
124 | -e '/^by <I>GCC Administrator<\/I> on/d' \ | |
125 | -e '/^%DVIPSSource:/d' > file1 | |
126 | cat $file | | |
127 | sed -e '/^<!-- Created on/d' \ | |
128 | -e '/^by <I>GCC Administrator<\/I> on/d' \ | |
129 | -e '/^%DVIPSSource:/d' > file2 | |
130 | if cmp -s file1 file2; then | |
131 | : | |
132 | else | |
133 | cp $file ${file}.gz $DOCSDIR | |
134 | fi | |
135 | done | |
136 | ||
f438273e JM |
137 | cd $DOCSDIR |
138 | ||
f438273e JM |
139 | # Finally, generate the installation documentation (but only for CVS HEAD). |
140 | if [ "$RELEASE" = "HEAD" ]; then | |
141 | SOURCEDIR=$WORKDIR/gcc/gcc/doc | |
142 | DESTDIR=$WWWBASE_PREFORMATTED/install | |
143 | export SOURCEDIR | |
144 | export DESTDIR | |
145 | $WORKDIR/gcc/gcc/doc/install.texi2html | |
146 | ||
147 | # Preprocess the entire web site, not just the install docs! | |
148 | echo "Invoking $WWWPREPROCESS" | |
149 | $WWWPREPROCESS |grep -v '^ Warning: Keeping' | |
150 | fi | |
151 | ||
152 | # Clean up behind us. | |
153 | ||
154 | rm -rf $WORKDIR |