summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scripts/build/companion_libs/cloog.sh48
-rw-r--r--scripts/build/companion_libs/gmp.sh43
-rw-r--r--scripts/build/companion_libs/libelf.sh100
-rw-r--r--scripts/build/companion_libs/mpc.sh47
-rw-r--r--scripts/build/companion_libs/mpfr.sh46
-rw-r--r--scripts/build/companion_libs/ppl.sh54
-rw-r--r--steps.mk12
7 files changed, 241 insertions, 109 deletions
diff --git a/scripts/build/companion_libs/cloog.sh b/scripts/build/companion_libs/cloog.sh
index 2ee0e80..990ac4f 100644
--- a/scripts/build/companion_libs/cloog.sh
+++ b/scripts/build/companion_libs/cloog.sh
@@ -4,7 +4,7 @@
do_cloog_get() { :; }
do_cloog_extract() { :; }
-do_cloog() { :; }
+do_cloog_for_host() { :; }
# Overide functions depending on configuration
if [ "${CT_CLOOG}" = "y" ]; then
@@ -33,25 +33,49 @@ do_cloog_extract() {
fi
}
-do_cloog() {
- local cloog_src_dir="${CT_SRC_DIR}/cloog-ppl-${CT_CLOOG_VERSION}"
+# Build CLooG/PPL for running on host
+do_cloog_for_host() {
+ local -a cloog_opts
- mkdir -p "${CT_BUILD_DIR}/build-cloog-ppl"
- cd "${CT_BUILD_DIR}/build-cloog-ppl"
+ CT_DoStep INFO "Installing CLooG/PPL for host"
+ CT_mkdir_pushd "${CT_BUILD_DIR}/build-cloog-ppl-host-${CT_HOST}"
- CT_DoStep INFO "Installing CLooG/ppl"
+ cloog_opts+=( "host=${CT_HOST}" )
+ cloog_opts+=( "prefix=${CT_COMPLIBS_DIR}" )
+ cloog_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
+ do_cloog_backend "${cloog_opts[@]}"
+
+ CT_Popd
+ CT_EndStep
+}
+
+# Build ClooG/PPL
+# Parameter : description : type : default
+# host : machine to run on : tuple : (none)
+# prefix : prefix to install into : dir : (none)
+# cflags : host cflags to use : string : (empty)
+do_cloog_backend() {
+ local host
+ local prefix
+ local cflags
+ local cloog_src_dir="${CT_SRC_DIR}/cloog-ppl-${CT_CLOOG_VERSION}"
+ local arg
+
+ for arg in "$@"; do
+ eval "${arg// /\\ }"
+ done
CT_DoLog EXTRA "Configuring CLooG/ppl"
CT_DoExecLog CFG \
- CFLAGS="${CT_CFLAGS_FOR_HOST}" \
+ CFLAGS="${cflags}" \
LIBS="-lm" \
"${cloog_src_dir}/configure" \
--build=${CT_BUILD} \
- --host=${CT_HOST} \
- --prefix="${CT_COMPLIBS_DIR}" \
- --with-gmp="${CT_COMPLIBS_DIR}" \
- --with-ppl="${CT_COMPLIBS_DIR}" \
+ --host=${host} \
+ --prefix="${prefix}" \
+ --with-gmp="${prefix}" \
+ --with-ppl="${prefix}" \
--with-bits=gmp \
--with-host-libstdcxx='-lstdc++' \
--disable-shared \
@@ -67,8 +91,6 @@ do_cloog() {
CT_DoLog EXTRA "Installing CLooG/ppl"
CT_DoExecLog ALL make install-libLTLIBRARIES install-pkgincludeHEADERS
-
- CT_EndStep
}
fi # CT_CLOOG
diff --git a/scripts/build/companion_libs/gmp.sh b/scripts/build/companion_libs/gmp.sh
index b8601c5..a4b037d 100644
--- a/scripts/build/companion_libs/gmp.sh
+++ b/scripts/build/companion_libs/gmp.sh
@@ -4,7 +4,7 @@
do_gmp_get() { :; }
do_gmp_extract() { :; }
-do_gmp() { :; }
+do_gmp_for_host() { :; }
# Overide functions depending on configuration
if [ "${CT_GMP}" = "y" ]; then
@@ -20,20 +20,45 @@ do_gmp_extract() {
CT_Patch "gmp" "${CT_GMP_VERSION}"
}
-do_gmp() {
- mkdir -p "${CT_BUILD_DIR}/build-gmp"
- cd "${CT_BUILD_DIR}/build-gmp"
+# Build GMP for running on host
+do_gmp_for_host() {
+ local -a gmp_opts
- CT_DoStep INFO "Installing GMP"
+ CT_DoStep INFO "Installing GMP for host"
+ CT_mkdir_pushd "${CT_BUILD_DIR}/build-gmp-host-${CT_HOST}"
+
+ gmp_opts+=( "host=${CT_HOST}" )
+ gmp_opts+=( "prefix=${CT_COMPLIBS_DIR}" )
+ gmp_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
+ do_gmp_backend "${gmp_opts[@]}"
+
+ CT_Popd
+ CT_EndStep
+}
+
+# Build GMP
+# Parameter : description : type : default
+# host : machine to run on : tuple : (none)
+# prefix : prefix to install into : dir : (none)
+# cflags : host cflags to use : string : (empty)
+do_gmp_backend() {
+ local host
+ local prefix
+ local cflags
+ local arg
+
+ for arg in "$@"; do
+ eval "${arg// /\\ }"
+ done
CT_DoLog EXTRA "Configuring GMP"
CT_DoExecLog CFG \
- CFLAGS="${CT_CFLAGS_FOR_HOST} -fexceptions" \
+ CFLAGS="${cflags} -fexceptions" \
"${CT_SRC_DIR}/gmp-${CT_GMP_VERSION}/configure" \
--build=${CT_BUILD} \
- --host=${CT_HOST} \
- --prefix="${CT_COMPLIBS_DIR}" \
+ --host=${host} \
+ --prefix="${prefix}" \
--enable-fft \
--enable-mpbsd \
--enable-cxx \
@@ -50,8 +75,6 @@ do_gmp() {
CT_DoLog EXTRA "Installing GMP"
CT_DoExecLog ALL make install
-
- CT_EndStep
}
fi # CT_GMP
diff --git a/scripts/build/companion_libs/libelf.sh b/scripts/build/companion_libs/libelf.sh
index 8e56f48..3384575 100644
--- a/scripts/build/companion_libs/libelf.sh
+++ b/scripts/build/companion_libs/libelf.sh
@@ -2,7 +2,7 @@
do_libelf_get() { :; }
do_libelf_extract() { :; }
-do_libelf() { :; }
+do_libelf_for_host() { :; }
do_libelf_for_target() { :; }
if [ "${CT_LIBELF}" = "y" -o "${CT_LIBELF_TARGET}" = "y" ]; then
@@ -21,32 +21,17 @@ do_libelf_extract() {
if [ "${CT_LIBELF}" = "y" ]; then
-do_libelf() {
- CT_DoStep INFO "Installing libelf"
- mkdir -p "${CT_BUILD_DIR}/build-libelf"
- CT_Pushd "${CT_BUILD_DIR}/build-libelf"
+# Build libelf for running on host
+do_libelf_for_host() {
+ local -a libelf_opts
- CT_DoLog EXTRA "Configuring libelf"
+ CT_DoStep INFO "Installing libelf for host"
+ CT_mkdir_pushd "${CT_BUILD_DIR}/build-libelf-host-${CT_HOST}"
- CT_DoExecLog CFG \
- CC="${CT_HOST}-gcc" \
- CFLAGS="-fPIC" \
- "${CT_SRC_DIR}/libelf-${CT_LIBELF_VERSION}/configure" \
- --build=${CT_BUILD} \
- --host=${CT_HOST} \
- --target=${CT_TARGET} \
- --prefix="${CT_COMPLIBS_DIR}" \
- --enable-compat \
- --enable-elf64 \
- --enable-extended-format \
- --disable-shared \
- --enable-static
-
- CT_DoLog EXTRA "Building libelf"
- CT_DoExecLog ALL make
-
- CT_DoLog EXTRA "Installing libelf"
- CT_DoExecLog ALL make install
+ libelf_opts+=( "host=${CT_HOST}" )
+ libelf_opts+=( "prefix=${CT_COMPLIBS_DIR}" )
+ libelf_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
+ do_libelf_backend "${libelf_opts[@]}"
CT_Popd
CT_EndStep
@@ -57,36 +42,71 @@ fi # CT_LIBELF
if [ "${CT_LIBELF_TARGET}" = "y" ]; then
do_libelf_for_target() {
+ local -a libelf_opts
+
CT_DoStep INFO "Installing libelf for the target"
- mkdir -p "${CT_BUILD_DIR}/build-libelf-for-target"
- CT_Pushd "${CT_BUILD_DIR}/build-libelf-for-target"
+ 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)
+# cflags : host cflags to use : string : (empty)
+# shared : also buils shared lib : bool : n
+do_libelf_backend() {
+ local destdir="/"
+ local host
+ local prefix
+ local cflags
+ local shared
+ local -a extra_config
+ local arg
+
+ for arg in "$@"; do
+ eval "${arg// /\\ }"
+ done
CT_DoLog EXTRA "Configuring libelf"
+
+ if [ "${shared}" = "y" ]; then
+ extra_config+=( --enable-shared )
+ else
+ extra_config+=( --disable-shared )
+ fi
+
CT_DoExecLog CFG \
- CC="${CT_TARGET}-gcc" \
- CFLAGS="-fPIC" \
- RANLIB="${CT_TARGET}-ranlib" \
+ CC="${host}-gcc" \
+ RANLIB="${host}-ranlib" \
+ CFLAGS="${cflags} -fPIC" \
"${CT_SRC_DIR}/libelf-${CT_LIBELF_VERSION}/configure" \
--build=${CT_BUILD} \
- --host=${CT_TARGET} \
+ --host=${host} \
--target=${CT_TARGET} \
- --prefix=/usr \
+ --prefix="${prefix}" \
--enable-compat \
--enable-elf64 \
- --enable-shared \
--enable-extended-format \
- --enable-static
+ --enable-static \
+ "${extra_config[@]}"
CT_DoLog EXTRA "Building libelf"
CT_DoExecLog ALL make
CT_DoLog EXTRA "Installing libelf"
- CT_DoExecLog ALL make instroot="${CT_SYSROOT_DIR}" install
-
- CT_Popd
- CT_EndStep
+ CT_DoExecLog ALL make instroot="${destdir}" install
}
-fi # CT_LIBELF_TARGET
-
fi # CT_LIBELF || CT_LIBELF_TARGET
diff --git a/scripts/build/companion_libs/mpc.sh b/scripts/build/companion_libs/mpc.sh
index f8cc87b..3236576 100644
--- a/scripts/build/companion_libs/mpc.sh
+++ b/scripts/build/companion_libs/mpc.sh
@@ -4,7 +4,7 @@
do_mpc_get() { :; }
do_mpc_extract() { :; }
-do_mpc() { :; }
+do_mpc_for_host() { :; }
# Overide functions depending on configuration
if [ "${CT_MPC}" = "y" ]; then
@@ -21,22 +21,47 @@ do_mpc_extract() {
CT_Patch "mpc" "${CT_MPC_VERSION}"
}
-do_mpc() {
- mkdir -p "${CT_BUILD_DIR}/build-mpc"
- cd "${CT_BUILD_DIR}/build-mpc"
+# Build MPC for running on host
+do_mpc_for_host() {
+ local -a mpc_opts
- CT_DoStep INFO "Installing MPC"
+ CT_DoStep INFO "Installing MPC for host"
+ CT_mkdir_pushd "${CT_BUILD_DIR}/build-mpc-host-${CT_HOST}"
+
+ mpc_opts+=( "host=${CT_HOST}" )
+ mpc_opts+=( "prefix=${CT_COMPLIBS_DIR}" )
+ mpc_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
+ do_mpc_backend "${mpc_opts[@]}"
+
+ CT_Popd
+ CT_EndStep
+}
+
+# Build MPC
+# Parameter : description : type : default
+# host : machine to run on : tuple : (none)
+# prefix : prefix to install into : dir : (none)
+# cflags : host cflags to use : string : (empty)
+do_mpc_backend() {
+ local host
+ local prefix
+ local cflags
+ local arg
+
+ for arg in "$@"; do
+ eval "${arg// /\\ }"
+ done
CT_DoLog EXTRA "Configuring MPC"
CT_DoExecLog CFG \
- CFLAGS="${CT_CFLAGS_FOR_HOST}" \
+ CFLAGS="${cflags}" \
"${CT_SRC_DIR}/mpc-${CT_MPC_VERSION}/configure" \
--build=${CT_BUILD} \
- --host=${CT_HOST} \
- --prefix="${CT_COMPLIBS_DIR}" \
- --with-gmp="${CT_COMPLIBS_DIR}" \
- --with-mpfr="${CT_COMPLIBS_DIR}" \
+ --host=${host} \
+ --prefix="${prefix}" \
+ --with-gmp="${prefix}" \
+ --with-mpfr="${prefix}" \
--disable-shared \
--enable-static
@@ -50,8 +75,6 @@ do_mpc() {
CT_DoLog EXTRA "Installing MPC"
CT_DoExecLog ALL make install
-
- CT_EndStep
}
fi # CT_MPC
diff --git a/scripts/build/companion_libs/mpfr.sh b/scripts/build/companion_libs/mpfr.sh
index a91d5c3..25bd101 100644
--- a/scripts/build/companion_libs/mpfr.sh
+++ b/scripts/build/companion_libs/mpfr.sh
@@ -4,7 +4,7 @@
do_mpfr_get() { :; }
do_mpfr_extract() { :; }
-do_mpfr() { :; }
+do_mpfr_for_host() { :; }
# Overide function depending on configuration
if [ "${CT_MPFR}" = "y" ]; then
@@ -63,11 +63,36 @@ do_mpfr_extract() {
esac
}
-do_mpfr() {
- mkdir -p "${CT_BUILD_DIR}/build-mpfr"
- cd "${CT_BUILD_DIR}/build-mpfr"
+# Build MPFR for running on host
+do_mpfr_for_host() {
+ local -a mpfr_opts
- CT_DoStep INFO "Installing MPFR"
+ CT_DoStep INFO "Installing MPFR for host"
+ CT_mkdir_pushd "${CT_BUILD_DIR}/build-mpfr-host-${CT_HOST}"
+
+ mpfr_opts+=( "host=${CT_HOST}" )
+ mpfr_opts+=( "prefix=${CT_COMPLIBS_DIR}" )
+ mpfr_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
+ do_mpfr_backend "${mpfr_opts[@]}"
+
+ CT_Popd
+ CT_EndStep
+}
+
+# Build MPFR
+# Parameter : description : type : default
+# host : machine to run on : tuple : (none)
+# prefix : prefix to install into : dir : (none)
+# cflags : host cflags to use : string : (empty)
+do_mpfr_backend() {
+ local host
+ local prefix
+ local cflags
+ local arg
+
+ for arg in "$@"; do
+ eval "${arg// /\\ }"
+ done
# Under Cygwin, we can't build a thread-safe library
case "${CT_HOST}" in
@@ -77,16 +102,15 @@ do_mpfr() {
*) mpfr_opts+=( --enable-thread-safe );;
esac
-
CT_DoLog EXTRA "Configuring MPFR"
CT_DoExecLog CFG \
- CC="${CT_HOST}-gcc" \
+ CC="${host}-gcc" \
CFLAGS="${CT_CFLAGS_FOR_HOST}" \
"${CT_SRC_DIR}/mpfr-${CT_MPFR_VERSION}/configure" \
--build=${CT_BUILD} \
- --host=${CT_HOST} \
- --prefix="${CT_COMPLIBS_DIR}" \
- --with-gmp="${CT_COMPLIBS_DIR}" \
+ --host=${host} \
+ --prefix="${prefix}" \
+ --with-gmp="${prefix}" \
--disable-shared \
--enable-static
@@ -100,8 +124,6 @@ do_mpfr() {
CT_DoLog EXTRA "Installing MPFR"
CT_DoExecLog ALL make install
-
- CT_EndStep
}
fi # CT_MPFR
diff --git a/scripts/build/companion_libs/ppl.sh b/scripts/build/companion_libs/ppl.sh
index a70c54d..4b4ff8e 100644
--- a/scripts/build/companion_libs/ppl.sh
+++ b/scripts/build/companion_libs/ppl.sh
@@ -4,7 +4,7 @@
do_ppl_get() { :; }
do_ppl_extract() { :; }
-do_ppl() { :; }
+do_ppl_for_host() { :; }
# Overide functions depending on configuration
if [ "${CT_PPL}" = "y" ]; then
@@ -23,25 +23,49 @@ do_ppl_extract() {
CT_Patch "ppl" "${CT_PPL_VERSION}"
}
-do_ppl() {
- mkdir -p "${CT_BUILD_DIR}/build-ppl"
- cd "${CT_BUILD_DIR}/build-ppl"
+# Build PPL for running on host
+do_ppl_for_host() {
+ local -a ppl_opts
- CT_DoStep INFO "Installing PPL"
+ CT_DoStep INFO "Installing PPL for host"
+ CT_mkdir_pushd "${CT_BUILD_DIR}/build-ppl-host-${CT_HOST}"
- CT_DoLog EXTRA "Configuring PPL"
+ ppl_opts+=( "host=${CT_HOST}" )
+ ppl_opts+=( "prefix=${CT_COMPLIBS_DIR}" )
+ ppl_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
+ do_ppl_backend "${ppl_opts[@]}"
+
+ CT_Popd
+ CT_EndStep
+}
+# Build PPL
+# Parameter : description : type : default
+# host : machine to run on : tuple : (none)
+# prefix : prefix to install into : dir : (none)
+# cflags : host cflags to use : string : (empty)
+do_ppl_backend() {
+ local host
+ local prefix
+ local cflags
+ local arg
+
+ for arg in "$@"; do
+ eval "${arg// /\\ }"
+ done
+
+ CT_DoLog EXTRA "Configuring PPL"
CT_DoExecLog CFG \
- CFLAGS="${CT_CFLAGS_FOR_HOST}" \
- CXXFLAGS="${CT_CFLAGS_FOR_HOST}" \
+ CFLAGS="${cflags}" \
+ CXXFLAGS="${cflags}" \
"${CT_SRC_DIR}/ppl-${CT_PPL_VERSION}/configure" \
--build=${CT_BUILD} \
- --host=${CT_HOST} \
- --prefix="${CT_COMPLIBS_DIR}" \
- --with-libgmp-prefix="${CT_COMPLIBS_DIR}" \
- --with-libgmpxx-prefix="${CT_COMPLIBS_DIR}" \
- --with-gmp-prefix="${CT_COMPLIBS_DIR}" \
+ --host=${host} \
+ --prefix="${prefix}" \
+ --with-libgmp-prefix="${prefix}" \
+ --with-libgmpxx-prefix="${prefix}" \
+ --with-gmp-prefix="${prefix}" \
--enable-watchdog \
--disable-debugging \
--disable-assertions \
@@ -66,9 +90,7 @@ do_ppl() {
CT_DoExecLog ALL make install
# Remove spuriously installed file
- CT_DoExecLog ALL rm -f "${CT_PREFIX_DIR}/bin/ppl-config"
-
- CT_EndStep
+ CT_DoExecLog ALL rm -f "${prefix}/bin/ppl-config"
}
fi # CT_PPL
diff --git a/steps.mk b/steps.mk
index d419645..f58ea29 100644
--- a/steps.mk
+++ b/steps.mk
@@ -17,12 +17,12 @@ help-env::
# Please keep the last line with a '\' and keep the following empy line:
# it helps when diffing and merging.
CT_STEPS := libc_check_config \
- gmp \
- mpfr \
- ppl \
- cloog \
- mpc \
- libelf \
+ gmp_for_host \
+ mpfr_for_host \
+ ppl_for_host \
+ cloog_for_host \
+ mpc_for_host \
+ libelf_for_host \
binutils_for_host \
elf2flt_for_host \
sstrip_for_host \