scripts/build/companion_libs/libelf.sh
author Kalle Kankare <kalle.kankare@vincit.fi>
Fri Dec 03 12:36:44 2010 +0100 (2010-12-03)
changeset 2216 81b4c0efa46f
parent 2154 250cdcc86441
child 2242 c48aba92cbeb
permissions -rw-r--r--
complibs/libelf: use host compiler

It appears, that the configure scripts of libelf versions 0.8.13 and
0.8.12 do not honour the --host option. The compiler must be given as an
environment variable or the process will use the command "gcc" as the
compiler.

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