source: trunk/src/gcc/libstdc++-v3/docs/doxygen/run_doxygen@ 2252

Last change on this file since 2252 was 1392, checked in by bird, 22 years ago

This commit was generated by cvs2svn to compensate for changes in r1391,
which included commits to RCS files with non-trunk default branches.

  • Property cvs2svn:cvs-rev set to 1.1.1.2
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 8.5 KB
Line 
1#!/bin/sh
2
3# Runs doxygen and massages the output files.
4# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
5#
6# Synopsis: run_doxygen --mode=[user|maint|man] v3srcdir v3builddir
7#
8# Originally hacked together by Phil Edwards <[email protected]>
9
10
11# We can check now that the version of doxygen is >= this variable.
12DOXYVER=1.2.15
13doxygen=
14
15find_doxygen() {
16 v_required=`echo $DOXYVER | \
17 awk -F. '{if(NF<3)$3=0;print ($1*100+$2)*100+$3}'`
18 testing_version=
19 # thank you goat book
20 set `IFS=:; X="$PATH:/usr/local/bin:/bin:/usr/bin"; echo $X`
21 for dir
22 do
23 # AC_EXEEXT could come in useful here
24 maybedoxy="$dir/doxygen"
25 test -f "$maybedoxy" && testing_version=`$maybedoxy --version`
26 if test -n "$testing_version"; then
27 v_found=`echo $testing_version | \
28 awk -F. '{if(NF<3)$3=0;print ($1*100+$2)*100+$3}'`
29 if test $v_found -ge $v_required; then
30 doxygen="$maybedoxy"
31 break
32 fi
33 fi
34 done
35 if test -z "$doxygen"; then
36 echo run_doxygen error: Could not find Doxygen $DOXYVER in path. 1>&2
37 print_usage
38 fi
39}
40
41print_usage() {
42 cat 1>&2 <<EOF
43Usage: run_doxygen --mode=MODE [<options>] <v3-src-dir> <v3-build-dir>
44 MODE is one of:
45 user Generate user-level HTML library documentation.
46 maint Generate maintainers' HTML documentation (lots more;
47 exposes non-public members, etc).
48 man Generate user-level man pages.
49
50 more options when i think of them
51
52Note: Requires Doxygen ${DOXYVER} or later; get it at
53 ftp://ftp.stack.nl/pub/users/dimitri/doxygen-${DOXYVER}.src.tar.gz
54
55EOF
56 exit 1
57}
58
59parse_options() {
60 for o
61 do
62 # Blatantly ripped from autoconf, er, I mean, "gratefully standing
63 # on the shoulders of those giants who have gone before us."
64 case "$o" in
65 -*=*) arg=`echo "$o" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
66 *) arg= ;;
67 esac
68
69 case "$o" in
70 --mode=*)
71 mode=$arg ;;
72 --mode | --help | -h)
73 print_usage ;;
74 *)
75 # this turned out to be a mess, maybe change to --srcdir=, etc
76 if test $srcdir = unset; then
77 srcdir=$o
78 elif test $outdir = unset; then
79 builddir=${o}
80 outdir=${o}/docs/doxygen
81 else
82 echo run_doxygen error: Too many arguments 1>&2
83 exit 1
84 fi
85 ;;
86 esac
87 done
88}
89
90
91# script begins here
92mode=unset
93srcdir=unset
94outdir=unset
95do_html=no
96do_man=no
97enabled_sections=
98DATEtext=`date '+%Y-%m-%d'`
99
100parse_options $*
101find_doxygen
102
103if test $srcdir = unset || test $outdir = unset || test $mode = unset; then
104 # this could be better
105 echo run_doxygen error: You have not given enough information...! 1>&2
106 print_usage
107fi
108
109case x"$mode" in
110 xuser) do_html=yes
111 LEVELtext='User'
112 ;;
113 xmaint) do_html=yes
114 enabled_sections=maint
115 LEVELtext='Maintainer'
116 ;;
117 xman) do_man=yes
118 ;;
119 *)
120 echo run_doxygen error: $mode is an invalid mode 1>&2
121 exit 1 ;;
122esac
123
124#rm -rf $outdir
125mkdir -p $outdir
126chmod u+w $outdir
127
128# work around a stupid doxygen bug
129test $do_man = yes && {
130 mkdir -p $outdir/man/man3/ext
131 chmod -R u+w $outdir/man/man3/ext
132}
133
134(
135 set -e
136 cd $builddir
137 sed -e "s=@outdir@=${outdir}=g" \
138 -e "s=@srcdir@=${srcdir}=g" \
139 -e "s=@html_output_dir@=html_${mode}=" \
140 -e "s=@enabled_sections@=${enabled_sections}=" \
141 -e "s=@do_html@=${do_html}=" \
142 -e "s=@do_man@=${do_man}=" \
143 ${srcdir}/docs/doxygen/user.cfg.in > ${outdir}/${mode}.cfg
144 echo :: NOTE that this may take some time...
145 echo $doxygen ${outdir}/${mode}.cfg
146 $doxygen ${outdir}/${mode}.cfg
147 echo :: Finished, exit code was $?
148)
149ret=$?
150test $ret -ne 0 && exit $ret
151
152test $do_html = yes && {
153 cd ${outdir}/html_${mode}
154 sed -e "s=@LEVEL@=${LEVELtext}=" \
155 -e "s=@DATE@=${DATEtext}=" \
156 ${srcdir}/docs/doxygen/mainpage.html > index.html
157
158 # The following bit of line noise changes annoying
159 # std::foo < typename _Ugly1, typename _Ugly2, .... _DefaultUgly17 >
160 # to user-friendly
161 # std::foo
162 # in the major "Compound List" page.
163 sed -e 's=\(::[[:alnum:]_]*\)&lt; .* &gt;=\1=' annotated.html > annstrip.html
164 mv annstrip.html annotated.html
165
166 # Work around a bug in doxygen 1.3.
167 for f in class*html struct*html; do
168 sed '1,10s!^<title> Template!<title>Template !' $f > TEMP
169 mv TEMP $f
170 done
171
172 cp ${srcdir}/docs/doxygen/tables.html tables.html
173 echo ::
174 echo :: HTML pages begin with
175 echo :: ${outdir}/html_${mode}/index.html
176}
177
178# Mess with the man pages. We don't need documentation of the internal
179# headers, since the man pages for those contain nothing useful anyhow. The
180# man pages for doxygen modules need to be renamed (or deleted). And the
181# generated #include lines need to be changed from the internal names to the
182# standard ones (e.g., "#include <stl_tempbuf.h>" -> "#include <memory>").
183test $do_man = yes && {
184echo ::
185echo :: Fixing up the man pages...
186cd $outdir/man/man3
187
188# here's the other end of the "stupid doxygen bug" mentioned above
189rm -rf ext
190
191# File names with embedded spaces (EVIL!) need to be....? renamed or removed?
192find . -name "* *" -print0 | xargs -0 rm # requires GNU tools
193
194# can leave SGIextensions.3 alone, it's an okay name
195mv s20_3_1_base.3 Intro_functors.3
196mv s20_3_2_arithmetic.3 Arithmetic_functors.3
197mv s20_3_3_comparisons.3 Comparison_functors.3
198mv s20_3_4_logical.3 Logical_functors.3
199mv s20_3_5_negators.3 Negation_functors.3
200mv s20_3_6_binder.3 Binder_functors.3
201mv s20_3_7_adaptors.3 Func_ptr_functors.3
202mv s20_3_8_memadaptors.3 Member_ptr_functors.3
203mv std.3 Namespace_Std.3
204mv iterator_tags.3 Iterator_types.3
205
206# man pages are for functions/types/other entities, not source files
207# directly. who the heck would type "man foo.h" anyhow?
208find . -name "[a-z]*" -a ! -name "std_*" -print | xargs rm
209rm -f *.h.3 *config* *.cc.3 *.tcc.3
210rm -f *_t.3 # workaround doxygen template parsing bug for now
211# this is used to examine what we would have deleted, for debugging
212#mkdir trash
213#find . -name "[a-z]*" -a ! -name "std_*" -print | xargs -i mv {} trash
214#mv *.h.3 *config* *.cc.3 *.tcc.3 *_t.3 trash
215
216# Standardize the displayed header names. If anyone who knows perl cares
217# enough to rewrite all this, feel free. This only gets run once a century,
218# and I'm off getting coffee then anyhow, so I didn't care enough to make
219# this super-fast.
220g++ ${srcdir}/docs/doxygen/stdheader.cc -o ./stdheader
221problematic=`egrep -l '#include <.*_.*>' [a-z]*.3`
222for f in $problematic; do
223 # this is also slow, but safe and easy to debug
224 oldh=`sed -n '/fC#include </s/.*<\(.*\)>.*/\1/p' $f`
225 newh=`echo $oldh | ./stdheader`
226 sed "s=${oldh}=${newh}=" $f > TEMP
227 mv TEMP $f
228done
229rm stdheader
230
231# Some of the pages for generated modules have text that confuses certain
232# implementations of man(1), e.g., Linux's. We need to have another top-level
233# *roff tag to /stop/ the .SH NAME entry.
234#problematic=`egrep --files-without-match '^\.SH SYNOPSIS' [A-Z]*.3`
235problematic='Containers.3 Sequences.3 Assoc_containers.3 Allocators.3
236 Iterator_types.3'
237for f in $problematic; do
238 sed '/^\.SH NAME/{
239n
240a\
241\
242.SH SYNOPSIS
243 }' $f > TEMP
244 mv TEMP $f
245done
246
247# Also, break this (generated) line up. It's ugly as sin.
248problematic=`grep -l '[^^]Definition at line' *.3`
249for f in $problematic; do
250 sed 's/Definition at line/\
251.PP\
252&/' $f > TEMP
253 mv TEMP $f
254done
255
256cp ${srcdir}/docs/doxygen/Intro.3 C++Intro.3
257
258# Why didn't I do this at the start? Were rabid weasels eating my brain?
259# Who the fsck would "man std_vector" when the class isn't named that?
260for f in std_*; do
261 newname=`echo $f | sed 's/^std_/std::/'`
262 mv $f $newname
263done
264for f in __gnu_cxx_*; do
265 newname=`echo $f | sed 's/^__gnu_cxx_/__gnu_cxx::/'`
266 mv $f $newname
267done
268for f in *__policy_*; do
269 newname=`echo $f | sed 's/__policy_/__policy::/'`
270 mv $f $newname
271done
272
273# Also, for some reason, typedefs don't get their own man pages. Sigh.
274for f in ios streambuf istream ostream iostream stringbuf \
275 istringstream ostringstream stringstream filebuf ifstream \
276 ofstream fstream string;
277do
278 echo ".so man3/std::basic_${f}.3" > std::${f}.3
279 echo ".so man3/std::basic_${f}.3" > std::w${f}.3
280done
281
282echo ::
283echo :: Man pages in ${outdir}/man
284}
285
286# all done
287echo ::
288
289exit 0
290
291# vim:ts=4:et:
Note: See TracBrowser for help on using the repository browser.