Mercurial > hg > CbC > CbC_gcc
comparison maintainer-scripts/update_web_docs_svn @ 0:a06113de4d67
first commit
author | kent <kent@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 17 Jul 2009 14:47:48 +0900 |
parents | |
children | 77e2b8dfacca |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:a06113de4d67 |
---|---|
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 set -e | |
7 | |
8 # Run this from /tmp. | |
9 SVNROOT=${SVNROOT:-"file:///svn/gcc"} | |
10 export SVNROOT | |
11 | |
12 PATH=/usr/local/bin:$PATH | |
13 | |
14 MANUALS="cpp | |
15 cppinternals | |
16 fastjar | |
17 gcc | |
18 gccint | |
19 gcj | |
20 gfortran | |
21 gfc-internals | |
22 gnat_ug_unx | |
23 gnat_ug_vms | |
24 gnat_ug_vxw | |
25 gnat_ug_wnt | |
26 gnat_ugn_unw | |
27 gnat-style | |
28 gnat_rm | |
29 libgomp | |
30 libiberty | |
31 porting" | |
32 | |
33 WWWBASE=/www/gcc/htdocs | |
34 WWWBASE_PREFORMATTED=/www/gcc/htdocs-preformatted | |
35 WWWPREPROCESS='/www/gcc/bin/preprocess -r' | |
36 | |
37 # Process options -rrelease and -ddirectory | |
38 RELEASE="" | |
39 SUBDIR="" | |
40 | |
41 while [ $# -gt 0 ]; do | |
42 case $1 in | |
43 -r*) | |
44 if [ -n "$RELEASE" ]; then | |
45 echo "Multiple releases specified" >&2 | |
46 exit 1 | |
47 fi | |
48 RELEASE="${1#-r}" | |
49 if [ -z "$RELEASE" ]; then | |
50 shift | |
51 RELEASE="$1" | |
52 if [ -z "$RELEASE" ]; then | |
53 echo "No release specified with -r" >&2 | |
54 exit 1 | |
55 fi | |
56 fi | |
57 ;; | |
58 -d*) | |
59 if [ -n "$SUBDIR" ]; then | |
60 echo "Multiple subdirectories specified" >&2 | |
61 exit 1 | |
62 fi | |
63 SUBDIR="${1#-d}" | |
64 if [ -z "$SUBDIR" ]; then | |
65 shift | |
66 SUBDIR="$1" | |
67 if [ -z "$SUBDIR" ]; then | |
68 echo "No subdirectory specified with -d" >&2 | |
69 exit 1 | |
70 fi | |
71 fi | |
72 ;; | |
73 *) | |
74 echo "Unknown argument \"$1\"" >&2 | |
75 exit 1 | |
76 ;; | |
77 esac | |
78 shift | |
79 done | |
80 | |
81 if [ -n "$RELEASE" ] && [ -z "$SUBDIR" ]; then | |
82 echo "Release specified without subdirectory" >&2 | |
83 exit 1 | |
84 fi | |
85 | |
86 if [ -z "$SUBDIR" ]; then | |
87 DOCSDIR=$WWWBASE/onlinedocs | |
88 else | |
89 DOCSDIR=$WWWBASE/onlinedocs/$SUBDIR | |
90 fi | |
91 | |
92 if [ ! -d $DOCSDIR ]; then | |
93 mkdir $DOCSDIR | |
94 fi | |
95 | |
96 if [ -z "$RELEASE" ]; then | |
97 RELEASE=trunk | |
98 fi | |
99 | |
100 WORKDIR=/tmp/gcc-doc-update.$$ | |
101 | |
102 rm -rf $WORKDIR | |
103 mkdir $WORKDIR | |
104 cd $WORKDIR | |
105 if [ "$RELEASE" = "trunk" ]; then | |
106 svn -q export $SVNROOT/$RELEASE gcc | |
107 else | |
108 svn -q export $SVNROOT/tags/$RELEASE gcc | |
109 fi | |
110 | |
111 # Remove all unwanted files. This is needed (a) to build the Ada | |
112 # generator programs with the installed library, not the new one and | |
113 # (b) to avoid packaging all the sources instead of only documentation | |
114 # sources. | |
115 find gcc -type f \( -name '*.texi' \ | |
116 -o -path gcc/gcc/doc/install.texi2html \ | |
117 -o -path gcc/gcc/doc/include/texinfo.tex \ | |
118 -o -path gcc/gcc/ada/xgnatugn.adb \ | |
119 -o -path gcc/gcc/ada/ug_words \ | |
120 -o -path gcc/gcc/BASE-VER \ | |
121 -o -path gcc/gcc/DEV-PHASE \ | |
122 -o -print0 \) | xargs -0 rm -f | |
123 | |
124 # Build a tarball of the sources. | |
125 tar cf docs-sources.tar gcc | |
126 | |
127 # The directory to pass to -I; this is the one with texinfo.tex | |
128 # and fdl.texi. | |
129 includedir=gcc/gcc/doc/include | |
130 | |
131 # Generate gnat_ugn_unw | |
132 | |
133 if [ -f gcc/gcc/ada/xgnatugn.adb ]; then | |
134 gnatmake -q gcc/gcc/ada/xgnatugn | |
135 ./xgnatugn unw gcc/gcc/ada/gnat_ugn.texi \ | |
136 gcc/gcc/ada/ug_words gnat_ugn_unw.texi | |
137 fi | |
138 | |
139 # Generate gcc-vers.texi. | |
140 ( | |
141 echo "@set version-GCC $(cat gcc/gcc/BASE-VER)" | |
142 if [ "$(cat gcc/gcc/DEV-PHASE)" = "experimental" ]; then | |
143 echo "@set DEVELOPMENT" | |
144 else | |
145 echo "@clear DEVELOPMENT" | |
146 fi | |
147 echo "@set srcdir $WORKDIR/gcc/gcc" | |
148 echo "@set VERSION_PACKAGE (GCC)" | |
149 echo "@set BUGURL @uref{http://gcc.gnu.org/bugs.html}" | |
150 ) > $includedir/gcc-vers.texi | |
151 | |
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 makeinfo --html -I ${includedir} -I `dirname ${filename}` -o ${file} ${filename} | |
157 tar cf ${file}-html.tar ${file}/*.html | |
158 texi2dvi -I ${includedir} -o ${file}.dvi ${filename} </dev/null && dvips -o ${file}.ps ${file}.dvi | |
159 texi2pdf -I ${includedir} -o ${file}.pdf ${filename} </dev/null | |
160 mkdir -p $DOCSDIR/$file | |
161 fi | |
162 done | |
163 | |
164 # Then build a gzipped copy of each of the resulting .html, .ps and .tar files | |
165 for file in */*.html *.ps *.pdf *.tar; do | |
166 cat $file | gzip --best > $file.gz | |
167 done | |
168 | |
169 # On the 15th of the month, wipe all the old files from the | |
170 # web server. | |
171 today=`date +%d` | |
172 if test $today = 15; then | |
173 find $DOCSDIR -type f -maxdepth 1 -print | grep -v index.html | xargs rm | |
174 for m in $MANUALS; do | |
175 rm -f $DOCSDIR/$m/*.html $DOCSDIR/$m/*.html.gz | |
176 done | |
177 fi | |
178 | |
179 # And copy the resulting files to the web server | |
180 for file in */*.html *.ps *.pdf *.tar; do | |
181 if [ -f $DOCSDIR/$file ]; then | |
182 cat $DOCSDIR/$file | | |
183 sed -e '/^<meta name=generator/d' \ | |
184 -e '/^%DVIPSSource:/d' > file1 | |
185 fi | |
186 cat $file | | |
187 sed -e '/^<meta name=generator/d' \ | |
188 -e '/^%DVIPSSource:/d' > file2 | |
189 if cmp -s file1 file2; then | |
190 : | |
191 else | |
192 cp $file $DOCSDIR/$file | |
193 cp $file.gz $DOCSDIR/$file.gz | |
194 fi | |
195 done | |
196 | |
197 cd $DOCSDIR | |
198 | |
199 # Finally, generate the installation documentation | |
200 if [ "$RELEASE" = "trunk" ]; then | |
201 SOURCEDIR=$WORKDIR/gcc/gcc/doc | |
202 DESTDIR=$WWWBASE_PREFORMATTED/install | |
203 export SOURCEDIR | |
204 export DESTDIR | |
205 $WORKDIR/gcc/gcc/doc/install.texi2html | |
206 | |
207 # Preprocess the entire web site, not just the install docs! | |
208 echo "Invoking $WWWPREPROCESS" | |
209 $WWWPREPROCESS |grep -v '^ Warning: Keeping' | |
210 fi | |
211 | |
212 # Clean up behind us. | |
213 | |
214 rm -rf $WORKDIR |