scripts/build/companion_libs/libelf.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Mon Mar 29 00:15:32 2010 +0200 (2010-03-29)
changeset 1864 758d5137fe87
parent 1126 1ab3d2e08c8b
child 1892 af092b4bf65c
permissions -rw-r--r--
scripts/populate: optimise search loop

Curently, populate will iterate over all ELF (shared objects|executables)
to look for missing NEEDED DSOs, adding to the list at every iterations
of the search loop.

Instead of looking again at previously handled ELF files, recursively
resolve every ELf files.

Also, in case there are a whole lot of files (more than the shell can
accept as arguments list, or creating a command line longer than the
shell can cope with), use a temporary file with the list of files
to search for missing dependencies.
     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 # Uncomment when we need it for gcc-4.5
    25 # WARNING! This function is absolutely UNTESTED yet!
    26 do_libelf() {
    27     : # Remove this line!
    28 #    CT_DoStep INFO "Installing libelf"
    29 #    mkdir -p "${CT_BUILD_DIR}/build-libelf"
    30 #    CT_Pushd "${CT_BUILD_DIR}/build-libelf"
    31 #
    32 #    CT_DoLog EXTRA "Configuring libelf"
    33 #    CC="${CT_TARGET}-gcc"                                   \
    34 #    CT_DoExecLog ALL                                        \
    35 #    "${CT_SRC_DIR}/libelf-${CT_LIBELF_VERSION}/configure"   \
    36 #        --build=${CT_BUILD}                                 \
    37 #        --host=${CT_HOST}                                   \
    38 #        --target=${CT_TARGET}                               \
    39 #        --prefix="${CT_PREFIX_DIR}"                         \
    40 #        --enable-compat                                     \
    41 #        --enable-elf64                                      \
    42 #        --enable-static                                     \
    43 #        --enable-shared                                     \
    44 #        --enable-extended-format
    45 #
    46 #    CT_DoLog EXTRA "Building libelf"
    47 #    CT_DoExecLog ALL make
    48 #
    49 #    CT_DoLog EXTRA "Installing libelf"
    50 #    CT_DoExecLog ALL make instroot="${CT_SYSROOT_DIR}" install
    51 #
    52 #    CT_Popd
    53 #    CT_EndStep
    54 }
    55 
    56 fi # CT_LIBELF
    57 
    58 if [ "${CT_LIBELF_TARGET}" = "y" ]; then
    59 
    60 do_libelf_target() {
    61     CT_DoStep INFO "Installing libelf for the target"
    62     mkdir -p "${CT_BUILD_DIR}/build-libelf"
    63     CT_Pushd "${CT_BUILD_DIR}/build-libelf"
    64 
    65     CT_DoLog EXTRA "Configuring libelf"
    66     CC="${CT_TARGET}-gcc"                                   \
    67     CT_DoExecLog ALL                                        \
    68     "${CT_SRC_DIR}/libelf-${CT_LIBELF_VERSION}/configure"   \
    69         --build=${CT_BUILD}                                 \
    70         --host=${CT_TARGET}                                 \
    71         --target=${CT_TARGET}                               \
    72         --prefix=/usr                                       \
    73         --enable-compat                                     \
    74         --enable-elf64                                      \
    75         --enable-shared                                     \
    76         --enable-extended-format                            \
    77         --enable-static
    78 
    79     CT_DoLog EXTRA "Building libelf"
    80     CT_DoExecLog ALL make
    81 
    82     CT_DoLog EXTRA "Installing libelf"
    83     CT_DoExecLog ALL make instroot="${CT_SYSROOT_DIR}" install
    84 
    85     CT_Popd
    86     CT_EndStep
    87 }
    88 
    89 fi # CT_LIBELF_TARGET
    90 
    91 fi # CT_LIBELF || CT_LIBELF_TARGET