1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/scripts/build/companion_libs/120-ppl.sh Fri Nov 16 14:59:27 2012 +0100
1.3 @@ -0,0 +1,119 @@
1.4 +# This file adds the functions to build the PPL library
1.5 +# Copyright 2009 Yann E. MORIN
1.6 +# Licensed under the GPL v2. See COPYING in the root of this package
1.7 +
1.8 +do_ppl_get() { :; }
1.9 +do_ppl_extract() { :; }
1.10 +do_ppl_for_build() { :; }
1.11 +do_ppl_for_host() { :; }
1.12 +
1.13 +# Overide functions depending on configuration
1.14 +if [ "${CT_PPL}" = "y" ]; then
1.15 +
1.16 +# Download PPL
1.17 +do_ppl_get() {
1.18 + CT_GetFile "ppl-${CT_PPL_VERSION}" \
1.19 + http://www.cs.unipr.it/ppl/Download/ftp/releases/${CT_PPL_VERSION} \
1.20 + ftp://ftp.cs.unipr.it/pub/ppl/releases/${CT_PPL_VERSION} \
1.21 + ftp://gcc.gnu.org/pub/gcc/infrastructure
1.22 +}
1.23 +
1.24 +# Extract PPL
1.25 +do_ppl_extract() {
1.26 + CT_Extract "ppl-${CT_PPL_VERSION}"
1.27 + CT_Patch "ppl" "${CT_PPL_VERSION}"
1.28 +}
1.29 +
1.30 +# Build PPL for running on build
1.31 +# - always build statically
1.32 +# - we do not have build-specific CFLAGS
1.33 +# - install in build-tools prefix
1.34 +do_ppl_for_build() {
1.35 + local -a ppl_opts
1.36 +
1.37 + case "${CT_TOOLCHAIN_TYPE}" in
1.38 + native|cross) return 0;;
1.39 + esac
1.40 +
1.41 + CT_DoStep INFO "Installing PPL for build"
1.42 + CT_mkdir_pushd "${CT_BUILD_DIR}/build-ppl-build-${CT_BUILD}"
1.43 +
1.44 + ppl_opts+=( "host=${CT_BUILD}" )
1.45 + ppl_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
1.46 + do_ppl_backend "${ppl_opts[@]}"
1.47 +
1.48 + CT_Popd
1.49 + CT_EndStep
1.50 +}
1.51 +
1.52 +# Build PPL for running on host
1.53 +do_ppl_for_host() {
1.54 + local -a ppl_opts
1.55 +
1.56 + CT_DoStep INFO "Installing PPL for host"
1.57 + CT_mkdir_pushd "${CT_BUILD_DIR}/build-ppl-host-${CT_HOST}"
1.58 +
1.59 + ppl_opts+=( "host=${CT_HOST}" )
1.60 + ppl_opts+=( "prefix=${CT_HOST_COMPLIBS_DIR}" )
1.61 + ppl_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
1.62 + do_ppl_backend "${ppl_opts[@]}"
1.63 +
1.64 + CT_Popd
1.65 + CT_EndStep
1.66 +}
1.67 +
1.68 +# Build PPL
1.69 +# Parameter : description : type : default
1.70 +# host : machine to run on : tuple : (none)
1.71 +# prefix : prefix to install into : dir : (none)
1.72 +# cflags : host cflags to use : string : (empty)
1.73 +do_ppl_backend() {
1.74 + local host
1.75 + local prefix
1.76 + local cflags
1.77 + local arg
1.78 +
1.79 + for arg in "$@"; do
1.80 + eval "${arg// /\\ }"
1.81 + done
1.82 +
1.83 + CT_DoLog EXTRA "Configuring PPL"
1.84 +
1.85 + CT_DoExecLog CFG \
1.86 + CFLAGS="${cflags}" \
1.87 + CXXFLAGS="${cflags}" \
1.88 + "${CT_SRC_DIR}/ppl-${CT_PPL_VERSION}/configure" \
1.89 + --build=${CT_BUILD} \
1.90 + --host=${host} \
1.91 + --prefix="${prefix}" \
1.92 + --with-libgmp-prefix="${prefix}" \
1.93 + --with-libgmpxx-prefix="${prefix}" \
1.94 + --with-gmp-prefix="${prefix}" \
1.95 + --enable-watchdog \
1.96 + --disable-debugging \
1.97 + --disable-assertions \
1.98 + --disable-ppl_lcdd \
1.99 + --disable-ppl_lpsol \
1.100 + --disable-shared \
1.101 + --enable-interfaces='c c++' \
1.102 + --enable-static
1.103 +
1.104 + # Maybe-options:
1.105 + # --enable-optimization=speed or sspeed (yes, with 2 's')
1.106 +
1.107 + CT_DoLog EXTRA "Building PPL"
1.108 + CT_DoExecLog ALL make ${JOBSFLAGS}
1.109 +
1.110 + if [ "${CT_COMPLIBS_CHECK}" = "y" ]; then
1.111 + CT_DoLog EXTRA "Checking PPL"
1.112 + CT_DoExecLog ALL make ${JOBSFLAGS} -s check
1.113 + fi
1.114 +
1.115 + CT_DoLog EXTRA "Installing PPL"
1.116 + CT_DoExecLog ALL make install
1.117 +
1.118 + # Remove spuriously installed file
1.119 + CT_DoExecLog ALL rm -f "${prefix}/bin/ppl-config"
1.120 +}
1.121 +
1.122 +fi # CT_PPL