3 # Runs doxygen and massages the output files.
4 # Copyright (C) 2001, 2002, 2003, 2004, 2008 Free Software Foundation, Inc.
6 # Synopsis: run_doxygen --mode=[html|man|xml] --host_alias=<alias> \
9 # Originally hacked together by Phil Edwards <pme@gcc.gnu.org>
12 # We can check now that the version of doxygen is >= this variable.
16 local -r v_required
=`echo $DOXYVER | \
17 awk -F. '{if(NF<3)$3=0;print ($1*100+$2)*100+$3}'`
18 local testing_version doxygen maybedoxy v_found
20 set `IFS=:; X="$PATH:/usr/local/bin:/bin:/usr/bin"; echo $X`
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
35 if test -z "$doxygen"; then
36 echo run_doxygen error
: Could not
find Doxygen
$DOXYVER in path.
1>&2
39 # We need to use other tools from the same package/version.
40 echo :: Using Doxygen tools from
${dir}.
47 Usage: run_doxygen --mode=MODE --host_alias=BUILD_ALIAS [<options>]
48 <v3-src-dir> <v3-build-dir>
50 html Generate user-level HTML library documentation.
51 man Generate user-level man pages.
52 xml Generate user-level XML pages.
54 BUILD_ALIAS is the GCC build alias set at configure time.
56 Note: Requires Doxygen ${DOXYVER} or later; get it at
57 ftp://ftp.stack.nl/pub/users/dimitri/doxygen-${DOXYVER}.src.tar.gz
66 # Blatantly ripped from autoconf, er, I mean, "gratefully standing
67 # on the shoulders of those giants who have gone before us."
69 -*=*) arg
=`echo "$o" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
78 --mode |
--host_alias |
--help |
-h)
81 # this turned out to be a mess, maybe change to --srcdir=, etc
82 if test $srcdir = unset; then
84 elif test $outdir = unset; then
86 outdir
=${o}/doc
/doxygen
88 echo run_doxygen error
: Too many arguments
1>&2
107 DATEtext
=`date '+%Y-%m-%d'`
109 # Show how this script is called.
115 if test $srcdir = unset ||
test $outdir = unset ||
test $mode = unset ||
test $host_alias = unset; then
116 # this could be better
117 echo run_doxygen error
: You have not given enough information...
! 1>&2
124 enabled_sections
=maint
125 generate_tagfile
="$outdir/html/libstdc++.tag"
132 enabled_sections
=maint
135 echo run_doxygen error
: $mode is an invalid mode
1>&2
142 # work around a stupid doxygen bug
144 mkdir
-p $outdir/man
/man
3/ext
145 chmod -R u
+w
$outdir/man
/man
3/ext
155 sed -e "s=@outdir@=${outdir}=g" \
156 -e "s=@srcdir@=${srcdir}=g" \
157 -e "s=@builddir@=${builddir}=g" \
158 -e "s=@host_alias@=${host_alias}=g" \
159 -e "s=@html_output_dir@=html=" \
160 -e "s=@enabled_sections@=${enabled_sections}=" \
161 -e "s=@do_html@=${do_html}=" \
162 -e "s=@do_man@=${do_man}=" \
163 -e "s=@do_xml@=${do_xml}=" \
164 -e "s=@generate_tagfile@=${generate_tagfile}=" \
165 ${srcdir}/doc/doxygen/user.cfg.in > ${outdir}/${mode}.cfg
166 echo :: NOTE that this may take some
time...
167 echo doxygen
${outdir}/${mode}.cfg
168 doxygen
${outdir}/${mode}.cfg
169 echo :: Finished
, exit code was $?
172 test $ret -ne 0 && exit $ret
177 #doxytag -t libstdc++.tag . > /dev/null 2>&1
178 sed -e '/<path>/d' libstdc
++.tag
> TEMP
179 mv TEMP libstdc
++.tag
181 sed -e "s=@DATE@=${DATEtext}=" \
182 ${srcdir}/doc
/doxygen
/mainpage.html
> index.html
184 # The following bit of line noise changes annoying
185 # std::foo < typename _Ugly1, typename _Ugly2, .... _DefaultUgly17 >
188 # in the major "Compound List" page.
189 sed -e 's=\(::[[:alnum:]_]*\)< .* >=\1=' annotated.html
> annstrip.html
190 mv annstrip.html annotated.html
192 # Work around a bug in doxygen 1.3.
193 # for f in class*html struct*html; do
194 for f
in class
*html
; do
195 sed '1,10s!^<title> Template!<title>Template !' $f > TEMP
199 cp ${srcdir}/doc
/doxygen
/tables.html tables.html
201 echo :: HTML pages begin with
202 echo :: ${outdir}/html
/index.html
205 # Mess with the man pages. We don't need documentation of the internal
206 # headers, since the man pages for those contain nothing useful anyhow. The
207 # man pages for doxygen modules need to be renamed (or deleted). And the
208 # generated #include lines need to be changed from the internal names to the
209 # standard ones (e.g., "#include <stl_tempbuf.h>" -> "#include <memory>").
212 echo :: Fixing up the man pages...
215 # here's the other end of the "stupid doxygen bug" mentioned above
218 # File names with embedded spaces (EVIL!) need to be....? renamed or removed?
219 find .
-name "* *" -print0 |
xargs -0r rm # requires GNU tools
221 # can leave SGIextensions.3 alone, it's an okay name
222 mv s20_3_1_base
.3 Intro_functors
.3
223 mv s20_3_2_arithmetic
.3 Arithmetic_functors
.3
224 mv s20_3_3_comparisons
.3 Comparison_functors
.3
225 mv s20_3_4_logical
.3 Logical_functors
.3
226 mv s20_3_5_negators
.3 Negation_functors
.3
227 #mv s20_3_6_binder.3 Binder_functors.3
228 mv s20_3_7_adaptors
.3 Func_ptr_functors
.3
229 mv s20_3_8_memadaptors
.3 Member_ptr_functors
.3
230 mv iterator_tags
.3 Iterator_types
.3
231 mv std
.3 Namespace_std
.3
232 mv __gnu_cxx
.3 Namespace___gnu_cxx
.3
234 # man pages are for functions/types/other entities, not source files
235 # directly. who the heck would type "man foo.h" anyhow?
236 find .
-name "[a-z]*" -a ! -name "std_*" -print |
xargs rm
237 rm -f *.h
.3 *config
* *.cc
.3 *.tcc
.3 *_t
.3
238 # this is used to examine what we would have deleted, for debugging
240 #find . -name "[a-z]*" -a ! -name "std_*" -print | xargs -i mv {} trash
241 #mv *.h.3 *config* *.cc.3 *.tcc.3 *_t.3 trash
243 # Standardize the displayed header names. If anyone who knows perl cares
244 # enough to rewrite all this, feel free. This only gets run once a century,
245 # and I'm off getting coffee then anyhow, so I didn't care enough to make
247 g
++ ${srcdir}/doc
/doxygen
/stdheader.cc
-o .
/stdheader
248 problematic
=`egrep -l '#include <.*_.*>' [a-z]*.3`
249 for f
in $problematic; do
250 # this is also slow, but safe and easy to debug
251 oldh
=`sed -n '/fC#include </s/.*<\(.*\)>.*/\1/p' $f`
252 newh
=`echo $oldh | ./stdheader`
253 sed "s=${oldh}=${newh}=" $f > TEMP
258 # Some of the pages for generated modules have text that confuses certain
259 # implementations of man(1), e.g., Linux's. We need to have another top-level
260 # *roff tag to /stop/ the .SH NAME entry.
261 #problematic=`egrep --files-without-match '^\.SH SYNOPSIS' [A-Z]*.3`
262 problematic
='Containers.3 Sequences.3 Assoc_containers.3 Iterator_types.3'
263 for f
in $problematic; do
273 # Also, break this (generated) line up. It's ugly as sin.
274 problematic
=`grep -l '[^^]Definition at line' *.3`
275 for f
in $problematic; do
276 sed 's/Definition at line/\
282 cp ${srcdir}/doc
/doxygen
/Intro
.3 C
++Intro
.3
284 # Why didn't I do this at the start? Were rabid weasels eating my brain?
285 # Who the fsck would "man std_vector" when the class isn't named that?
287 # First, deal with nested namespaces.
288 for f
in *__detail_
*; do
289 newname
=`echo $f | sed 's/__detail_/__detail::/'`
292 for f
in *__parallel_
*; do
293 newname
=`echo $f | sed 's/__parallel_/__parallel::/'`
297 # Then, clean up other top-level namespaces.
298 for f
in std_tr1_
*; do
299 newname
=`echo $f | sed 's/^std_tr1_/std::tr1::/'`
303 newname
=`echo $f | sed 's/^std_/std::/'`
306 for f
in __gnu_cxx_
*; do
307 newname
=`echo $f | sed 's/^__gnu_cxx_/__gnu_cxx::/'`
310 for f
in __gnu_debug_
*; do
311 newname
=`echo $f | sed 's/^__gnu_debug_/__gnu_debug::/'`
314 for f
in __gnu_parallel_
*; do
315 newname
=`echo $f | sed 's/^__gnu_parallel_/__gnu_parallel::/'`
319 # Generic removal bits, where there are things in the generated man
320 # pages that need to be killed.
321 for f
in *_libstdc__-v3_
*; do
330 # Also, for some reason, typedefs don't get their own man pages. Sigh.
331 for f
in ios streambuf istream ostream iostream stringbuf \
332 istringstream ostringstream stringstream filebuf ifstream \
333 ofstream fstream string
;
335 echo ".so man3/std::basic_${f}.3" > std
::${f}.3
336 echo ".so man3/std::basic_${f}.3" > std
::w
${f}.3
340 echo :: Man pages
in ${outdir}/man