aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreschnett <eschnett@9e23cc15-e5c8-4d65-9080-beda90ea645b>2014-12-01 19:48:51 +0000
committereschnett <eschnett@9e23cc15-e5c8-4d65-9080-beda90ea645b>2014-12-01 19:48:51 +0000
commitaaafabaa7a3a411ca6ca6a08fa6bbe90ae381e42 (patch)
tree0df456d1479b65a44956667fbe3f50db49adc329
parent8d621cb8431cc70645071fa2c0da5b7c01d5082e (diff)
Merge eschnett/delayed-build
git-svn-id: http://svn.cactuscode.org/projects/ExternalLibraries/GSL/trunk@64 9e23cc15-e5c8-4d65-9080-beda90ea645b
-rw-r--r--configuration.ccl5
-rwxr-xr-xsrc/build.sh62
-rwxr-xr-x[-rw-r--r--]src/detect.sh (renamed from configure.sh)109
-rw-r--r--src/make.code.deps7
4 files changed, 103 insertions, 80 deletions
diff --git a/configuration.ccl b/configuration.ccl
index 26f6fa3..696ef5c 100644
--- a/configuration.ccl
+++ b/configuration.ccl
@@ -2,7 +2,10 @@
PROVIDES GSL
{
- SCRIPT configure.sh
+ SCRIPT src/detect.sh
LANG bash
OPTIONS GSL_DIR GSL_INSTALL_DIR GSL_LIBS
}
+
+# Pass configuration options to build script
+REQUIRES GSL
diff --git a/src/build.sh b/src/build.sh
new file mode 100755
index 0000000..442cc16
--- /dev/null
+++ b/src/build.sh
@@ -0,0 +1,62 @@
+#! /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=GSL
+NAME=gsl-1.16
+SRCDIR="$(dirname $0)"
+BUILD_DIR=${SCRATCH_BUILD}/build/${THORN}
+if [ -z "${GSL_INSTALL_DIR}" ]; then
+ INSTALL_DIR=${SCRATCH_BUILD}/external/${THORN}
+else
+ echo "BEGIN MESSAGE"
+ echo "Installing GSL into ${GSL_INSTALL_DIR} "
+ echo "END MESSAGE"
+ INSTALL_DIR=${GSL_INSTALL_DIR}
+fi
+DONE_FILE=${SCRATCH_BUILD}/done/${THORN}
+GSL_DIR=${INSTALL_DIR}
+
+# Set up environment
+unset LIBS
+if echo '' ${ARFLAGS} | grep 64 > /dev/null 2>&1; then
+ export OBJECT_MODE=64
+fi
+
+echo "GSL: 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 "GSL: Unpacking archive..."
+pushd ${BUILD_DIR}
+${TAR?} xzf ${SRCDIR}/../dist/${NAME}.tar.gz
+
+echo "GSL: Configuring..."
+cd ${NAME}
+./configure --prefix=${GSL_DIR} --enable-shared=no
+
+echo "GSL: Building..."
+${MAKE}
+
+echo "GSL: Installing..."
+${MAKE} install
+popd
+
+echo "GSL: Cleaning up..."
+rm -rf ${BUILD_DIR}
+
+date > ${DONE_FILE}
+echo "GSL: Done."
diff --git a/configure.sh b/src/detect.sh
index f13a9a6..9264293 100644..100755
--- a/configure.sh
+++ b/src/detect.sh
@@ -60,27 +60,27 @@ then
echo "Using bundled GSL..."
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=GSL
- NAME=gsl-1.16
- SRCDIR="$(dirname $0)"
BUILD_DIR=${SCRATCH_BUILD}/build/${THORN}
if [ -z "${GSL_INSTALL_DIR}" ]; then
INSTALL_DIR=${SCRATCH_BUILD}/external/${THORN}
@@ -90,69 +90,15 @@ then
echo "END MESSAGE"
INSTALL_DIR=${GSL_INSTALL_DIR}
fi
- DONE_FILE=${SCRATCH_BUILD}/done/${THORN}
GSL_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 "GSL has already been built; doing nothing"
- echo "END MESSAGE"
- else
- echo "BEGIN MESSAGE"
- echo "Building GSL"
- 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
- unset LIBS
- if echo '' ${ARFLAGS} | grep 64 > /dev/null 2>&1; then
- export OBJECT_MODE=64
- fi
-
- echo "GSL: Preparing directory structure..."
- mkdir build external done 2> /dev/null || true
- rm -rf ${BUILD_DIR} ${INSTALL_DIR}
- mkdir ${BUILD_DIR} ${INSTALL_DIR}
-
- echo "GSL: Unpacking archive..."
- pushd ${BUILD_DIR}
- ${TAR?} xzf ${SRCDIR}/dist/${NAME}.tar.gz
-
- echo "GSL: Configuring..."
- cd ${NAME}
- ./configure --prefix=${GSL_DIR} --enable-shared=no
-
- echo "GSL: Building..."
- ${MAKE}
-
- echo "GSL: Installing..."
- ${MAKE} install
- popd
-
- echo "GSL: Cleaning up..."
- rm -rf ${BUILD_DIR}
-
- date > ${DONE_FILE}
- echo "GSL: Done."
- )
- if (( $? )); then
- echo 'BEGIN ERROR'
- echo 'Error while building GSL. Aborting.'
- echo 'END ERROR'
- exit 1
- fi
- fi
-
+ GSL_INC_DIRS="$GSL_DIR/include"
+ GSL_LIB_DIRS="$GSL_DIR/lib"
+ GSL_LIBS="gsl gslcblas"
+else
+ THORN=GSL
+ DONE_FILE=${SCRATCH_BUILD}/done/${THORN}
+ mkdir ${SCRATCH_BUILD}/done 2> /dev/null || true
+ date > ${DONE_FILE}
fi
@@ -161,6 +107,11 @@ fi
# Configure Cactus
################################################################################
+# Pass configuration options to build script
+echo "BEGIN MAKE_DEFINITION"
+echo "GSL_INSTALL_DIR = ${GSL_INSTALL_DIR}"
+echo "END MAKE_DEFINITION"
+
# Set options
if [ -x ${GSL_DIR}/bin/gsl-config ]; then
inc_dirs="$(${GSL_DIR}/bin/gsl-config --cflags)"
diff --git a/src/make.code.deps b/src/make.code.deps
new file mode 100644
index 0000000..35b441d
--- /dev/null
+++ b/src/make.code.deps
@@ -0,0 +1,7 @@
+# Main make.code.deps file for thorn GSL
+
+export GSL_INSTALL_DIR
+
+$(CCTK_TARGET) $(OBJS): $(SCRATCH_BUILD)/done/$(THORN)
+$(SCRATCH_BUILD)/done/$(THORN): $(SRCDIR)/build.sh
+ $(SRCDIR)/build.sh