#! /usr/bin/env bash
if [ ! -f 'build.sh' ]; then
echo 'ERROR: This script must be run from the directory it is in' >&2
exit 1
fi
if [ -z "${TCLVERS}" ]; then
echo 'ERROR: The TCLVERS environment variable is not set' >&2
exit 1
fi
use_git='0'
if echo "${TCLVERS}" | grep '^fossil_' >/dev/null; then
use_git='1'
GITTAG='master'
NSFVERS="${GITTAG}"
NSFVERSEXTRA=""
SRC="src/nsf${GITTAG}.zip"
SRCURL="http://fisheye.openacs.org/browse/~tarball=zip,br=${GITTAG}/nsf/nsf.zip"
SRCHASH='-'
else
NSFVERS="2.0.0"
NSFVERSEXTRA=""
SRC="src/nsf${NSFVERS}.tar.gz"
SRCURL="http://sourceforge.net/projects/next-scripting/files/${NSFVERS}/nsf${NSFVERS}.tar.gz/download"
SRCHASH='-'
NSFVERS="2.0.0"
NSFVERSEXTRA=""
SRC="src/nsf${NSFVERS}.tar.gz"
SRCURL="http://sourceforge.net/projects/next-scripting/files/${NSFVERS}/nsf${NSFVERS}.tar.gz/download"
SRCHASH='-'
fi
BUILDDIR="$(pwd)/build/nsf${NSFVERS}"
OUTDIR="$(pwd)/out"
INSTDIR="$(pwd)/inst"
export NSFVERS SRC SRCURL BUILDDIR OUTDIR INSTDIR
# Set configure options for this sub-project
LDFLAGS="${LDFLAGS} ${KC_NSF_LDFLAGS}"
fi
fi
(
cd 'build' || exit 1
if [ ! -d '../buildsrc' ]; then
if [ "${use_git}" = "1" ]; then
unzip "../${SRC}" -d nsf${NSFVERS}
else
gzip -dc "../${SRC}" | tar -xf -
gzip -dc "../${SRC}" | tar -xf -
fi
else
cp -rp ../buildsrc/* './'
fi
cd "${BUILDDIR}" || exit 1
if [ "${use_git}" = "1" ]; then
## the GIT zip tarball does not preserve file permissions (configure)
rm -rf configure
autoconf || exit 1
fi
# There's a STATIC<packageInAllUpperCase>=-1,0,1
# ... where -1 means no (i.e., shared),
# ... 0 means try not to (try shared first, if that
# doesn't work do static),
# ... and 1 means try to (try only static)