scripts: add support for building manuals
authorMichael Hope <michael.hope@linaro.org>
Wed Nov 16 10:06:21 2011 +1300 (2011-11-16)
changeset 27656c5658b8b588
parent 2764 986e90e1ca27
child 2772 d4ac8609878e
scripts: add support for building manuals

Add support for building the HTML and PDF manuals for the major
components. Implement for binutils, GCC, GDB, and GLIBC.

Always build all manuals and install a subset. Be explicit about the
subset to reduce the clutter and to avoid getting copies of common
manuals like bfd from all of the sourceware based components. Downside of
being explicit is that you need to update it when a new component
comes along.

Build the manuals as part of the last GCC build, namely 'cc' for glibc
based ones and cc_core_pass_2 for baremetal.

An example of the output is at:
http://people.linaro.org/~michaelh/incoming/crosstool-NG/

Signed-off-by: Michael Hope <michael.hope@linaro.org>
[yann.morin.1998@anciens.enib.fr: depends on ! remove docs; gold manual install]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
config/global/paths.in
scripts/build/binutils/binutils.sh
scripts/build/cc/gcc.sh
scripts/build/debug/300-gdb.sh
scripts/build/libc/glibc-eglibc.sh-common
     1.1 --- a/config/global/paths.in	Wed Nov 16 17:36:17 2011 -0500
     1.2 +++ b/config/global/paths.in	Wed Nov 16 10:06:21 2011 +1300
     1.3 @@ -90,6 +90,14 @@
     1.4        Remove the installed documentation (man and info pages).
     1.5        Gains around 8MiB for a uClibc-based, C and C++ compiler.
     1.6  
     1.7 +config BUILD_MANUALS
     1.8 +    bool
     1.9 +    prompt "Build the manuals"
    1.10 +    depends on ! REMOVE_DOCS
    1.11 +    help
    1.12 +      Build the PDF and HTML manuals for the main components such as
    1.13 +      binutils, GCC, GDB, and the C library.
    1.14 +
    1.15  config INSTALL_DIR_RO
    1.16      bool
    1.17      prompt "Render the toolchain read-only"
     2.1 --- a/scripts/build/binutils/binutils.sh	Wed Nov 16 17:36:17 2011 -0500
     2.2 +++ b/scripts/build/binutils/binutils.sh	Wed Nov 16 10:06:21 2011 +1300
     2.3 @@ -20,6 +20,8 @@
     2.4      local -a extra_config
     2.5      local -a extra_make_flags
     2.6      local -a binutils_tools
     2.7 +    local -a manuals_for
     2.8 +    local -a manuals_install
     2.9  
    2.10      mkdir -p "${CT_BUILD_DIR}/build-binutils"
    2.11      cd "${CT_BUILD_DIR}/build-binutils"
    2.12 @@ -90,6 +92,18 @@
    2.13      CT_DoLog EXTRA "Installing binutils"
    2.14      CT_DoExecLog ALL make install
    2.15  
    2.16 +    if [ "${CT_BUILD_MANUALS}" = "y" ]; then
    2.17 +        CT_DoLog EXTRA "Building and installing the binutils manuals"
    2.18 +        manuals_for=( gas binutils ld gprof )
    2.19 +        if [ "${CT_BINUTILS_LINKER_GOLD}" = "y" ]; then
    2.20 +            manuals_for+=( gold )
    2.21 +        fi
    2.22 +        manuals_install=( "${manuals_for[@]/#/install-pdf-}" )
    2.23 +        manuals_install+=( "${manuals_for[@]/#/install-html-}" )
    2.24 +        CT_DoExecLog ALL make ${JOBSFLAGS} pdf html
    2.25 +        CT_DoExecLog ALL make "${manuals_install[@]}"
    2.26 +    fi
    2.27 +
    2.28      # Install the wrapper if needed
    2.29      if [ "${CT_BINUTILS_LD_WRAPPER}" = "y" ]; then
    2.30          CT_DoLog EXTRA "Installing ld wrapper"
     3.1 --- a/scripts/build/cc/gcc.sh	Wed Nov 16 17:36:17 2011 -0500
     3.2 +++ b/scripts/build/cc/gcc.sh	Wed Nov 16 10:06:21 2011 +1300
     3.3 @@ -79,9 +79,9 @@
     3.4      case "${CT_BARE_METAL},${CT_CANADIAN},${CT_THREADS}" in
     3.5          y,*,*)
     3.6              if [ "${CT_STATIC_TOOLCHAIN}" = "y" ]; then
     3.7 -                do_cc_core mode=baremetal build_libgcc=yes build_libstdcxx=yes build_staticlinked=yes
     3.8 +                do_cc_core mode=baremetal build_libgcc=yes build_libstdcxx=yes build_staticlinked=yes build_manuals=yes
     3.9              else
    3.10 -                do_cc_core mode=baremetal build_libgcc=yes build_libstdcxx=yes
    3.11 +                do_cc_core mode=baremetal build_libgcc=yes build_libstdcxx=yes build_manuals=yes
    3.12              fi
    3.13              ;;
    3.14          ,y,*)   ;;
    3.15 @@ -114,6 +114,7 @@
    3.16      local build_libgcc=no
    3.17      local build_libstdcxx=no
    3.18      local build_staticlinked=no
    3.19 +    local build_manuals=no
    3.20      local core_prefix_dir
    3.21      local lang_opt
    3.22      local tmp
    3.23 @@ -381,6 +382,13 @@
    3.24      CT_DoLog EXTRA "Installing ${mode} core C compiler"
    3.25      CT_DoExecLog ALL make ${JOBSFLAGS} "${core_targets[@]/#/install-}"
    3.26  
    3.27 +    if [ "${CT_BUILD_MANUALS}" = "y" -a "${build_manuals}" = "yes" ]; then
    3.28 +        CT_DoLog EXTRA "Building the GCC manuals"
    3.29 +        CT_DoExecLog ALL make pdf html
    3.30 +        CT_DoLog EXTRA "Installing the GCC manuals"
    3.31 +        CT_DoExecLog ALL make install-{pdf,html}-gcc
    3.32 +    fi
    3.33 +
    3.34      # Create a symlink ${CT_TARGET}-cc to ${CT_TARGET}-gcc to always be able
    3.35      # to call the C compiler with the same, somewhat canonical name.
    3.36      # check whether compiler has an extension
    3.37 @@ -625,6 +633,13 @@
    3.38      CT_DoLog EXTRA "Installing final compiler"
    3.39      CT_DoExecLog ALL make ${JOBSFLAGS} install
    3.40  
    3.41 +    if [ "${CT_BUILD_MANUALS}" = "y" ]; then
    3.42 +        CT_DoLog EXTRA "Building the GCC manuals"
    3.43 +        CT_DoExecLog ALL make ${JOBSFLAGS} pdf html
    3.44 +        CT_DoLog EXTRA "Installing the GCC manuals"
    3.45 +        CT_DoExecLog ALL make install-{pdf,html}-gcc
    3.46 +    fi
    3.47 +
    3.48      # Create a symlink ${CT_TARGET}-cc to ${CT_TARGET}-gcc to always be able
    3.49      # to call the C compiler with the same, somewhat canonical name.
    3.50      # check whether compiler has an extension
     4.1 --- a/scripts/build/debug/300-gdb.sh	Wed Nov 16 17:36:17 2011 -0500
     4.2 +++ b/scripts/build/debug/300-gdb.sh	Wed Nov 16 10:06:21 2011 +1300
     4.3 @@ -155,6 +155,12 @@
     4.4          CT_DoLog EXTRA "Installing cross-gdb"
     4.5          CT_DoExecLog ALL make install
     4.6  
     4.7 +        if [ "${CT_BUILD_MANUALS}" = "y" ]; then
     4.8 +            CT_DoLog EXTRA "Building and installing the cross-GDB manuals"
     4.9 +            CT_DoExecLog ALL make ${JOBSFLAGS} pdf html
    4.10 +            CT_DoExecLog ALL make install-{pdf,html}-gdb
    4.11 +        fi
    4.12 +
    4.13          if [ "${CT_GDB_INSTALL_GDBINIT}" = "y" ]; then
    4.14              CT_DoLog EXTRA "Install '.gdbinit' template"
    4.15              # See in scripts/build/internals.sh for why we do this
     5.1 --- a/scripts/build/libc/glibc-eglibc.sh-common	Wed Nov 16 17:36:17 2011 -0500
     5.2 +++ b/scripts/build/libc/glibc-eglibc.sh-common	Wed Nov 16 10:06:21 2011 +1300
     5.3 @@ -303,6 +303,18 @@
     5.4                                install_root="${CT_SYSROOT_DIR}"  \
     5.5                                install
     5.6  
     5.7 +        if [ "${CT_BUILD_MANUALS}" = "y" ]; then
     5.8 +            CT_DoLog EXTRA "Building and installing the C library manual"
     5.9 +            # Omit JOBSFLAGS as GLIBC has problems building the
    5.10 +            # manuals in parallel
    5.11 +            CT_DoExecLog ALL make pdf html
    5.12 +            # EGLIBC doesn't have a install-{pdf.html} and leaves the manuals
    5.13 +            # in the source directory
    5.14 +            CT_DoExecLog ALL mkdir -p ${CT_PREFIX_DIR}/share/doc
    5.15 +            CT_DoExecLog ALL cp -av ${src_dir}/manual/*.pdf ${src_dir}/manual/libc \
    5.16 +                ${CT_PREFIX_DIR}/share/doc
    5.17 +        fi
    5.18 +
    5.19          if [ "${CT_LIBC_LOCALES}" = "y" ]; then
    5.20              do_libc_locales
    5.21          fi