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
6 do_cloog_extract() { :; }
7 do_cloog_for_build() { :; }
8 do_cloog_for_host() { :; }
12 if [ "${CT_PPL}" = "y" ]; then
16 cloog_basename_version() {
18 printf -- "-${CT_CLOOG_VERSION}"
21 # Overide functions depending on configuration
22 if [ "${CT_CLOOG}" = "y" ]; then
26 CT_GetFile "$(cloog_basename_version)" \
27 http://www.bastoul.net/cloog/pages/download \
28 ftp://gcc.gnu.org/pub/gcc/infrastructure
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}"
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"
45 if [ "${CT_CLOOG_NEEDS_AUTORECONF}" = "y" ]; then
46 CT_Pushd "${CT_SRC_DIR}/$(cloog_basename_version)"
47 CT_DoExecLog CFG ./autogen.sh
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() {
59 case "${CT_TOOLCHAIN_TYPE}" in
60 native|cross) return 0;;
63 CT_DoStep INFO "Installing CLooG for build"
64 CT_mkdir_pushd "${CT_BUILD_DIR}/build-cloog-build-${CT_BUILD}"
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[@]}"
76 # Build CLooG for running on host
80 CT_DoStep INFO "Installing CLooG for host"
81 CT_mkdir_pushd "${CT_BUILD_DIR}/build-cloog-host-${CT_HOST}"
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[@]}"
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)
104 local cloog_src_dir="${CT_SRC_DIR}/$(cloog_basename_version)"
107 local -a cloog_targets
108 local -a cloog_install_targets
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 )
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 )
127 CT_DoLog EXTRA "Configuring CLooG"
131 LDFLAGS="${ldflags}" \
133 "${cloog_src_dir}/configure" \
134 --build=${CT_BUILD} \
136 --prefix="${prefix}" \
138 --with-host-libstdcxx='-lstdc++' \
143 CT_DoLog EXTRA "Building CLooG"
144 CT_DoExecLog ALL make ${JOBSFLAGS} "${cloog_targets[@]}"
146 if [ "${CT_COMPLIBS_CHECK}" = "y" ]; then
147 CT_DoLog EXTRA "Checking CLooG"
148 CT_DoExecLog ALL make ${JOBSFLAGS} -s check
151 CT_DoLog EXTRA "Installing CLooG"
152 CT_DoExecLog ALL make "${cloog_install_targets[@]}"