OSDN Git Service

* config/m68k/m68k.c (notice_update_cc): Use SET_DEST and
[pf3gnuchains/gcc-fork.git] / maintainer-scripts / update_web_docs_svn
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.
7 SVNROOT=${SVNROOT:-"file:///svn/gcc"}
8 export SVNROOT
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=trunk
77 fi
78
79 WORKDIR=/tmp/gcc-doc-update.$$
80
81 /bin/rm -rf $WORKDIR
82 /bin/mkdir $WORKDIR
83 cd $WORKDIR
84 # Find all the texi files in the repository, except those in directories
85 # we do not care about (texinfo, etc).
86 if [ "$RELEASE" = "trunk" ]; then
87   svn ls -R $SVNROOT/$RELEASE/gcc | grep "\.texi$" |fgrep -v -f/home/gccadmin/scripts/doc_exclude > FILES
88   # SVN export doesn't function like CVS, in that it doesn't create an entire empty path structure
89   # Thus, it's easiest to just export the entire tree
90   svn -q export $SVNROOT/$RELEASE gcc
91 #  # Checkout all the texi files.
92 #  for i in `cat FILES`; do
93 #    svn -q export $SVNROOT/$RELEASE/gcc/$i
94 #  done
95 #  svn -q export $SVNROOT/$RELEASE/gcc/doc/install.texi2html 
96 #  svn -q export $SVNROOT/$RELEASE/gcc/doc/include/texinfo.tex 
97 #  svn -q export $SVNROOT/$RELEASE/gcc/ada/xgnatugn.adb 
98 #  svn -q export $SVNROOT/$RELEASE/gcc/ada/ug_words
99 #  svn -q export $SVNROOT/$RELEASE/gcc/BASE-VER
100 #  svn -q export $SVNROOT/$RELEASE/gcc/DEV-PHASE
101 else
102   svn ls -R $SVNROOT/tags/$RELEASE/gcc | grep "\.texi$" |fgrep -v -f/home/gccadmin/scripts/doc_exclude > FILES
103   # SVN export doesn't function like CVS, in that it doesn't create an entire empty path structure
104   # Thus, it's easiest to just export the entire tree
105   svn -q export $SVNROOT/tags/$RELEASE gcc
106 #  # Checkout all the texi files.
107 #  for i in `cat FILES`; do
108 #    svn -q export $SVNROOT/tags/$RELEASE/gcc/$i
109 #  done
110 #  svn -q export $SVNROOT/tags/$RELEASE/gcc/doc/install.texi2html 
111 #  svn -q export $SVNROOT/tags/$RELEASE/gcc/doc/include/texinfo.tex 
112 #  svn -q export $SVNROOT/tags/$RELEASE/gcc/ada/xgnatugn.adb 
113 #  svn -q export $SVNROOT/tags/$RELEASE/gcc/ada/ug_words
114 #  svn -q export $SVNROOT/tags/$RELEASE/gcc/BASE-VER
115 #  svn -q export $SVNROOT/tags/$RELEASE/gcc/DEV-PHASE
116 fi
117
118 # Build a tarball of the sources.
119 tar cf docs-sources.tar gcc
120
121 # The directory to pass to -I; this is the one with texinfo.tex
122 # and fdl.texi.
123 includedir=gcc/gcc/doc/include
124
125 MANUALS="cpp cppinternals fastjar gcc gccint gcj g77 gfortran gnat_ug_unx gnat_ug_vms gnat_ug_vxw gnat_ug_wnt gnat_ugn_unw gnat-style gnat_rm libiberty porting"
126
127 # Generate gnat_ugn_unw
128
129 if [ -f gcc/gcc/ada/xgnatugn.adb ]; then
130    gnatmake -q gcc/gcc/ada/xgnatugn
131    ./xgnatugn unw gcc/gcc/ada/gnat_ugn.texi \
132      gcc/gcc/ada/ug_words gnat_ugn_unw.texi
133 fi
134
135 # Generate gcc-vers.texi.
136 (
137    echo "@set version-GCC $(cat gcc/gcc/BASE-VER)"
138    if [ "$(cat gcc/gcc/DEV-PHASE)" = "experimental" ]; then
139       echo "@set DEVELOPMENT"
140    else
141       echo "@clear DEVELOPMENT"
142    fi
143 ) > $includedir/gcc-vers.texi
144
145 # Now convert the relevant files from texi to HTML, PDF and PostScript.
146 for file in $MANUALS; do
147   filename=`find . -name ${file}.texi`
148   if [ "${filename}" ]; then
149     makeinfo --html -I ${includedir} -I `dirname ${filename}` ${filename}
150     tar cf ${file}-html.tar ${file}/*.html
151     texi2dvi -I ${includedir} ${filename} </dev/null && dvips -o ${file}.ps ${file}.dvi
152     texi2pdf -I ${includedir} ${filename} </dev/null
153     mkdir -p $DOCSDIR/$file
154   fi
155 done
156
157 # Then build a gzipped copy of each of the resulting .html, .ps and .tar files
158 for file in */*.html *.ps *.pdf *.tar; do
159   cat $file | gzip --best > $file.gz
160 done
161
162 # On the 15th of the month, wipe all the old files from the
163 # web server.
164 today=`date +%d`
165 if test $today = 15; then
166   find $DOCSDIR -type f -maxdepth 1 -print | grep -v index.html | xargs rm
167   for m in $MANUALS; do
168     rm $DOCSDIR/$m/*.html $DOCSDIR/$m/*.html.gz
169   done
170 fi
171
172 # And copy the resulting files to the web server
173 for file in */*.html *.ps *.pdf *.tar; do
174   cat $DOCSDIR/$file | 
175     sed -e '/^<meta name=generator/d' \
176         -e '/^%DVIPSSource:/d' > file1
177   cat $file |
178     sed -e '/^<meta name=generator/d' \
179         -e '/^%DVIPSSource:/d' > file2
180   if cmp -s file1 file2; then
181     :
182   else
183     cp $file $DOCSDIR/$file
184     cp $file.gz $DOCSDIR/$file.gz
185   fi
186 done
187
188 cd $DOCSDIR
189
190 # Finally, generate the installation documentation
191 if [ "$RELEASE" = "trunk" ]; then
192   SOURCEDIR=$WORKDIR/gcc/gcc/doc
193   DESTDIR=$WWWBASE_PREFORMATTED/install
194   export SOURCEDIR
195   export DESTDIR
196   $WORKDIR/gcc/gcc/doc/install.texi2html
197
198   # Preprocess the entire web site, not just the install docs!
199   echo "Invoking $WWWPREPROCESS"
200   $WWWPREPROCESS |grep -v '^  Warning: Keeping'
201 fi
202
203 # Clean up behind us.
204
205 rm -rf $WORKDIR