diff mbox

scripts: add support for building manuals

Message ID ae6b7b791db59c66639a.1321391259@crucis
State New
Headers show

Commit Message

Michael Hope Nov. 15, 2011, 9:07 p.m. UTC
# HG changeset patch
# User Michael Hope <michael.hope@linaro.org>
# Date 1321391181 -46800
# Branch add-manuals
# Node ID ae6b7b791db59c66639a4eb0aa6dc172c9d399c6
# Parent  7f305778ab05e60e58722d21e03e5140588a1438
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.

Dodgy: always try install the non-existant GOLD manual.  Should really
check .config to see if GOLD is enabled.

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

Signed-off-by: Michael Hope <michael.hope@linaro.org>

Comments

Yann E. MORIN Nov. 15, 2011, 11:52 p.m. UTC | #1
Michael, All,

On Tuesday 15 November 2011 22:07:39 Michael Hope wrote:
> # HG changeset patch
> # User Michael Hope <michael.hope@linaro.org>
> # Date 1321391181 -46800
> # Branch add-manuals
> # Node ID ae6b7b791db59c66639a4eb0aa6dc172c9d399c6
> # Parent  7f305778ab05e60e58722d21e03e5140588a1438
> scripts: add support for building manuals

Woohoo! :-)

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

Yes, I never managed to build a bare-metal compiler out of the
final gcc build step, so I use the core gcc for this. Sigh...

> Dodgy: always try install the non-existant GOLD manual.  Should really
> check .config to see if GOLD is enabled.

Easy to fix, see below.

> diff -r 7f305778ab05 -r ae6b7b791db5 .hgignore
> --- a/.hgignore	Mon Nov 14 18:12:55 2011 +0100
> +++ b/.hgignore	Wed Nov 16 10:06:21 2011 +1300
> @@ -27,3 +27,4 @@
>  .build/
>  # .. and the legacy location
>  targets/
> +builds/
> \ No newline at end of file

Unrelated local change. Dropped.

> diff -r 7f305778ab05 -r ae6b7b791db5 config/global/paths.in
> --- a/config/global/paths.in	Mon Nov 14 18:12:55 2011 +0100
> +++ b/config/global/paths.in	Wed Nov 16 10:06:21 2011 +1300
> @@ -90,6 +90,14 @@
>        Remove the installed documentation (man and info pages).
>        Gains around 8MiB for a uClibc-based, C and C++ compiler.
>  
> +config BUILD_MANUALS
> +    bool
> +    prompt "Build the manuals"

depends on ! REMOVE_DOCS

> +    default n

"default n" is not needed. 'n' is the kconfig default anyway.

> +    help
> +      Build the PDF and HTML manuals for the main components such as
> +      binutils, GCC, GDB, and the C library.
> +
>  config INSTALL_DIR_RO
>      bool
>      prompt "Render the toolchain read-only"
> diff -r 7f305778ab05 -r ae6b7b791db5 scripts/build/binutils/binutils.sh
> --- a/scripts/build/binutils/binutils.sh	Mon Nov 14 18:12:55 2011 +0100
> +++ b/scripts/build/binutils/binutils.sh	Wed Nov 16 10:06:21 2011 +1300
> @@ -90,6 +90,12 @@
>      CT_DoLog EXTRA "Installing binutils"
>      CT_DoExecLog ALL make install
>  
> +    if [ "${CT_BUILD_MANUALS}" = "y" ]; then
> +        CT_DoLog EXTRA "Building and installing the binutils manuals"
> +        CT_DoExecLog ALL make ${JOBSFLAGS} pdf html
> +        CT_DoExecLog ALL make install-{pdf,html}-{gas,binutils,ld,gold,gprof}
> +    fi

he gold case is realtively easy to fix:

    local -a manuals
    manuals=( gas binutils ld gprof )
    if [ "${CT_BINUTILS_LINKER_GOLD}" ]; then
        manuals+=( gold )
    fi
    manuals=( "${manuals[@]/#/install-pdf-}" "${manuals[@]/#/install-html-}" )
    make "${manuals[@]"

This is a bash script, so we can use the full power of bash expansions...

Prety good, I will apply with that change (but tomorrow, it's 1am here)

Thank you!

Regards,
Yann E. MORIN.
Yann E. MORIN Nov. 16, 2011, 11:04 p.m. UTC | #2
Michael, All,

On Tuesday 15 November 2011 22:07:39 Michael Hope wrote:
> # HG changeset patch
> # User Michael Hope <michael.hope@linaro.org>
> # Date 1321391181 -46800
> # Branch add-manuals
> # Node ID ae6b7b791db59c66639a4eb0aa6dc172c9d399c6
> # Parent  7f305778ab05e60e58722d21e03e5140588a1438
> 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.

On my machine (Debian squeeze, amd64), the build freezes after some errors:

    make[3]: *** [doc/gccint.pdf] Error 1
    make[3]: *** [doc/cppinternals.pdf] Error 1
    make[3]: *** [doc/gccinstall.pdf] Error 1
    make[3]: *** [doc/cpp.pdf] Error 1

And then it freezes when doing the PDF for gcc... Attached the .config I
used as a test (the only one I tested with, so far), and the build log
for the manuals.

Regards,
Yann E. MORIN.
Michael Hope Nov. 16, 2011, 11:29 p.m. UTC | #3
On Thu, Nov 17, 2011 at 12:04 PM, Yann E. MORIN
<yann.morin.1998@anciens.enib.fr> wrote:
> Michael, All,
>
> On Tuesday 15 November 2011 22:07:39 Michael Hope wrote:
>> # HG changeset patch
>> # User Michael Hope <michael.hope@linaro.org>
>> # Date 1321391181 -46800
>> # Branch add-manuals
>> # Node ID ae6b7b791db59c66639a4eb0aa6dc172c9d399c6
>> # Parent  7f305778ab05e60e58722d21e03e5140588a1438
>> 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.
>
> On my machine (Debian squeeze, amd64), the build freezes after some errors:
>
>    make[3]: *** [doc/gccint.pdf] Error 1
>    make[3]: *** [doc/cppinternals.pdf] Error 1
>    make[3]: *** [doc/gccinstall.pdf] Error 1
>    make[3]: *** [doc/cpp.pdf] Error 1
>
> And then it freezes when doing the PDF for gcc... Attached the .config I
> used as a test (the only one I tested with, so far), and the build log
> for the manuals.

Out of interest, what is your pkgversion?  And does it have an @ in it?

@ is the texinfo command character and can wreck havoc if it's not escaped.

-- Michael
Yann E. MORIN Nov. 16, 2011, 11:50 p.m. UTC | #4
Michael, All,

On Thursday 17 November 2011 00:29:37 Michael Hope wrote:
> On Thu, Nov 17, 2011 at 12:04 PM, Yann E. MORIN
> <yann.morin.1998@anciens.enib.fr> wrote:
> > On my machine (Debian squeeze, amd64), the build freezes after some errors:
[--SNIP--]
> Out of interest, what is your pkgversion?  And does it have an @ in it?

Yes, it does.

> @ is the texinfo command character and can wreck havoc if it's not escaped.

Ah, this explains it, then.

Regards,
Yann E. MORIN.
Michael Hope Nov. 17, 2011, 12:02 a.m. UTC | #5
On Thu, Nov 17, 2011 at 12:50 PM, Yann E. MORIN
<yann.morin.1998@anciens.enib.fr> wrote:
> Michael, All,
>
> On Thursday 17 November 2011 00:29:37 Michael Hope wrote:
>> On Thu, Nov 17, 2011 at 12:04 PM, Yann E. MORIN
>> <yann.morin.1998@anciens.enib.fr> wrote:
>> > On my machine (Debian squeeze, amd64), the build freezes after some errors:
> [--SNIP--]
>> Out of interest, what is your pkgversion?  And does it have an @ in it?
>
> Yes, it does.
>
>> @ is the texinfo command character and can wreck havoc if it's not escaped.
>
> Ah, this explains it, then.

It's a tricky one to fix.  I sent a fix to EGLIBC a month ago, but
then found the same problem exists in binutils, gcc, and gdb and
pretty much anything else sourceware based. See:
 http://www.eglibc.org/archives/patches/msg01014.html

A work-around is to change the development hg pkgversion format to
something without an @.  I quite like the Debian style:
1.1.13+hg12345.

-- Michael
Yann E. MORIN Nov. 17, 2011, 12:13 a.m. UTC | #6
Michael, All,

On Thursday 17 November 2011 01:02:47 Michael Hope wrote:
> A work-around is to change the development hg pkgversion format to
> something without an @.  I quite like the Debian style:
> 1.1.13+hg12345.

Indeed, I like it too.

But the gdb manuals still fail to build...
More work for tomorrow...

Regards,
Yann E. MORIN.
diff mbox

Patch

diff -r 7f305778ab05 -r ae6b7b791db5 .hgignore
--- a/.hgignore	Mon Nov 14 18:12:55 2011 +0100
+++ b/.hgignore	Wed Nov 16 10:06:21 2011 +1300
@@ -27,3 +27,4 @@ 
 .build/
 # .. and the legacy location
 targets/
+builds/
\ No newline at end of file
diff -r 7f305778ab05 -r ae6b7b791db5 config/global/paths.in
--- a/config/global/paths.in	Mon Nov 14 18:12:55 2011 +0100
+++ b/config/global/paths.in	Wed Nov 16 10:06:21 2011 +1300
@@ -90,6 +90,14 @@ 
       Remove the installed documentation (man and info pages).
       Gains around 8MiB for a uClibc-based, C and C++ compiler.
 
+config BUILD_MANUALS
+    bool
+    prompt "Build the manuals"
+    default n
+    help
+      Build the PDF and HTML manuals for the main components such as
+      binutils, GCC, GDB, and the C library.
+
 config INSTALL_DIR_RO
     bool
     prompt "Render the toolchain read-only"
diff -r 7f305778ab05 -r ae6b7b791db5 scripts/build/binutils/binutils.sh
--- a/scripts/build/binutils/binutils.sh	Mon Nov 14 18:12:55 2011 +0100
+++ b/scripts/build/binutils/binutils.sh	Wed Nov 16 10:06:21 2011 +1300
@@ -90,6 +90,12 @@ 
     CT_DoLog EXTRA "Installing binutils"
     CT_DoExecLog ALL make install
 
+    if [ "${CT_BUILD_MANUALS}" = "y" ]; then
+        CT_DoLog EXTRA "Building and installing the binutils manuals"
+        CT_DoExecLog ALL make ${JOBSFLAGS} pdf html
+        CT_DoExecLog ALL make install-{pdf,html}-{gas,binutils,ld,gold,gprof}
+    fi
+
     # Install the wrapper if needed
     if [ "${CT_BINUTILS_LD_WRAPPER}" = "y" ]; then
         CT_DoLog EXTRA "Installing ld wrapper"
diff -r 7f305778ab05 -r ae6b7b791db5 scripts/build/cc/gcc.sh
--- a/scripts/build/cc/gcc.sh	Mon Nov 14 18:12:55 2011 +0100
+++ b/scripts/build/cc/gcc.sh	Wed Nov 16 10:06:21 2011 +1300
@@ -79,9 +79,9 @@ 
     case "${CT_BARE_METAL},${CT_CANADIAN},${CT_THREADS}" in
         y,*,*)
             if [ "${CT_STATIC_TOOLCHAIN}" = "y" ]; then
-                do_cc_core mode=baremetal build_libgcc=yes build_libstdcxx=yes build_staticlinked=yes
+                do_cc_core mode=baremetal build_libgcc=yes build_libstdcxx=yes build_staticlinked=yes build_manuals=yes
             else
-                do_cc_core mode=baremetal build_libgcc=yes build_libstdcxx=yes
+                do_cc_core mode=baremetal build_libgcc=yes build_libstdcxx=yes build_manuals=yes
             fi
             ;;
         ,y,*)   ;;
@@ -114,6 +114,7 @@ 
     local build_libgcc=no
     local build_libstdcxx=no
     local build_staticlinked=no
+    local build_manuals=no
     local core_prefix_dir
     local lang_opt
     local tmp
@@ -381,6 +382,12 @@ 
     CT_DoLog EXTRA "Installing ${mode} core C compiler"
     CT_DoExecLog ALL make ${JOBSFLAGS} "${core_targets[@]/#/install-}"
 
+    if [ "${CT_BUILD_MANUALS}" = "y" -a "${build_manuals}" = "yes" ]; then
+        CT_DoLog EXTRA "Building and installing the GCC manuals"
+        CT_DoExecLog ALL make ${JOBSFLAGS} pdf html
+        CT_DoExecLog ALL make install-{pdf,html}-gcc
+    fi
+
     # Create a symlink ${CT_TARGET}-cc to ${CT_TARGET}-gcc to always be able
     # to call the C compiler with the same, somewhat canonical name.
     # check whether compiler has an extension
@@ -625,6 +632,12 @@ 
     CT_DoLog EXTRA "Installing final compiler"
     CT_DoExecLog ALL make ${JOBSFLAGS} install
 
+    if [ "${CT_BUILD_MANUALS}" = "y" ]; then
+        CT_DoLog EXTRA "Building and installing the GCC manuals"
+        CT_DoExecLog ALL make ${JOBSFLAGS} pdf html
+        CT_DoExecLog ALL make install-{pdf,html}-gcc
+    fi
+
     # Create a symlink ${CT_TARGET}-cc to ${CT_TARGET}-gcc to always be able
     # to call the C compiler with the same, somewhat canonical name.
     # check whether compiler has an extension
diff -r 7f305778ab05 -r ae6b7b791db5 scripts/build/debug/300-gdb.sh
--- a/scripts/build/debug/300-gdb.sh	Mon Nov 14 18:12:55 2011 +0100
+++ b/scripts/build/debug/300-gdb.sh	Wed Nov 16 10:06:21 2011 +1300
@@ -155,6 +155,12 @@ 
         CT_DoLog EXTRA "Installing cross-gdb"
         CT_DoExecLog ALL make install
 
+        if [ "${CT_BUILD_MANUALS}" = "y" ]; then
+            CT_DoLog EXTRA "Building and installing the cross-GDB manuals"
+            CT_DoExecLog ALL make ${JOBSFLAGS} pdf html
+            CT_DoExecLog ALL make install-{pdf,html}-gdb
+        fi
+
         if [ "${CT_GDB_INSTALL_GDBINIT}" = "y" ]; then
             CT_DoLog EXTRA "Install '.gdbinit' template"
             # See in scripts/build/internals.sh for why we do this
diff -r 7f305778ab05 -r ae6b7b791db5 scripts/build/libc/glibc-eglibc.sh-common
--- a/scripts/build/libc/glibc-eglibc.sh-common	Mon Nov 14 18:12:55 2011 +0100
+++ b/scripts/build/libc/glibc-eglibc.sh-common	Wed Nov 16 10:06:21 2011 +1300
@@ -303,6 +303,18 @@ 
                               install_root="${CT_SYSROOT_DIR}"  \
                               install
 
+        if [ "${CT_BUILD_MANUALS}" = "y" ]; then
+            CT_DoLog EXTRA "Building and installing the C library manual"
+            # Omit JOBSFLAGS as GLIBC has problems building the
+            # manuals in parallel
+            CT_DoExecLog ALL make pdf html
+            # EGLIBC doesn't have a install-{pdf.html} and leaves the manuals
+            # in the source directory
+            CT_DoExecLog ALL mkdir -p ${CT_PREFIX_DIR}/share/doc
+            CT_DoExecLog ALL cp -av ${src_dir}/manual/*.pdf ${src_dir}/manual/libc \
+                ${CT_PREFIX_DIR}/share/doc
+        fi
+
         if [ "${CT_LIBC_LOCALES}" = "y" ]; then
             do_libc_locales
         fi