2014-08-04 Robert Dewar <dewar@adacore.com>
[official-gcc.git] / maintainer-scripts / generate_libstdcxx_web_docs
blob700e522e25c4e1aa6d8c1228d9ba38917d7d33dc
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++*
5 SRCDIR=${1}
6 DOCSDIR=${2}
8 if ! [ $# -eq 2 -a -x "${SRCDIR}/configure" -a -d "${DOCSDIR}" ]
9 then
10 echo "Usage: $0 <gcc src dir> <doc output dir>" >&2
11 exit 1
14 set -e
16 # Check we have some of the required tools
17 for i in doxygen dot dblatex pdflatex makeindex
19 echo -n "Checking for $i... "
20 which $i
21 done
23 start=$PWD
24 WORKDIR=`mktemp -d $PWD/build.XXXXXX`
25 DESTDIR=`mktemp -d $PWD/dest.XXXXXX`
26 cd $WORKDIR
27 disabled_libs=
28 for dir in ${SRCDIR}/lib*
30 dir="${dir##*/}"
31 [ $dir == 'libstdc++-v3' ] || disabled_libs="$disabled_libs --disable-$dir"
32 done
33 set -x
34 ${SRCDIR}/configure --enable-languages=c,c++ --disable-gcc $disabled_libs --docdir=/docs
35 eval `grep '^target=' config.log`
36 make configure-target
37 make -C $target/libstdc++-v3 doc-install-html doc-install-xml doc-install-pdf DESTDIR=$DESTDIR
38 cd $DESTDIR/docs
39 mkdir libstdc++
40 for which in api manual
42 if [ -f libstdc++-$which-single.xml ] # Only needed for GCC 4.7.x
43 then
44 mv libstdc++-$which-single.xml libstdc++-$which.xml
46 gzip --best libstdc++-$which.xml
47 gzip --best libstdc++-$which.pdf
48 mv libstdc++-$which{.html,-html}
49 tar czf libstdc++-$which-html.tar.gz libstdc++-$which-html
50 mv libstdc++-$which-html libstdc++/$which
51 done
52 mv *.gz libstdc++ $DOCSDIR/
53 cd $start
54 rm -r $WORKDIR
55 rm -r $DESTDIR