#! /bin/bash
# Define parameters
VERS=0.1.5-alpha
PLAINVERS="$(echo "${VERS}" | sed 's@-alpha$@@')"
SRC="src/vectcl-${VERS}.tar.gz"
SRCURL="https://github.com/auriocus/VecTcl/archive/v${VERS}.tar.gz"
BUILDDIR="VecTcl-${VERS}"
export VERS SRC SRCURL BUILDDIR
# Load common functions
source ../common.sh
# Do not build if the "tcl" platform has been requested
not_platforms 'tcl'
# Require Tcl 8.5 to build
setup_tcl85
# Download source
download_src
# Build package
(
rm -rf build
mkdir -p "${PLATDIR}" >/dev/null 2>/dev/null
mkdir build
cd build/ || exit 1
gzip -dc "../${SRC}" | tar -xf -
cd "${BUILDDIR}" || exit 1
bash ./configure --enable-shared --enable-threads --with-tcl="${TCLCONFIGDIR}" --prefix="${PLATDIR}" --libdir="${PLATDIR}" --bindir="${PLATDIR}" ${CONFIGUREEXTRA}
${MAKE:-make} || exit 1
${MAKE:-make} install-binaries PKG_DIR='' || exit 1
rm -f "${PLATDIR}/vectclConfig.sh"
rm -f "${PLATDIR}"/*.a
) || exit 1
# Create metadata
../create_teapot "${PLATDIR}/teapot.txt" "vectcl" "${VERS}" "${SRCURL}" "${PLATFORM}" 'Tcl 8.6,TclOO' "Numeric array and linear algebra extension for Tcl. http://auriocus.github.io/VecTcl"
exit 0