scripts/build/companion_libs/libelf.sh
author Anthony Foiani <anthony.foiani@gmail.com>
Thu May 19 23:06:16 2011 +0200 (2011-05-19)
changeset 2461 ec30b191f0e3
parent 2351 3b726874fdbc
child 2624 e4a6fefcb0f5
permissions -rw-r--r--
complibs/ppl: build only C and C++ interfaces for PPL

By default, PPL wants to build interfaces for any of a variety of
langauges it finds on the local host (python, java, possibly perl, also
more esoteric languages such as ocaml and prolog).

These extra interfaces can double the compile time for the library. For
single-process builds, I found a savings of more than 40%:

default / j1: 716s total, 143.2s avg, 0.52s stdev
just_c / j1: 406s total, 81.2s avg, 0.33s stdev
just_c_cpp / j1: 413s total, 82.6s avg, 0.22s stdev

And for multi-process builds, it approached 50%:

default / j4: 625s total, 125.0s avg, 0.57s stdev
just_c / j4: 338s total, 67.6s avg, 1.25s stdev
just_c_cpp / j4: 327s total, 65.4s avg, 0.36s stdev

Since the PPL we build within ct-ng is only used by GCC, we only need to
build the C and C++ interfaces.

Signed-Off-By: Anthony Foiani <anthony.foiani@gmail.com>
     1 # Build script for libelf
     2 
     3 do_libelf_get() { :; }
     4 do_libelf_extract() { :; }
     5 do_libelf() { :; }
     6 do_libelf_target() { :; }
     7 
     8 if [ "${CT_LIBELF}" = "y" -o "${CT_LIBELF_TARGET}" = "y" ]; then
     9 
    10 do_libelf_get() {
    11     # The server hosting libelf will return an "HTTP 300 : Multiple Choices"
    12     # error code if we try to download a file that does not exists there.
    13     # So we have to request the file with an explicit extension.
    14     CT_GetFile "libelf-${CT_LIBELF_VERSION}" .tar.gz http://www.mr511.de/software/
    15 }
    16 
    17 do_libelf_extract() {
    18     CT_Extract "libelf-${CT_LIBELF_VERSION}"
    19     CT_Patch "libelf" "${CT_LIBELF_VERSION}"
    20 }
    21 
    22 if [ "${CT_LIBELF}" = "y" ]; then
    23 
    24 do_libelf() {
    25     CT_DoStep INFO "Installing libelf"
    26     mkdir -p "${CT_BUILD_DIR}/build-libelf"
    27     CT_Pushd "${CT_BUILD_DIR}/build-libelf"
    28 
    29     CT_DoLog EXTRA "Configuring libelf"
    30 
    31     CT_DoExecLog CFG                                        \
    32     CC="${CT_HOST}-gcc"                                     \
    33     CFLAGS="-fPIC"                                          \
    34     "${CT_SRC_DIR}/libelf-${CT_LIBELF_VERSION}/configure"   \
    35         --build=${CT_BUILD}                                 \
    36         --host=${CT_HOST}                                   \
    37         --target=${CT_TARGET}                               \
    38         --prefix="${CT_COMPLIBS_DIR}"                       \
    39         --enable-compat                                     \
    40         --enable-elf64                                      \
    41         --enable-extended-format                            \
    42         --disable-shared                                    \
    43         --enable-static
    44 
    45     CT_DoLog EXTRA "Building libelf"
    46     CT_DoExecLog ALL make
    47 
    48     CT_DoLog EXTRA "Installing libelf"
    49     CT_DoExecLog ALL make install
    50 
    51     CT_Popd
    52     CT_EndStep
    53 }
    54 
    55 fi # CT_LIBELF
    56 
    57 if [ "${CT_LIBELF_TARGET}" = "y" ]; then
    58 
    59 do_libelf_target() {
    60     CT_DoStep INFO "Installing libelf for the target"
    61     mkdir -p "${CT_BUILD_DIR}/build-libelf-for-target"
    62     CT_Pushd "${CT_BUILD_DIR}/build-libelf-for-target"
    63 
    64     CT_DoLog EXTRA "Configuring libelf"
    65     CT_DoExecLog CFG                                        \
    66     CC="${CT_TARGET}-gcc"                                   \
    67     CFLAGS="-fPIC"                                          \
    68     "${CT_SRC_DIR}/libelf-${CT_LIBELF_VERSION}/configure"   \
    69         --build=${CT_BUILD}                                 \
    70         --host=${CT_TARGET}                                 \
    71         --target=${CT_TARGET}                               \
    72         --prefix=/usr                                       \
    73         --enable-compat                                     \
    74         --enable-elf64                                      \
    75         --enable-shared                                     \
    76         --enable-extended-format                            \
    77         --enable-static
    78 
    79     CT_DoLog EXTRA "Building libelf"
    80     CT_DoExecLog ALL make
    81 
    82     CT_DoLog EXTRA "Installing libelf"
    83     CT_DoExecLog ALL make instroot="${CT_SYSROOT_DIR}" install
    84 
    85     CT_Popd
    86     CT_EndStep
    87 }
    88 
    89 fi # CT_LIBELF_TARGET
    90 
    91 fi # CT_LIBELF || CT_LIBELF_TARGET