PR target/84828
[official-gcc.git] / maintainer-scripts / generate_libstdcxx_web_docs
blob00ebcbf7f6760468f1d676314488ffd71d440509
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=$(realpath ${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 # If the following step fails with an error like
38 # ! LaTeX Error: File `xtab.sty' not found.
39 # then you need to install the relevant TeX package e.g. texlive-xtab
40 make -C $target/libstdc++-v3 doc-install-html doc-install-xml doc-install-pdf DESTDIR=$DESTDIR
41 cd $DESTDIR/docs
42 mkdir libstdc++
43 for which in api manual
45 if [ -f libstdc++-$which-single.xml ] # Only needed for GCC 4.7.x
46 then
47 mv libstdc++-$which-single.xml libstdc++-$which.xml
49 gzip --best libstdc++-$which.xml
50 gzip --best libstdc++-$which.pdf
51 mv libstdc++-$which{.html,-html}
52 tar czf libstdc++-$which-html.tar.gz libstdc++-$which-html
53 mv libstdc++-$which-html libstdc++/$which
54 done
55 mv *.gz libstdc++ $DOCSDIR/
56 cd $start
57 rm -r $WORKDIR
58 rm -r $DESTDIR