1 # Build script for libelf
4 do_libelf_extract() { :; }
5 do_libelf_for_host() { :; }
6 do_libelf_for_target() { :; }
8 if [ "${CT_LIBELF}" = "y" -o "${CT_LIBELF_TARGET}" = "y" ]; then
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/
18 CT_Extract "libelf-${CT_LIBELF_VERSION}"
19 CT_Patch "libelf" "${CT_LIBELF_VERSION}"
22 if [ "${CT_LIBELF}" = "y" ]; then
24 # Build libelf for running on host
25 do_libelf_for_host() {
28 CT_DoStep INFO "Installing libelf for host"
29 CT_mkdir_pushd "${CT_BUILD_DIR}/build-libelf-host-${CT_HOST}"
31 libelf_opts+=( "host=${CT_HOST}" )
32 libelf_opts+=( "prefix=${CT_COMPLIBS_DIR}" )
33 libelf_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
34 do_libelf_backend "${libelf_opts[@]}"
42 if [ "${CT_LIBELF_TARGET}" = "y" ]; then
44 do_libelf_for_target() {
47 CT_DoStep INFO "Installing libelf for the target"
48 CT_mkdir_pushd "${CT_BUILD_DIR}/build-libelf-target-${CT_TARGET}"
50 libelf_opts+=( "destdir=${CT_SYSROOT_DIR}" )
51 libelf_opts+=( "host=${CT_TARGET}" )
52 libelf_opts+=( "prefix=/usr" )
53 libelf_opts+=( "shared=y" )
54 do_libelf_backend "${libelf_opts[@]}"
63 # Parameter : description : type : default
64 # destdir : out-of-tree install dir : string : /
65 # host : machine to run on : tuple : (none)
66 # prefix : prefix to install into : dir : (none)
67 # cflags : host cflags to use : string : (empty)
68 # shared : also buils shared lib : bool : n
82 CT_DoLog EXTRA "Configuring libelf"
84 if [ "${shared}" = "y" ]; then
85 extra_config+=( --enable-shared )
87 extra_config+=( --disable-shared )
92 RANLIB="${host}-ranlib" \
93 CFLAGS="${cflags} -fPIC" \
94 "${CT_SRC_DIR}/libelf-${CT_LIBELF_VERSION}/configure" \
97 --target=${CT_TARGET} \
98 --prefix="${prefix}" \
101 --enable-extended-format \
105 CT_DoLog EXTRA "Building libelf"
106 CT_DoExecLog ALL make
108 CT_DoLog EXTRA "Installing libelf"
109 CT_DoExecLog ALL make instroot="${destdir}" install
112 fi # CT_LIBELF || CT_LIBELF_TARGET