diff options
author | eschnett <eschnett@325d7946-0b50-4e3b-902a-3a8d69fbdfa6> | 2014-12-08 22:01:13 +0000 |
---|---|---|
committer | eschnett <eschnett@325d7946-0b50-4e3b-902a-3a8d69fbdfa6> | 2014-12-08 22:01:13 +0000 |
commit | 7b598bae81409e6d8c5d1441bb015ed54f4adb83 (patch) | |
tree | bf4d9e17f94c77843b8a9ebe7f7a14bf746736c6 | |
parent | 3b04f6ceea85605f63e8cd7750e21a557da25df0 (diff) |
Build FFTW3 at build time
git-svn-id: http://svn.cactuscode.org/projects/ExternalLibraries/FFTW3/trunk@43 325d7946-0b50-4e3b-902a-3a8d69fbdfa6
-rw-r--r-- | configuration.ccl | 5 | ||||
-rwxr-xr-x | src/build.sh | 65 | ||||
-rwxr-xr-x[-rw-r--r--] | src/detect.sh (renamed from configure.sh) | 108 | ||||
-rw-r--r-- | src/make.code.deps | 7 |
4 files changed, 103 insertions, 82 deletions
diff --git a/configuration.ccl b/configuration.ccl index 7ffab25..13aa5ff 100644 --- a/configuration.ccl +++ b/configuration.ccl @@ -2,7 +2,10 @@ PROVIDES FFTW3 { - SCRIPT configure.sh + SCRIPT src/detect.sh LANG bash OPTIONS FFTW3_DIR FFTW3_INSTALL_DIR FFTW3_LIBS } + +# Pass configuration options to build script +REQUIRES FFTW3 diff --git a/src/build.sh b/src/build.sh new file mode 100755 index 0000000..74a5b05 --- /dev/null +++ b/src/build.sh @@ -0,0 +1,65 @@ +#! /bin/bash + +################################################################################ +# Build +################################################################################ + +# Set up shell +if [ "$(echo ${VERBOSE} | tr '[:upper:]' '[:lower:]')" = 'yes' ]; then + set -x # Output commands +fi +set -e # Abort on errors + + + +# Set locations +THORN=FFTW3 +NAME=fftw-3.3.3 +SRCDIR="$(dirname $0)" +BUILD_DIR=${SCRATCH_BUILD}/build/${THORN} +if [ -z "${FFTW3_INSTALL_DIR}" ]; then + INSTALL_DIR=${SCRATCH_BUILD}/external/${THORN} +else + echo "BEGIN MESSAGE" + echo "Installing FFTW3 into ${FFTW3_INSTALL_DIR}" + echo "END MESSAGE" + INSTALL_DIR=${FFTW3_INSTALL_DIR} +fi +DONE_FILE=${SCRATCH_BUILD}/done/${THORN} +FFTW3_DIR=${INSTALL_DIR} + +# Set up environment +# export LDFLAGS="$(echo $LDFLAGS $(for libdir in $LIBDIRS; do echo '' -L$libdir -Wl,-rpath,$libdir; done | sed -e 's/ -L-/ -/g;s/ -Wl,-rpath,-/ -/g'))" +# export LIBS="$(echo $(for lib in $LIBS; do echo '' -l$lib; done | sed -e 's/ -l-/ -/g'))" +unset LIBS +unset RPATH +if echo '' ${ARFLAGS} | grep 64 >/dev/null 2>&1; then + export OBJECT_MODE=64 +fi + +echo "FFTW3: Preparing directory structure..." +cd ${SCRATCH_BUILD} +mkdir build external done 2> /dev/null || true +rm -rf ${BUILD_DIR} ${INSTALL_DIR} +mkdir ${BUILD_DIR} ${INSTALL_DIR} + +echo "FFTW3: Unpacking archive..." +pushd ${BUILD_DIR} +${TAR?} xzf ${SRCDIR}/../dist/${NAME}.tar.gz + +echo "FFTW3: Configuring..." +cd ${NAME} +./configure --prefix=${FFTW3_DIR} + +echo "FFTW3: Building..." +${MAKE} + +echo "FFTW3: Installing..." +${MAKE} install +popd + +echo "FFTW3: Cleaning up..." +rm -rf ${BUILD_DIR} + +date > ${DONE_FILE} +echo "FFTW3: Done." diff --git a/configure.sh b/src/detect.sh index be84a07..d79f14d 100644..100755 --- a/configure.sh +++ b/src/detect.sh @@ -79,27 +79,27 @@ then echo "Using bundled FFTW3..." echo "END MESSAGE" - # check for required tools. Do this here so that we don't require them when - # using the system library - if [ x$TAR = x ] ; then - echo 'BEGIN ERROR' - echo 'Could not find tar command. Please make sure that (gnu) tar is present' - echo 'and that the TAR variable is set to its location.' - echo 'END ERROR' - exit 1 + # Check for required tools. Do this here so that we don't require + # them when using the system library. + if [ "x$TAR" = x ] ; then + echo 'BEGIN ERROR' + echo 'Could not find tar command.' + echo 'Please make sure that the (GNU) tar command is present,' + echo 'and that the TAR variable is set to its location.' + echo 'END ERROR' + exit 1 + fi + if [ "x$PATCH" = x ] ; then + echo 'BEGIN ERROR' + echo 'Could not find patch command.' + echo 'Please make sure that the patch command is present,' + echo 'and that the PATCH variable is set to its location.' + echo 'END ERROR' + exit 1 fi - #if [ x$PATCH = x ] ; then - # echo 'BEGIN ERROR' - # echo 'Could not find patch command. Please make sure that (gnu) tar is present' - # echo 'and that the PATCH variable is set to its location.' - # echo 'END ERROR' - # exit 1 - #fi # Set locations THORN=FFTW3 - NAME=fftw-3.3.3 - SRCDIR="$(dirname $0)" BUILD_DIR=${SCRATCH_BUILD}/build/${THORN} if [ -z "${FFTW3_INSTALL_DIR}" ]; then INSTALL_DIR=${SCRATCH_BUILD}/external/${THORN} @@ -109,71 +109,12 @@ then echo "END MESSAGE" INSTALL_DIR=${FFTW3_INSTALL_DIR} fi - DONE_FILE=${SCRATCH_BUILD}/done/${THORN} FFTW3_DIR=${INSTALL_DIR} - - if [ -e ${DONE_FILE} -a ${DONE_FILE} -nt ${SRCDIR}/dist/${NAME}.tar.gz \ - -a ${DONE_FILE} -nt ${SRCDIR}/configure.sh ] - then - echo "BEGIN MESSAGE" - echo "FFTW3 has already been built; doing nothing" - echo "END MESSAGE" - else - echo "BEGIN MESSAGE" - echo "Building FFTW3" - echo "END MESSAGE" - - # Build in a subshell - ( - exec >&2 # Redirect stdout to stderr - if [ "$(echo ${VERBOSE} | tr '[:upper:]' '[:lower:]')" = 'yes' ]; then - set -x # Output commands - fi - set -e # Abort on errors - cd ${SCRATCH_BUILD} - - # Set up environment - export LDFLAGS="$(echo $LDFLAGS $(for libdir in $LIBDIRS; do echo '' -L$libdir -Wl,-rpath,$libdir; done | sed -e 's/ -L-/ -/g;s/ -Wl,-rpath,-/ -/g'))" - export LIBS="$(echo $(for lib in $LIBS; do echo '' -l$lib; done | sed -e 's/ -l-/ -/g'))" - unset RPATH - if echo '' ${ARFLAGS} | grep 64 >/dev/null 2>&1; then - export OBJECT_MODE=64 - fi - - echo "FFTW3: Preparing directory structure..." - mkdir build external done 2> /dev/null || true - rm -rf ${BUILD_DIR} ${INSTALL_DIR} - mkdir ${BUILD_DIR} ${INSTALL_DIR} - - echo "FFTW3: Unpacking archive..." - pushd ${BUILD_DIR} - ${TAR?} xzf ${SRCDIR}/dist/${NAME}.tar.gz - - echo "FFTW3: Configuring..." - cd ${NAME} - ./configure --prefix=${FFTW3_DIR} - - echo "FFTW3: Building..." - ${MAKE} - - echo "FFTW3: Installing..." - ${MAKE} install - popd - - echo "FFTW3: Cleaning up..." - rm -rf ${BUILD_DIR} - - date > ${DONE_FILE} - echo "FFTW3: Done." - ) - if (( $? )); then - echo 'BEGIN ERROR' - echo 'Error while building FFTW3. Aborting.' - echo 'END ERROR' - exit 1 - fi - fi - +else + THORN=FFTW3 + DONE_FILE=${SCRATCH_BUILD}/done/${THORN} + mkdir ${SCRATCH_BUILD}/done 2> /dev/null || true + date > ${DONE_FILE} fi @@ -182,6 +123,11 @@ fi # Configure Cactus ################################################################################ +# Pass configuration options to build script +echo "BEGIN MAKE_DEFINITION" +echo "FFTW3_INSTALL_DIR = ${FFTW3_INSTALL_DIR}" +echo "END MAKE_DEFINITION" + # Set options if [ "${FFTW3_DIR}" != 'NO_BUILD' ]; then : ${FFTW3_INC_DIRS="${FFTW3_DIR}/include"} diff --git a/src/make.code.deps b/src/make.code.deps new file mode 100644 index 0000000..ad4e290 --- /dev/null +++ b/src/make.code.deps @@ -0,0 +1,7 @@ +# Main make.code.deps file for thorn FFTW3 + +export FFTW3_INSTALL_DIR + +$(CCTK_TARGET) $(OBJS) $(SRCS:%=%.d): $(SCRATCH_BUILD)/done/$(THORN) +$(SCRATCH_BUILD)/done/$(THORN): $(SRCDIR)/build.sh + +$(SRCDIR)/build.sh |