scripts/build/companion_libs/130-cloog.sh
author "Yann E. MORIN" <yann.morin.1998@free.fr>
Wed Jun 25 23:33:01 2014 +0200 (2014-06-25)
changeset 3325 069f43a215cc
parent 3119 1c56c03b7ed5
permissions -rw-r--r--
all: fix wildcard to work with make-4.x

In make-3.8x, the $(wildacrd) function would sort the entries,
while in make-4.x, it would just return the entries in any
unpredictable order [*]

Use the $(sort) function to get reproducible behaviour.

[*] Well, most probably the roder the entries appear when read
from readdir()

Reported-by: Andrew Ruder <andrew.ruder@elecsyscorp.com>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Tested-by: Andrew Ruder <andrew.ruder@elecsyscorp.com>
     1 # This file adds the functions to build the CLooG library
     2 # Copyright 2009 Yann E. MORIN
     3 # Licensed under the GPL v2. See COPYING in the root of this package
     4 
     5 do_cloog_get() { :; }
     6 do_cloog_extract() { :; }
     7 do_cloog_for_build() { :; }
     8 do_cloog_for_host() { :; }
     9 
    10 cloog_basename() {
    11     printf "cloog"
    12     if [ "${CT_PPL}" = "y" ]; then
    13         printf -- "-ppl"
    14     fi
    15 }
    16 cloog_basename_version() {
    17     cloog_basename
    18     printf -- "-${CT_CLOOG_VERSION}"
    19 }
    20 
    21 # Overide functions depending on configuration
    22 if [ "${CT_CLOOG}" = "y" ]; then
    23 
    24 # Download CLooG
    25 do_cloog_get() {
    26     CT_GetFile "$(cloog_basename_version)"          \
    27         http://www.bastoul.net/cloog/pages/download \
    28         ftp://gcc.gnu.org/pub/gcc/infrastructure
    29 }
    30 
    31 # Extract CLooG
    32 do_cloog_extract() {
    33     local _t
    34 
    35     # Version 0.15.3 has a dirname 'cloog-ppl' (with no version in it!)
    36     # while versions 0.15.4 onward do have the version in the dirname.
    37     # But, because the infrastructure properly creates the extracted
    38     # directories (with tar's --strip-components), we can live safely...
    39     CT_Extract "$(cloog_basename_version)"
    40     CT_Patch "$(cloog_basename)" "${CT_CLOOG_VERSION}"
    41 
    42     # Help the autostuff in case it thinks there are things to regenerate...
    43     CT_DoExecLog DEBUG mkdir -p "${CT_SRC_DIR}/$(cloog_basename_version)/m4"
    44 
    45     if [ "${CT_CLOOG_NEEDS_AUTORECONF}" = "y" ]; then
    46         CT_Pushd "${CT_SRC_DIR}/$(cloog_basename_version)"
    47         CT_DoExecLog CFG ./autogen.sh
    48         CT_Popd
    49     fi
    50 }
    51 
    52 # Build CLooG for running on build
    53 # - always build statically
    54 # - we do not have build-specific CFLAGS
    55 # - install in build-tools prefix
    56 do_cloog_for_build() {
    57     local -a cloog_opts
    58 
    59     case "${CT_TOOLCHAIN_TYPE}" in
    60         native|cross)   return 0;;
    61     esac
    62 
    63     CT_DoStep INFO "Installing CLooG for build"
    64     CT_mkdir_pushd "${CT_BUILD_DIR}/build-cloog-build-${CT_BUILD}"
    65 
    66     cloog_opts+=( "host=${CT_BUILD}" )
    67     cloog_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
    68     cloog_opts+=( "cflags=${CT_CFLAGS_FOR_BUILD}" )
    69     cloog_opts+=( "ldflags=${CT_LDFLAGS_FOR_BUILD}" )
    70     do_cloog_backend "${cloog_opts[@]}"
    71 
    72     CT_Popd
    73     CT_EndStep
    74 }
    75 
    76 # Build CLooG for running on host
    77 do_cloog_for_host() {
    78     local -a cloog_opts
    79 
    80     CT_DoStep INFO "Installing CLooG for host"
    81     CT_mkdir_pushd "${CT_BUILD_DIR}/build-cloog-host-${CT_HOST}"
    82 
    83     cloog_opts+=( "host=${CT_HOST}" )
    84     cloog_opts+=( "prefix=${CT_HOST_COMPLIBS_DIR}" )
    85     cloog_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
    86     cloog_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" )
    87     do_cloog_backend "${cloog_opts[@]}"
    88 
    89     CT_Popd
    90     CT_EndStep
    91 }
    92 
    93 # Build CLooG
    94 #     Parameter     : description               : type      : default
    95 #     host          : machine to run on         : tuple     : (none)
    96 #     prefix        : prefix to install into    : dir       : (none)
    97 #     cflags        : cflags to use             : string    : (empty)
    98 #     ldflags       : ldflags to use            : string    : (empty)
    99 do_cloog_backend() {
   100     local host
   101     local prefix
   102     local cflags
   103     local ldflags
   104     local cloog_src_dir="${CT_SRC_DIR}/$(cloog_basename_version)"
   105     local arg
   106     local -a cloog_opts
   107     local -a cloog_targets
   108     local -a cloog_install_targets
   109 
   110     for arg in "$@"; do
   111         eval "${arg// /\\ }"
   112     done
   113 
   114     if [ "${CT_CLOOG_0_18_or_later}" = y ]; then
   115             cloog_opts+=( --with-gmp=system --with-gmp-prefix="${prefix}" )
   116             cloog_opts+=( --with-isl=system --with-isl-prefix="${prefix}" )
   117             cloog_opts+=( --without-osl )
   118             cloog_targets=( all )
   119             cloog_install_targets=( install )
   120     else
   121             cloog_opts+=( --with-gmp="${prefix}" )
   122             cloog_opts+=( --with-ppl="${prefix}" )
   123             cloog_targets=( libcloog.la )
   124             cloog_install_targets=( install-libLTLIBRARIES install-pkgincludeHEADERS )
   125     fi
   126 
   127     CT_DoLog EXTRA "Configuring CLooG"
   128 
   129     CT_DoExecLog CFG                            \
   130     CFLAGS="${cflags}"                          \
   131     LDFLAGS="${ldflags}"                        \
   132     LIBS="-lm"                                  \
   133     "${cloog_src_dir}/configure"                \
   134         --build=${CT_BUILD}                     \
   135         --host=${host}                          \
   136         --prefix="${prefix}"                    \
   137         --with-bits=gmp                         \
   138         --with-host-libstdcxx='-lstdc++'        \
   139         --disable-shared                        \
   140         --enable-static                         \
   141         "${cloog_opts[@]}"
   142 
   143     CT_DoLog EXTRA "Building CLooG"
   144     CT_DoExecLog ALL make ${JOBSFLAGS} "${cloog_targets[@]}"
   145 
   146     if [ "${CT_COMPLIBS_CHECK}" = "y" ]; then
   147         CT_DoLog EXTRA "Checking CLooG"
   148         CT_DoExecLog ALL make ${JOBSFLAGS} -s check
   149     fi
   150 
   151     CT_DoLog EXTRA "Installing CLooG"
   152     CT_DoExecLog ALL make "${cloog_install_targets[@]}"
   153 }
   154 
   155 fi # CT_CLOOG