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