scripts/build/companion_libs/libelf.sh
changeset 3115 1c68438f44f7
parent 3114 8453ccdc5098
child 3116 f7a40ba0b651
     1.1 --- a/scripts/build/companion_libs/libelf.sh	Thu Nov 15 20:51:31 2012 +0100
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,135 +0,0 @@
     1.4 -# Build script for libelf
     1.5 -
     1.6 -do_libelf_get() { :; }
     1.7 -do_libelf_extract() { :; }
     1.8 -do_libelf_for_build() { :; }
     1.9 -do_libelf_for_host() { :; }
    1.10 -do_libelf_for_target() { :; }
    1.11 -
    1.12 -if [ "${CT_LIBELF}" = "y" -o "${CT_LIBELF_TARGET}" = "y" ]; then
    1.13 -
    1.14 -do_libelf_get() {
    1.15 -    # The server hosting libelf will return an "HTTP 300 : Multiple Choices"
    1.16 -    # error code if we try to download a file that does not exists there.
    1.17 -    # So we have to request the file with an explicit extension.
    1.18 -    CT_GetFile "libelf-${CT_LIBELF_VERSION}" .tar.gz http://www.mr511.de/software/
    1.19 -}
    1.20 -
    1.21 -do_libelf_extract() {
    1.22 -    CT_Extract "libelf-${CT_LIBELF_VERSION}"
    1.23 -    CT_Patch "libelf" "${CT_LIBELF_VERSION}"
    1.24 -}
    1.25 -
    1.26 -if [ "${CT_LIBELF}" = "y" ]; then
    1.27 -
    1.28 -# Build libelf for running on build
    1.29 -# - always build statically
    1.30 -# - we do not have build-specific CFLAGS
    1.31 -# - install in build-tools prefix
    1.32 -do_libelf_for_build() {
    1.33 -    local -a libelf_opts
    1.34 -
    1.35 -    case "${CT_TOOLCHAIN_TYPE}" in
    1.36 -        native|cross)   return 0;;
    1.37 -    esac
    1.38 -
    1.39 -    CT_DoStep INFO "Installing libelf for build"
    1.40 -    CT_mkdir_pushd "${CT_BUILD_DIR}/build-libelf-build-${CT_BUILD}"
    1.41 -
    1.42 -    libelf_opts+=( "host=${CT_BUILD}" )
    1.43 -    libelf_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
    1.44 -    do_libelf_backend "${libelf_opts[@]}"
    1.45 -
    1.46 -    CT_Popd
    1.47 -    CT_EndStep
    1.48 -}
    1.49 -
    1.50 -# Build libelf for running on host
    1.51 -do_libelf_for_host() {
    1.52 -    local -a libelf_opts
    1.53 -
    1.54 -    CT_DoStep INFO "Installing libelf for host"
    1.55 -    CT_mkdir_pushd "${CT_BUILD_DIR}/build-libelf-host-${CT_HOST}"
    1.56 -
    1.57 -    libelf_opts+=( "host=${CT_HOST}" )
    1.58 -    libelf_opts+=( "prefix=${CT_HOST_COMPLIBS_DIR}" )
    1.59 -    libelf_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
    1.60 -    do_libelf_backend "${libelf_opts[@]}"
    1.61 -
    1.62 -    CT_Popd
    1.63 -    CT_EndStep
    1.64 -}
    1.65 -
    1.66 -fi # CT_LIBELF
    1.67 -
    1.68 -if [ "${CT_LIBELF_TARGET}" = "y" ]; then
    1.69 -
    1.70 -do_libelf_for_target() {
    1.71 -    local -a libelf_opts
    1.72 -
    1.73 -    CT_DoStep INFO "Installing libelf for the target"
    1.74 -    CT_mkdir_pushd "${CT_BUILD_DIR}/build-libelf-target-${CT_TARGET}"
    1.75 -
    1.76 -    libelf_opts+=( "destdir=${CT_SYSROOT_DIR}" )
    1.77 -    libelf_opts+=( "host=${CT_TARGET}" )
    1.78 -    libelf_opts+=( "prefix=/usr" )
    1.79 -    libelf_opts+=( "shared=y" )
    1.80 -    do_libelf_backend "${libelf_opts[@]}"
    1.81 -
    1.82 -    CT_Popd
    1.83 -    CT_EndStep
    1.84 -}
    1.85 -
    1.86 -fi # CT_LIBELF_TARGET
    1.87 -
    1.88 -# Build libelf
    1.89 -#     Parameter     : description               : type      : default
    1.90 -#     destdir       : out-of-tree install dir   : string    : /
    1.91 -#     host          : machine to run on         : tuple     : (none)
    1.92 -#     prefix        : prefix to install into    : dir       : (none)
    1.93 -#     cflags        : host cflags to use        : string    : (empty)
    1.94 -#     shared        : also buils shared lib     : bool      : n
    1.95 -do_libelf_backend() {
    1.96 -    local destdir="/"
    1.97 -    local host
    1.98 -    local prefix
    1.99 -    local cflags
   1.100 -    local shared
   1.101 -    local -a extra_config
   1.102 -    local arg
   1.103 -
   1.104 -    for arg in "$@"; do
   1.105 -        eval "${arg// /\\ }"
   1.106 -    done
   1.107 -
   1.108 -    CT_DoLog EXTRA "Configuring libelf"
   1.109 -
   1.110 -    if [ "${shared}" = "y" ]; then
   1.111 -        extra_config+=( --enable-shared )
   1.112 -    else
   1.113 -        extra_config+=( --disable-shared )
   1.114 -    fi
   1.115 -
   1.116 -    CT_DoExecLog CFG                                        \
   1.117 -    CC="${host}-gcc"                                        \
   1.118 -    RANLIB="${host}-ranlib"                                 \
   1.119 -    CFLAGS="${cflags} -fPIC"                                \
   1.120 -    "${CT_SRC_DIR}/libelf-${CT_LIBELF_VERSION}/configure"   \
   1.121 -        --build=${CT_BUILD}                                 \
   1.122 -        --host=${host}                                      \
   1.123 -        --target=${CT_TARGET}                               \
   1.124 -        --prefix="${prefix}"                                \
   1.125 -        --enable-compat                                     \
   1.126 -        --enable-elf64                                      \
   1.127 -        --enable-extended-format                            \
   1.128 -        --enable-static                                     \
   1.129 -        "${extra_config[@]}"
   1.130 -
   1.131 -    CT_DoLog EXTRA "Building libelf"
   1.132 -    CT_DoExecLog ALL make
   1.133 -
   1.134 -    CT_DoLog EXTRA "Installing libelf"
   1.135 -    CT_DoExecLog ALL make instroot="${destdir}" install
   1.136 -}
   1.137 -
   1.138 -fi # CT_LIBELF || CT_LIBELF_TARGET