scripts/build/companion_libs/libelf.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Mon Mar 28 01:05:18 2011 +0200 (2011-03-28)
changeset 2362 0888065f8c4d
parent 2332 cc0587459152
child 2381 0ca0f85a4b2a
permissions -rw-r--r--
cc/gcc: cleanup the _or_later logic

So far, we've had a version always select appropriate _or_later option,
which in turn would select all previous _or_later options.

Because the dependencies on companion libs were cumulative, that was
working OK. But the upcoming 4.6 will no longer depend on libelf, so
we can't keep the cumulative scheme we've been using so far.

Have each release family select the corresponding dependencies, instead
of relying on selecting previous _or_later.

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