scripts/build/companion_libs/libelf.sh
author Remy Bohmer <linux@bohmer.net>
Thu May 27 23:18:19 2010 +0200 (2010-05-27)
changeset 2060 51e4597b07fc
parent 1917 7a489a7b5d55
child 2154 250cdcc86441
permissions -rw-r--r--
scripts: add option to strip all toolchain executables

To reduce filesizes of the toolchain and even improve build times
of projects to be build with this toolchain it is usefull to strip
the delivered toolchain executables. Since it is not likely that we
will debug the toolchain executables itself we do not need the
debug information inside the executables itself.

Signed-off-by: Remy Bohmer <linux@bohmer.net>
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
    local -a libelf_opts
yann@1918
    26
yann@1918
    27
    CT_DoStep INFO "Installing libelf"
yann@1918
    28
    mkdir -p "${CT_BUILD_DIR}/build-libelf"
yann@1918
    29
    CT_Pushd "${CT_BUILD_DIR}/build-libelf"
yann@1918
    30
yann@1918
    31
    CT_DoLog EXTRA "Configuring libelf"
yann@1918
    32
yann@1918
    33
    if [ "${CT_COMPLIBS_SHARED}" = "y" ]; then
yann@1918
    34
        libelf_opts+=( --enable-shared --disable-static )
yann@1918
    35
    else
yann@1918
    36
        libelf_opts+=( --disable-shared --enable-static )
yann@1918
    37
    fi
yann@1918
    38
yann@1918
    39
    CT_DoExecLog ALL                                        \
yann@1918
    40
    "${CT_SRC_DIR}/libelf-${CT_LIBELF_VERSION}/configure"   \
yann@1918
    41
        --build=${CT_BUILD}                                 \
yann@1918
    42
        --host=${CT_HOST}                                   \
yann@1918
    43
        --target=${CT_TARGET}                               \
yann@1918
    44
        --prefix="${CT_COMPLIBS_DIR}"                       \
yann@1918
    45
        --enable-compat                                     \
yann@1918
    46
        --enable-elf64                                      \
yann@1918
    47
        --enable-extended-format                            \
yann@1918
    48
        "${libelf_opts[@]}"
yann@1918
    49
yann@1918
    50
    CT_DoLog EXTRA "Building libelf"
yann@1918
    51
    CT_DoExecLog ALL make
yann@1918
    52
yann@1918
    53
    CT_DoLog EXTRA "Installing libelf"
yann@1918
    54
    CT_DoExecLog ALL make install
yann@1918
    55
yann@1918
    56
    CT_Popd
yann@1918
    57
    CT_EndStep
yann@1811
    58
}
yann@1811
    59
yann@1811
    60
fi # CT_LIBELF
yann@1811
    61
yann@1811
    62
if [ "${CT_LIBELF_TARGET}" = "y" ]; then
yann@1811
    63
yann@1811
    64
do_libelf_target() {
yann@1811
    65
    CT_DoStep INFO "Installing libelf for the target"
yann@1917
    66
    mkdir -p "${CT_BUILD_DIR}/build-libelf-for-target"
yann@1917
    67
    CT_Pushd "${CT_BUILD_DIR}/build-libelf-for-target"
yann@479
    68
yann@479
    69
    CT_DoLog EXTRA "Configuring libelf"
yann@479
    70
    CC="${CT_TARGET}-gcc"                                   \
yann@663
    71
    CT_DoExecLog ALL                                        \
yann@479
    72
    "${CT_SRC_DIR}/libelf-${CT_LIBELF_VERSION}/configure"   \
yann@479
    73
        --build=${CT_BUILD}                                 \
yann@479
    74
        --host=${CT_TARGET}                                 \
yann@479
    75
        --target=${CT_TARGET}                               \
yann@479
    76
        --prefix=/usr                                       \
yann@479
    77
        --enable-compat                                     \
yann@479
    78
        --enable-elf64                                      \
yann@479
    79
        --enable-shared                                     \
yann@479
    80
        --enable-extended-format                            \
yann@663
    81
        --enable-static
yann@479
    82
yann@479
    83
    CT_DoLog EXTRA "Building libelf"
yann@663
    84
    CT_DoExecLog ALL make
yann@479
    85
yann@479
    86
    CT_DoLog EXTRA "Installing libelf"
yann@663
    87
    CT_DoExecLog ALL make instroot="${CT_SYSROOT_DIR}" install
yann@479
    88
yann@479
    89
    CT_Popd
yann@479
    90
    CT_EndStep
yann@479
    91
}
yann@479
    92
yann@1811
    93
fi # CT_LIBELF_TARGET
yann@1811
    94
yann@1811
    95
fi # CT_LIBELF || CT_LIBELF_TARGET