scripts/build/companion_libs/libelf.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Tue Nov 16 17:49:15 2010 +0100 (2010-11-16)
changeset 2204 ea1c9143e1e3
parent 1918 fb0e7cfd0394
child 2216 81b4c0efa46f
permissions -rw-r--r--
scripts: call curl and wget in sequence

It can happen, in some circumpstances, than one can succeed where
the other would fail. Those cases involves convoluted enterprise
networks with proxies playing tricks.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
     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 CFG                                        \
    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