scripts/build/companion_libs/libelf.sh
author Anthony Foiani <anthony.foiani@gmail.com>
Fri Oct 22 22:02:57 2010 +0200 (2010-10-22)
changeset 2154 250cdcc86441
parent 1918 fb0e7cfd0394
child 2216 81b4c0efa46f
permissions -rw-r--r--
scripts: add "FILE" and "CFG" debug levels.

I ran into some minor difficulties looking through the build log for a
particular file: I wasn't interested in seeing it unpacked, but only
when it is built or installed. Adding these two levels allows me to
differentiate between those cases.

[Yann E. MORIN: Those are blind log levels, and are used only to search
in the build-log afterward.]

Signed-off-by: Anthony Foiani <anthony.foiani@gmail.com>
     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