scripts/build/companion_libs/121-isl.sh
changeset 3216 bfad02f03c75
child 3230 86a8d1d467c8
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/scripts/build/companion_libs/121-isl.sh	Sat May 04 00:08:34 2013 +0200
     1.3 @@ -0,0 +1,128 @@
     1.4 +# This file adds the functions to build the ISL 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_isl_get() { :; }
     1.9 +do_isl_extract() { :; }
    1.10 +do_isl_for_build() { :; }
    1.11 +do_isl_for_host() { :; }
    1.12 +
    1.13 +# Overide functions depending on configuration
    1.14 +if [ "${CT_ISL}" = "y" ]; then
    1.15 +
    1.16 +# Download ISL
    1.17 +do_isl_get() {
    1.18 +    CT_GetFile "isl-${CT_ISL_VERSION}"  \
    1.19 +        ftp://ftp.linux.student.kuleuven.be/pub/people/skimo/isl/
    1.20 +}
    1.21 +
    1.22 +# Extract ISL
    1.23 +do_isl_extract() {
    1.24 +    CT_Extract "isl-${CT_ISL_VERSION}"
    1.25 +    CT_Patch "isl" "${CT_ISL_VERSION}"
    1.26 +}
    1.27 +
    1.28 +# Build ISL 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_isl_for_build() {
    1.33 +    local -a isl_opts
    1.34 +    local isl_cflags
    1.35 +    local isl_cxxflags
    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 ISL for build"
    1.42 +    CT_mkdir_pushd "${CT_BUILD_DIR}/build-isl-build-${CT_BUILD}"
    1.43 +
    1.44 +    isl_cflags="${CT_CFLAGS_FOR_BUILD}"
    1.45 +    isl_cxxflags="${CT_CFLAGS_FOR_BUILD}"
    1.46 +
    1.47 +    isl_opts+=( "host=${CT_BUILD}" )
    1.48 +    isl_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
    1.49 +    isl_opts+=( "cflags=${isl_cflags}" )
    1.50 +    isl_opts+=( "cxxflags=${isl_cxxflags}" )
    1.51 +    isl_opts+=( "ldflags=${CT_LDFLAGS_FOR_BUILD}" )
    1.52 +    do_isl_backend "${isl_opts[@]}"
    1.53 +
    1.54 +    CT_Popd
    1.55 +    CT_EndStep
    1.56 +}
    1.57 +
    1.58 +# Build ISL for running on host
    1.59 +do_isl_for_host() {
    1.60 +    local -a isl_opts
    1.61 +    local isl_cflags
    1.62 +    local isl_cxxflags
    1.63 +
    1.64 +    CT_DoStep INFO "Installing ISL for host"
    1.65 +    CT_mkdir_pushd "${CT_BUILD_DIR}/build-isl-host-${CT_HOST}"
    1.66 +
    1.67 +    isl_cflags="${CT_CFLAGS_FOR_HOST}"
    1.68 +    isl_cxxflags="${CT_CFLAGS_FOR_HOST}"
    1.69 +
    1.70 +    isl_opts+=( "host=${CT_HOST}" )
    1.71 +    isl_opts+=( "prefix=${CT_HOST_COMPLIBS_DIR}" )
    1.72 +    isl_opts+=( "cflags=${isl_cflags}" )
    1.73 +    isl_opts+=( "cxxflags=${isl_cxxflags}" )
    1.74 +    isl_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" )
    1.75 +    do_isl_backend "${isl_opts[@]}"
    1.76 +
    1.77 +    CT_Popd
    1.78 +    CT_EndStep
    1.79 +}
    1.80 +
    1.81 +# Build ISL
    1.82 +#     Parameter     : description               : type      : default
    1.83 +#     host          : machine to run on         : tuple     : (none)
    1.84 +#     prefix        : prefix to install into    : dir       : (none)
    1.85 +#     cflags        : cflags to use             : string    : (empty)
    1.86 +#     ldflags       : ldflags to use            : string    : (empty)
    1.87 +do_isl_backend() {
    1.88 +    local host
    1.89 +    local prefix
    1.90 +    local cflags
    1.91 +    local cxxflags
    1.92 +    local ldflags
    1.93 +    local arg
    1.94 +
    1.95 +    for arg in "$@"; do
    1.96 +        eval "${arg// /\\ }"
    1.97 +    done
    1.98 +
    1.99 +    CT_DoLog EXTRA "Configuring ISL"
   1.100 +
   1.101 +    CT_DoExecLog CFG                                \
   1.102 +    CFLAGS="${cflags}"                              \
   1.103 +    CXXFLAGS="${cxxflags}"                          \
   1.104 +    LDFLAGS="${ldflags}"                            \
   1.105 +    "${CT_SRC_DIR}/isl-${CT_ISL_VERSION}/configure" \
   1.106 +        --build=${CT_BUILD}                         \
   1.107 +        --host=${host}                              \
   1.108 +        --prefix="${prefix}"                        \
   1.109 +        --with-libgmp-prefix="${prefix}"            \
   1.110 +        --with-libgmpxx-prefix="${prefix}"          \
   1.111 +        --with-gmp-prefix="${prefix}"               \
   1.112 +        --disable-shared                            \
   1.113 +        --enable-static                             \
   1.114 +        --with-gmp=system                           \
   1.115 +        --with-gmp-prefix="${prefix}"               \
   1.116 +        --with-piplib=no                            \
   1.117 +        --with-clang=no
   1.118 +
   1.119 +    CT_DoLog EXTRA "Building ISL"
   1.120 +    CT_DoExecLog ALL make ${JOBSFLAGS}
   1.121 +
   1.122 +    if [ "${CT_COMPLIBS_CHECK}" = "y" ]; then
   1.123 +        CT_DoLog EXTRA "Checking ISL"
   1.124 +        CT_DoExecLog ALL make ${JOBSFLAGS} -s check
   1.125 +    fi
   1.126 +
   1.127 +    CT_DoLog EXTRA "Installing ISL"
   1.128 +    CT_DoExecLog ALL make install
   1.129 +}
   1.130 +
   1.131 +fi # CT_ISL