Home | History | Annotate | Line # | Download | only in maintainer-scripts
      1 #!/bin/bash
      2 # Generate the libstdc++ onlinedocs for a GCC release
      3 # i.e. http://gcc.gnu.org/onlinedocs/gcc-x.y.z/libstdc++*
      4 
      5 SRCDIR=${1}
      6 DOCSDIR=${2}
      7 
      8 if ! [ $# -eq 2 -a -x "${SRCDIR}/configure" -a -d "${DOCSDIR}" ]
      9 then
     10   if ! [ $# -eq 2 ]
     11   then
     12     echo "$0: Wrong number of arguments" >&2
     13   elif ! [ -x "${SRCDIR}/configure" ]
     14   then
     15     echo "$0: No executable configure script found in $SRCDIR" >&2
     16   elif ! [ -d "${DOCSDIR}" ]
     17   then
     18     echo "$0: Output directory does not exist: $DOCSDIR" >&2
     19   fi
     20   echo "Usage: $0 <gcc src dir> <doc output dir>" >&2
     21   exit 1
     22 fi
     23 
     24 set -e
     25 
     26 DOCSDIR=$(realpath ${DOCSDIR})
     27 
     28 # Check we have some of the required tools
     29 for i in doxygen dot dblatex pdflatex makeindex
     30 do
     31   echo -n "Checking for $i... "
     32   which $i
     33 done
     34 
     35 start=$PWD
     36 WORKDIR=`mktemp -d $PWD/build.XXXXXX`
     37 DESTDIR=`mktemp -d $PWD/dest.XXXXXX`
     38 cd $WORKDIR
     39 disabled_libs=
     40 for dir in ${SRCDIR}/lib*
     41 do
     42   dir="${dir##*/}"
     43   [ $dir == 'libstdc++-v3' ] || disabled_libs="$disabled_libs --disable-$dir"
     44 done
     45 set -x
     46 ${SRCDIR}/configure --enable-languages=c,c++ --disable-gcc --disable-multilib $disabled_libs --docdir=/docs
     47 eval `grep '^target=' config.log`
     48 make configure-target
     49 # If the following step fails with an error like
     50 # ! LaTeX Error: File `xtab.sty' not found.
     51 # then you need to install the relevant TeX package e.g. texlive-xtab
     52 make -C $target/libstdc++-v3 doc-install-html doc-install-xml doc-install-pdf DESTDIR=$DESTDIR
     53 cd $DESTDIR/docs
     54 mkdir libstdc++
     55 for which in api manual
     56 do
     57   if [ -f libstdc++-$which-single.xml ] # Only needed for GCC 4.7.x
     58   then
     59     mv libstdc++-$which-single.xml libstdc++-$which.xml
     60   fi
     61   gzip --best libstdc++-$which.xml
     62   gzip --best libstdc++-$which.pdf
     63   mv libstdc++-$which{.html,-html}
     64   tar czf libstdc++-$which-html.tar.gz libstdc++-$which-html
     65   mv libstdc++-$which-html libstdc++/$which
     66 done
     67 mv *.gz libstdc++ $DOCSDIR/
     68 cd $start
     69 rm -r $WORKDIR
     70 rm -r $DESTDIR
     71 
     72