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