re PR libstdc++/17218 (unknown subjects in generated libstdc++ manpages)
[gcc.git] / libstdc++-v3 / docs / doxygen / run_doxygen
index 76b51110dffbedb7ced594e7b9071b08364fd607..b00c4d47e783c6e477b56fc6307523c1c995905f 100644 (file)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 # Runs doxygen and massages the output files.
 # Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
@@ -9,13 +9,12 @@
 
 
 # We can check now that the version of doxygen is >= this variable.
-DOXYVER=1.2.15
-doxygen=
+DOXYVER=1.3.7
 
 find_doxygen() {
-    v_required=`echo $DOXYVER |  \
+    local -r v_required=`echo $DOXYVER |  \
                 awk -F. '{if(NF<3)$3=0;print ($1*100+$2)*100+$3}'`
-    testing_version=
+    local testing_version doxygen maybedoxy v_found
     # thank you goat book
     set `IFS=:; X="$PATH:/usr/local/bin:/bin:/usr/bin"; echo $X`
     for dir
@@ -36,6 +35,10 @@ find_doxygen() {
         echo run_doxygen error:  Could not find Doxygen $DOXYVER in path. 1>&2
         print_usage
     fi
+    # We need to use other tools from the same package/version.
+    echo :: Using Doxygen tools from ${dir}.
+    PATH=$dir:$PATH
+    hash -r
 }
 
 print_usage() {
@@ -92,9 +95,10 @@ parse_options() {
 mode=unset
 srcdir=unset
 outdir=unset
-do_html=no
-do_man=no
+do_html=false
+do_man=false
 enabled_sections=
+generate_tagfile=
 DATEtext=`date '+%Y-%m-%d'`
 
 parse_options $*
@@ -107,15 +111,20 @@ if test $srcdir = unset || test $outdir = unset || test $mode = unset; then
 fi
 
 case x"$mode" in
-    xuser)           do_html=yes
-                     LEVELtext='User'
-                     ;;
-    xmaint)          do_html=yes
-                     enabled_sections=maint
-                     LEVELtext='Maintainer'
-                     ;;
-    xman)            do_man=yes
-                     ;;
+    xuser)
+      do_html=true
+      LEVELtext='User'
+      generate_tagfile="$outdir/html_$mode/libstdc++.tag"
+      ;;
+    xmaint)
+      do_html=true
+      enabled_sections=maint
+      LEVELtext='Maintainer'
+      generate_tagfile="$outdir/html_$mode/libstdc++.tag"
+      ;;
+    xman)
+      do_man=true
+      ;;
     *)
       echo run_doxygen error:  $mode is an invalid mode 1>&2
       exit 1 ;;
@@ -126,10 +135,10 @@ mkdir -p $outdir
 chmod u+w $outdir
 
 # work around a stupid doxygen bug
-test $do_man = yes && {
+if $do_man; then
     mkdir -p $outdir/man/man3/ext
     chmod -R u+w $outdir/man/man3/ext
-}
+fi
 
 (
   set -e
@@ -140,17 +149,23 @@ test $do_man = yes && {
       -e "s=@enabled_sections@=${enabled_sections}=" \
       -e "s=@do_html@=${do_html}=" \
       -e "s=@do_man@=${do_man}=" \
+      -e "s=@generate_tagfile@=${generate_tagfile}=" \
       ${srcdir}/docs/doxygen/user.cfg.in > ${outdir}/${mode}.cfg
   echo :: NOTE that this may take some time...
-  echo $doxygen ${outdir}/${mode}.cfg
-  $doxygen ${outdir}/${mode}.cfg
+  echo doxygen ${outdir}/${mode}.cfg
+  doxygen ${outdir}/${mode}.cfg
   echo :: Finished, exit code was $?
 )
 ret=$?
 test $ret -ne 0 && exit $ret
 
-test $do_html = yes && {
+if $do_html; then
   cd ${outdir}/html_${mode}
+
+  #doxytag -t libstdc++.tag . > /dev/null 2>&1
+  sed -e '/<path>/d' libstdc++.tag > TEMP
+  mv TEMP libstdc++.tag
+
   sed -e "s=@LEVEL@=${LEVELtext}=" \
       -e "s=@DATE@=${DATEtext}=" \
       ${srcdir}/docs/doxygen/mainpage.html > index.html
@@ -173,14 +188,14 @@ test $do_html = yes && {
   echo ::
   echo :: HTML pages begin with
   echo :: ${outdir}/html_${mode}/index.html
-}
+fi
 
 # Mess with the man pages.  We don't need documentation of the internal
 # headers, since the man pages for those contain nothing useful anyhow.  The
 # man pages for doxygen modules need to be renamed (or deleted).  And the
 # generated #include lines need to be changed from the internal names to the
 # standard ones (e.g., "#include <stl_tempbuf.h>" -> "#include <memory>").
-test $do_man = yes && {
+if $do_man; then
 echo ::
 echo :: Fixing up the man pages...
 cd $outdir/man/man3
@@ -189,7 +204,7 @@ cd $outdir/man/man3
 rm -rf ext
 
 # File names with embedded spaces (EVIL!) need to be....?  renamed or removed?
-find . -name "* *" -print0 | xargs -0 rm        # requires GNU tools
+find . -name "* *" -print0 | xargs -0r rm        # requires GNU tools
 
 # can leave SGIextensions.3 alone, it's an okay name
 mv s20_3_1_base.3           Intro_functors.3
@@ -200,14 +215,14 @@ mv s20_3_5_negators.3       Negation_functors.3
 mv s20_3_6_binder.3         Binder_functors.3
 mv s20_3_7_adaptors.3       Func_ptr_functors.3
 mv s20_3_8_memadaptors.3    Member_ptr_functors.3
-mv std.3                    Namespace_Std.3
 mv iterator_tags.3          Iterator_types.3
+mv std.3                    Namespace_std.3
+mv __gnu_cxx.3              Namespace___gnu_cxx.3
 
 # man pages are for functions/types/other entities, not source files
 # directly.  who the heck would type "man foo.h" anyhow?
 find . -name "[a-z]*" -a ! -name "std_*" -print | xargs rm
-rm -f *.h.3 *config* *.cc.3 *.tcc.3
-rm -f *_t.3  # workaround doxygen template parsing bug for now
+rm -f *.h.3 *config* *.cc.3 *.tcc.3 *_t.3
 # this is used to examine what we would have deleted, for debugging
 #mkdir trash
 #find . -name "[a-z]*" -a ! -name "std_*" -print | xargs -i mv {} trash
@@ -232,8 +247,7 @@ rm stdheader
 # implementations of man(1), e.g., Linux's.  We need to have another top-level
 # *roff tag to /stop/ the .SH NAME entry.
 #problematic=`egrep --files-without-match '^\.SH SYNOPSIS' [A-Z]*.3`
-problematic='Containers.3 Sequences.3 Assoc_containers.3 Allocators.3
-             Iterator_types.3'
+problematic='Containers.3 Sequences.3 Assoc_containers.3 Iterator_types.3'
 for f in $problematic; do
     sed '/^\.SH NAME/{
 n
@@ -265,11 +279,18 @@ for f in __gnu_cxx_*; do
     newname=`echo $f | sed 's/^__gnu_cxx_/__gnu_cxx::/'`
     mv $f $newname
 done
-for f in *__policy_*; do
-    newname=`echo $f | sed 's/__policy_/__policy::/'`
-    mv $f $newname
+
+# Generic reoval bits, where there are things in the generated man
+# pages that need to be killed.
+for f in *_libstdc__-v3_*; do
+    rm $f 
+done
+
+for f in *_src_*; do
+    rm $f 
 done
 
+
 # Also, for some reason, typedefs don't get their own man pages.  Sigh.
 for f in ios streambuf istream ostream iostream stringbuf \
          istringstream ostringstream stringstream filebuf ifstream \
@@ -281,7 +302,7 @@ done
 
 echo ::
 echo :: Man pages in ${outdir}/man
-}
+fi
 
 # all done
 echo ::