2010-02-17 22:41:17 +00:00
|
|
|
# Build script for libelf
|
|
|
|
|
|
|
|
do_libelf_get() { :; }
|
|
|
|
do_libelf_extract() { :; }
|
2011-07-24 21:53:14 +00:00
|
|
|
do_libelf_for_build() { :; }
|
2011-07-17 16:56:30 +00:00
|
|
|
do_libelf_for_host() { :; }
|
2012-01-03 17:39:11 +00:00
|
|
|
do_libelf_for_target() { :; }
|
2010-02-17 22:41:17 +00:00
|
|
|
|
|
|
|
if [ "${CT_LIBELF}" = "y" -o "${CT_LIBELF_TARGET}" = "y" ]; then
|
|
|
|
|
|
|
|
do_libelf_get() {
|
|
|
|
# The server hosting libelf will return an "HTTP 300 : Multiple Choices"
|
|
|
|
# error code if we try to download a file that does not exists there.
|
|
|
|
# So we have to request the file with an explicit extension.
|
|
|
|
CT_GetFile "libelf-${CT_LIBELF_VERSION}" .tar.gz http://www.mr511.de/software/
|
|
|
|
}
|
|
|
|
|
|
|
|
do_libelf_extract() {
|
|
|
|
CT_Extract "libelf-${CT_LIBELF_VERSION}"
|
2010-04-11 21:18:10 +00:00
|
|
|
CT_Patch "libelf" "${CT_LIBELF_VERSION}"
|
2010-02-17 22:41:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if [ "${CT_LIBELF}" = "y" ]; then
|
|
|
|
|
2011-07-24 21:53:14 +00:00
|
|
|
# Build libelf for running on build
|
|
|
|
# - always build statically
|
|
|
|
# - we do not have build-specific CFLAGS
|
|
|
|
# - install in build-tools prefix
|
|
|
|
do_libelf_for_build() {
|
|
|
|
local -a libelf_opts
|
|
|
|
|
|
|
|
case "${CT_TOOLCHAIN_TYPE}" in
|
|
|
|
native|cross) return 0;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
CT_DoStep INFO "Installing libelf for build"
|
|
|
|
CT_mkdir_pushd "${CT_BUILD_DIR}/build-libelf-build-${CT_BUILD}"
|
|
|
|
|
|
|
|
libelf_opts+=( "host=${CT_BUILD}" )
|
|
|
|
libelf_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
|
2012-11-16 14:25:57 +00:00
|
|
|
libelf_opts+=( "cflags=${CT_CFLAGS_FOR_BUILD}" )
|
|
|
|
libelf_opts+=( "ldflags=${CT_LDFLAGS_FOR_BUILD}" )
|
2011-07-24 21:53:14 +00:00
|
|
|
do_libelf_backend "${libelf_opts[@]}"
|
|
|
|
|
|
|
|
CT_Popd
|
|
|
|
CT_EndStep
|
|
|
|
}
|
|
|
|
|
2011-07-17 16:56:30 +00:00
|
|
|
# Build libelf for running on host
|
|
|
|
do_libelf_for_host() {
|
|
|
|
local -a libelf_opts
|
2010-04-15 20:42:06 +00:00
|
|
|
|
2011-07-17 16:56:30 +00:00
|
|
|
CT_DoStep INFO "Installing libelf for host"
|
|
|
|
CT_mkdir_pushd "${CT_BUILD_DIR}/build-libelf-host-${CT_HOST}"
|
2010-04-15 20:42:06 +00:00
|
|
|
|
2011-07-17 16:56:30 +00:00
|
|
|
libelf_opts+=( "host=${CT_HOST}" )
|
2011-07-25 17:04:17 +00:00
|
|
|
libelf_opts+=( "prefix=${CT_HOST_COMPLIBS_DIR}" )
|
2011-07-17 16:56:30 +00:00
|
|
|
libelf_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
|
2012-11-16 14:25:57 +00:00
|
|
|
libelf_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" )
|
2011-07-17 16:56:30 +00:00
|
|
|
do_libelf_backend "${libelf_opts[@]}"
|
2010-04-15 20:42:06 +00:00
|
|
|
|
|
|
|
CT_Popd
|
|
|
|
CT_EndStep
|
2010-02-17 22:41:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fi # CT_LIBELF
|
|
|
|
|
|
|
|
if [ "${CT_LIBELF_TARGET}" = "y" ]; then
|
|
|
|
|
2012-01-03 17:39:11 +00:00
|
|
|
do_libelf_for_target() {
|
2011-07-17 16:56:30 +00:00
|
|
|
local -a libelf_opts
|
|
|
|
|
2010-02-17 22:41:17 +00:00
|
|
|
CT_DoStep INFO "Installing libelf for the target"
|
2011-07-17 16:56:30 +00:00
|
|
|
CT_mkdir_pushd "${CT_BUILD_DIR}/build-libelf-target-${CT_TARGET}"
|
|
|
|
|
|
|
|
libelf_opts+=( "destdir=${CT_SYSROOT_DIR}" )
|
|
|
|
libelf_opts+=( "host=${CT_TARGET}" )
|
|
|
|
libelf_opts+=( "prefix=/usr" )
|
|
|
|
libelf_opts+=( "shared=y" )
|
|
|
|
do_libelf_backend "${libelf_opts[@]}"
|
|
|
|
|
|
|
|
CT_Popd
|
|
|
|
CT_EndStep
|
|
|
|
}
|
|
|
|
|
|
|
|
fi # CT_LIBELF_TARGET
|
|
|
|
|
|
|
|
# Build libelf
|
|
|
|
# Parameter : description : type : default
|
|
|
|
# destdir : out-of-tree install dir : string : /
|
|
|
|
# host : machine to run on : tuple : (none)
|
|
|
|
# prefix : prefix to install into : dir : (none)
|
2012-11-16 14:25:57 +00:00
|
|
|
# cflags : cflags to use : string : (empty)
|
|
|
|
# ldflags : ldflags to use : string : (empty)
|
2011-07-17 16:56:30 +00:00
|
|
|
# shared : also buils shared lib : bool : n
|
|
|
|
do_libelf_backend() {
|
|
|
|
local destdir="/"
|
|
|
|
local host
|
|
|
|
local prefix
|
|
|
|
local cflags
|
2012-11-16 14:25:57 +00:00
|
|
|
local ldflags
|
2011-07-17 16:56:30 +00:00
|
|
|
local shared
|
|
|
|
local -a extra_config
|
|
|
|
local arg
|
|
|
|
|
|
|
|
for arg in "$@"; do
|
|
|
|
eval "${arg// /\\ }"
|
|
|
|
done
|
2010-02-17 22:41:17 +00:00
|
|
|
|
|
|
|
CT_DoLog EXTRA "Configuring libelf"
|
2011-07-17 16:56:30 +00:00
|
|
|
|
|
|
|
if [ "${shared}" = "y" ]; then
|
|
|
|
extra_config+=( --enable-shared )
|
|
|
|
else
|
|
|
|
extra_config+=( --disable-shared )
|
|
|
|
fi
|
|
|
|
|
2011-03-20 00:08:22 +00:00
|
|
|
CT_DoExecLog CFG \
|
2011-07-17 16:56:30 +00:00
|
|
|
CC="${host}-gcc" \
|
|
|
|
RANLIB="${host}-ranlib" \
|
|
|
|
CFLAGS="${cflags} -fPIC" \
|
2012-11-16 14:25:57 +00:00
|
|
|
LDFLAGS="${ldflags}" \
|
2010-02-17 22:41:17 +00:00
|
|
|
"${CT_SRC_DIR}/libelf-${CT_LIBELF_VERSION}/configure" \
|
|
|
|
--build=${CT_BUILD} \
|
2011-07-17 16:56:30 +00:00
|
|
|
--host=${host} \
|
2010-02-17 22:41:17 +00:00
|
|
|
--target=${CT_TARGET} \
|
2011-07-17 16:56:30 +00:00
|
|
|
--prefix="${prefix}" \
|
2010-02-17 22:41:17 +00:00
|
|
|
--enable-compat \
|
|
|
|
--enable-elf64 \
|
|
|
|
--enable-extended-format \
|
2011-07-17 16:56:30 +00:00
|
|
|
--enable-static \
|
|
|
|
"${extra_config[@]}"
|
2010-02-17 22:41:17 +00:00
|
|
|
|
|
|
|
CT_DoLog EXTRA "Building libelf"
|
|
|
|
CT_DoExecLog ALL make
|
|
|
|
|
|
|
|
CT_DoLog EXTRA "Installing libelf"
|
2011-07-17 16:56:30 +00:00
|
|
|
CT_DoExecLog ALL make instroot="${destdir}" install
|
2010-02-17 22:41:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fi # CT_LIBELF || CT_LIBELF_TARGET
|