scripts/build/companion_libs/cloog.sh
author "Yann E. MORIN" <yann.morin.1998@free.fr>
Tue Jul 31 22:27:29 2012 +0200 (2012-07-31)
changeset 3018 7776e8369284
parent 2931 8a72662f0815
permissions -rw-r--r--
complibs/cloog: create missing m4 dir

Because we now patch configure.in and configure, the Makefile quicks
in a re-build rule as the source files are now more recent than the
bundled generated files, and that fails because the m4 directory
is missing, although on some systems where aclocal is not installed,
the re-build rule does nothing (except a warning).

Always create tht directory.

Reported-by: Per Arnold Blaasmo <per-arnold.blaasmo@atmel.com>
[Also thanks to Thomas De Schampheleire <patrickdepinguin@gmail.com>
for some digging works on this issue]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
     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 # Overide functions depending on configuration
    11 if [ "${CT_CLOOG}" = "y" ]; then
    12 
    13 # Download CLooG
    14 do_cloog_get() {
    15     CT_GetFile "cloog-ppl-${CT_CLOOG_VERSION}"  \
    16         ftp://gcc.gnu.org/pub/gcc/infrastructure
    17 }
    18 
    19 # Extract CLooG
    20 do_cloog_extract() {
    21     local _t
    22 
    23     # Version 0.15.3 has a dirname 'cloog-ppl' (with no version in it!)
    24     # while versions 0.15.4 onward do have the version in the dirname.
    25     # But, because the infrastructure properly creates the extracted
    26     # directories (with tar's --strip-components), we can live safely...
    27     CT_Extract "cloog-ppl-${CT_CLOOG_VERSION}"
    28     CT_Patch "cloog-ppl" "${CT_CLOOG_VERSION}"
    29 
    30     # Help the autostuff in case it thinks there are things to regenerate...
    31     CT_DoExecLog DEBUG mkdir -p "${CT_SRC_DIR}/cloog-ppl-${CT_CLOOG_VERSION}/m4"
    32 
    33     if [ "${CT_CLOOG_NEEDS_AUTORECONF}" = "y" ]; then
    34         CT_Pushd "${CT_SRC_DIR}/cloog-ppl-${CT_CLOOG_VERSION}"
    35         CT_DoExecLog CFG ./autogen.sh
    36         CT_Popd
    37     fi
    38 }
    39 
    40 # Build CLooG/PPL for running on build
    41 # - always build statically
    42 # - we do not have build-specific CFLAGS
    43 # - install in build-tools prefix
    44 do_cloog_for_build() {
    45     local -a cloog_opts
    46 
    47     case "${CT_TOOLCHAIN_TYPE}" in
    48         native|cross)   return 0;;
    49     esac
    50 
    51     CT_DoStep INFO "Installing CLooG/PPL for build"
    52     CT_mkdir_pushd "${CT_BUILD_DIR}/build-cloog-ppl-build-${CT_BUILD}"
    53 
    54     cloog_opts+=( "host=${CT_BUILD}" )
    55     cloog_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
    56     do_cloog_backend "${cloog_opts[@]}"
    57 
    58     CT_Popd
    59     CT_EndStep
    60 }
    61 
    62 # Build CLooG/PPL for running on host
    63 do_cloog_for_host() {
    64     local -a cloog_opts
    65 
    66     CT_DoStep INFO "Installing CLooG/PPL for host"
    67     CT_mkdir_pushd "${CT_BUILD_DIR}/build-cloog-ppl-host-${CT_HOST}"
    68 
    69     cloog_opts+=( "host=${CT_HOST}" )
    70     cloog_opts+=( "prefix=${CT_HOST_COMPLIBS_DIR}" )
    71     cloog_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
    72     do_cloog_backend "${cloog_opts[@]}"
    73 
    74     CT_Popd
    75     CT_EndStep
    76 }
    77 
    78 # Build ClooG/PPL
    79 #     Parameter     : description               : type      : default
    80 #     host          : machine to run on         : tuple     : (none)
    81 #     prefix        : prefix to install into    : dir       : (none)
    82 #     cflags        : host cflags to use        : string    : (empty)
    83 do_cloog_backend() {
    84     local host
    85     local prefix
    86     local cflags
    87     local cloog_src_dir="${CT_SRC_DIR}/cloog-ppl-${CT_CLOOG_VERSION}"
    88     local arg
    89 
    90     for arg in "$@"; do
    91         eval "${arg// /\\ }"
    92     done
    93 
    94     CT_DoLog EXTRA "Configuring CLooG/ppl"
    95 
    96     CT_DoExecLog CFG                            \
    97     CFLAGS="${cflags}"                          \
    98     LIBS="-lm"                                  \
    99     "${cloog_src_dir}/configure"                \
   100         --build=${CT_BUILD}                     \
   101         --host=${host}                          \
   102         --prefix="${prefix}"                    \
   103         --with-gmp="${prefix}"                  \
   104         --with-ppl="${prefix}"                  \
   105         --with-bits=gmp                         \
   106         --with-host-libstdcxx='-lstdc++'        \
   107         --disable-shared                        \
   108         --enable-static
   109 
   110     CT_DoLog EXTRA "Building CLooG/ppl"
   111     CT_DoExecLog ALL make ${JOBSFLAGS} libcloog.la
   112 
   113     if [ "${CT_COMPLIBS_CHECK}" = "y" ]; then
   114         CT_DoLog EXTRA "Checking CLooG/ppl"
   115         CT_DoExecLog ALL make ${JOBSFLAGS} -s check
   116     fi
   117 
   118     CT_DoLog EXTRA "Installing CLooG/ppl"
   119     CT_DoExecLog ALL make install-libLTLIBRARIES install-pkgincludeHEADERS
   120 }
   121 
   122 fi # CT_CLOOG