3 # Runs doxygen and massages the output files.
4 # Copyright (C) 2001-2018 Free Software Foundation, Inc.
6 # Synopsis: run_doxygen --mode=[html|latex|man|xml] --host_alias=<alias> \
11 # Originally hacked together by Phil Edwards <pme@gcc.gnu.org>
14 # We can check now that the version of doxygen is >= this variable.
18 local -r v_required
=`echo $DOXYVER | \
19 awk -F. '{if(NF<3)$3=0;print ($1*100+$2)*100+$3}'`
20 local testing_version doxygen maybedoxy v_found
22 set `IFS=:; X="$PATH:/usr/local/bin:/bin:/usr/bin"; echo $X`
25 # AC_EXEEXT could come in useful here
26 maybedoxy
="$dir/doxygen"
27 test -f "$maybedoxy" && testing_version
=`$maybedoxy --version`
28 if test -n "$testing_version"; then
29 v_found
=`echo $testing_version | \
30 awk -F. '{if(NF<3)$3=0;print ($1*100+$2)*100+$3}'`
31 if test $v_found -ge $v_required; then
37 if test -z "$doxygen"; then
38 echo run_doxygen error
: Could not
find Doxygen
$DOXYVER in path.
1>&2
41 # We need to use other tools from the same package/version.
42 echo :: Using Doxygen tools from
${dir}.
49 Usage: run_doxygen --mode=MODE --host_alias=BUILD_ALIAS [<options>]
50 <v3-src-dir> <v3-build-dir> <shortnamesp>
52 html Generate user-level HTML library documentation.
53 man Generate user-level man pages.
54 xml Generate user-level XML pages.
55 latex Generate user-level LaTeX pages.
57 BUILD_ALIAS is the GCC build alias set at configure time.
59 Note: Requires Doxygen ${DOXYVER} or later; get it at
60 ftp://ftp.stack.nl/pub/users/dimitri/doxygen-${DOXYVER}.src.tar.gz
69 # Blatantly ripped from autoconf, er, I mean, "gratefully standing
70 # on the shoulders of those giants who have gone before us."
72 -*=*) arg
=`echo "$o" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
81 --mode |
--host_alias |
--help |
-h)
84 # this turned out to be a mess, maybe change to --srcdir=, etc
85 if test $srcdir = unset; then
87 elif test $outdir = unset; then
89 outdir
=${o}/doc
/doxygen
90 elif test $shortname = unset; then
93 echo run_doxygen error
: Too many arguments
1>&2
114 DATEtext
=`date '+%Y-%m-%d'`
116 # Show how this script is called.
122 if test $srcdir = unset ||
test $outdir = unset ||
test $mode = unset ||
test $shortname = unset ||
test $host_alias = unset; then
123 # this could be better
124 echo run_doxygen error
: You have not given enough information...
! 1>&2
131 enabled_sections
=maint
132 generate_tagfile
="$outdir/html/libstdc++.tag"
136 enabled_sections
=maint
143 enabled_sections
=maint
146 echo run_doxygen error
: $mode is an invalid mode
1>&2
150 case x
"$shortname" in
156 echo run_doxygen error
: $shortname is invalid
1>&2
168 sed -e "s=@outdir@=${outdir}=g" \
169 -e "s=@srcdir@=${srcdir}=g" \
170 -e "s=@shortname@=${shortname}=g" \
171 -e "s=@builddir@=${builddir}=g" \
172 -e "s=@host_alias@=${host_alias}=g" \
173 -e "s=@enabled_sections@=${enabled_sections}=" \
174 -e "s=@do_html@=${do_html}=" \
175 -e "s=@do_latex@=${do_latex}=" \
176 -e "s=@do_man@=${do_man}=" \
177 -e "s=@do_xml@=${do_xml}=" \
178 -e "s=@generate_tagfile@=${generate_tagfile}=" \
179 ${srcdir}/doc/doxygen/user.cfg.in > ${outdir}/${mode}.cfg
180 echo :: NOTE that this may take some
time...
181 echo doxygen
${outdir}/${mode}.cfg
182 doxygen
${outdir}/${mode}.cfg
185 test $ret -ne 0 && exit $ret
189 echo :: XML pages begin with
190 echo :: ${outdir}/xml
/index.xml
196 # Grrr, Doxygen 1.8.x changed the -w latex options.
197 need_footer
=`doxygen -h | sed -n -e '/-w latex/s=.*footer.*=true=p'`
199 # Also drop in the header file (maybe footer file) and style sheet
200 if $need_footer; then
201 doxygen
-w latex header.tex footer.tex doxygen.sty
203 doxygen
-w latex header.tex doxygen.sty
207 echo :: LaTeX pages begin with
208 echo :: ${outdir}/latex
/refman.tex
214 #doxytag -t libstdc++.tag . > /dev/null 2>&1
216 # Strip pathnames from tag file.
217 sed -e '/<path>/d' libstdc
++.tag
> TEMP
218 mv TEMP libstdc
++.tag
220 sed -e "s=@DATE@=${DATEtext}=" \
221 ${srcdir}/doc
/doxygen
/mainpage.html
> index.html
223 # The following bit of line noise changes annoying
224 # std::foo < typename _Ugly1, typename _Ugly2, .... _DefaultUgly17 >
227 # in the major "Compound List" page.
228 sed -e 's=\(::[[:alnum:]_]*\)< .* >=\1=' annotated.html
> annstrip.html
229 mv annstrip.html annotated.html
231 cp ${srcdir}/doc
/doxygen
/tables.html tables.html
234 echo :: HTML pages begin with
235 echo :: ${outdir}/html
/index.html
238 # Mess with the man pages. We don't need documentation of the internal
239 # headers, since the man pages for those contain nothing useful anyhow. The
240 # man pages for doxygen modules need to be renamed (or deleted). And the
241 # generated #include lines need to be changed from the internal names to the
242 # standard ones (e.g., "#include <stl_tempbuf.h>" -> "#include <memory>").
245 echo :: Fixing up the man pages...
248 # File names with embedded spaces (EVIL!) need to be....? renamed or removed?
249 find .
-name "* *" -print0 |
xargs -0r rm # requires GNU tools
251 # man pages are for functions/types/other entities, not source files
252 # directly. who the heck would type "man foo.h" anyhow?
253 find .
-name "[a-z]*" -a ! -name "std_*" -print |
xargs rm
254 rm -f *.h
.3 *.hpp
.3 *config
* *.cc
.3 *.tcc
.3 *_t
.3
255 #rm ext_*.3 tr1_*.3 debug_*.3
257 # this is used to examine what we would have deleted, for debugging
259 #find . -name "[a-z]*" -a ! -name "std_*" -print | xargs -i mv {} trash
260 #mv *.h.3 *config* *.cc.3 *.tcc.3 *_t.3 trash
262 # Standardize the displayed header names. If anyone who knows perl cares
263 # enough to rewrite all this, feel free. This only gets run once a century,
264 # and I'm off getting coffee then anyhow, so I didn't care enough to make
266 g
++ ${srcdir}/doc
/doxygen
/stdheader.cc
-o .
/stdheader
267 problematic
=`egrep -l '#include <.*_.*>' [a-z]*.3`
268 for f
in $problematic; do
269 # this is also slow, but safe and easy to debug
270 oldh
=`sed -n '/fC#include </s/.*<\(.*\)>.*/\1/p' $f`
271 newh
=`echo $oldh | ./stdheader`
272 sed 's=${oldh}=${newh}=' $f > TEMP
277 # Some of the pages for generated modules have text that confuses certain
278 # implementations of man(1), e.g. on GNU/Linux. We need to have another
279 # top-level *roff tag to /stop/ the .SH NAME entry.
280 problematic
=`egrep --files-without-match '^\.SH SYNOPSIS' [A-Z]*.3`
281 #problematic='Containers.3 Sequences.3 Assoc_containers.3 Iterator_types.3'
283 for f
in $problematic; do
293 # Also, break this (generated) line up. It's ugly as sin.
294 problematic
=`grep -l '[^^]Definition at line' *.3`
295 for f
in $problematic; do
296 sed 's/Definition at line/\
302 cp ${srcdir}/doc
/doxygen
/Intro
.3 C
++Intro
.3
304 # Why didn't I do this at the start? Were rabid weasels eating my brain?
305 # Who the fsck would "man std_vector" when the class isn't named that?
307 # First, deal with nested namespaces.
308 for f
in *chrono_
*; do
309 newname
=`echo $f | sed 's/chrono_/chrono::/'`
312 for f
in *__debug_
*; do
313 newname
=`echo $f | sed 's/__debug_/__debug::/'`
316 for f
in *decimal_
*; do
317 newname
=`echo $f | sed 's/decimal_/decimal::/'`
320 for f
in *__detail_
*; do
321 newname
=`echo $f | sed 's/__detail_/__detail::/'`
324 for f
in *__gnu_pbds_detail_
*; do
325 newname
=`echo $f | sed 's/detail_/detail::/'`
328 for f
in *__parallel_
*; do
329 newname
=`echo $f | sed 's/__parallel_/__parallel::/'`
332 for f
in *__profile_
*; do
333 newname
=`echo $f | sed 's/__profile_/__profile::/'`
337 # Remove inline namespaces used for versioning.
339 newname
=`echo $f | sed 's/_V2_/::/'`
340 sed 's/::_V2::/::/g' $f > $newname
343 for f
in *_experimental_filesystem_v?_
*; do
344 newname
=`echo $f | sed 's/_filesystem_v._/::filesystem::/'`
345 sed 's/::filesystem::v.::/::filesystem::/g' $f > $newname
348 for f
in *experimental_fundamentals_v?_
*; do
349 newname
=`echo $f | sed 's/experimental_.*_v[[:digit:]]_/experimental::/'`
350 sed 's/::experimental::fundamentals_v[[:digit:]]::/::experimental::/g' $f > $newname
354 # Then, clean up other top-level namespaces.
355 for f
in std_tr1_
*; do
356 newname
=`echo $f | sed 's/^std_tr1_/std::tr1::/'`
359 for f
in std_tr2_
*; do
360 newname
=`echo $f | sed 's/^std_tr2_/std::tr2::/'`
364 newname
=`echo $f | sed 's/^std_/std::/'`
367 for f
in __gnu_cxx_
*; do
368 newname
=`echo $f | sed 's/^__gnu_cxx_/__gnu_cxx::/'`
371 for f
in __gnu_debug_
*; do
372 newname
=`echo $f | sed 's/^__gnu_debug_/__gnu_debug::/'`
375 for f
in __gnu_parallel_
*; do
376 newname
=`echo $f | sed 's/^__gnu_parallel_/__gnu_parallel::/'`
379 for f
in __gnu_profile_
*; do
380 newname
=`echo $f | sed 's/^__gnu_profile_/__gnu_profile::/'`
383 for f
in __gnu_pbds_
*; do
384 newname
=`echo $f | sed 's/^__gnu_pbds_/__gnu_pbds::/'`
387 for f
in __cxxabiv1_
*; do
388 newname
=`echo $f | sed 's/^__cxxabiv1_/abi::/'`
392 # Then piecemeal nested classes
395 # Generic removal bits, where there are things in the generated man
396 # pages that need to be killed.
397 for f
in *_libstdc__-v3_
*; do
406 # Also, for some reason, typedefs don't get their own man pages. Sigh.
407 for f
in ios streambuf istream ostream iostream stringbuf \
408 istringstream ostringstream stringstream filebuf ifstream \
409 ofstream fstream string
;
411 echo ".so man3/std::basic_${f}.3" > std
::${f}.3
412 echo ".so man3/std::basic_${f}.3" > std
::w
${f}.3
416 echo :: Man pages
in ${outdir}/man