#! /bin/bash
# Define parameters
VERS=0.22
SRC="src/tcc4tcl-${VERS}.tar.gz"
SRCURL="http://rkeene.org/devel/tcc4tcl-${VERS}.tar.gz"
BUILDDIR="tcc4tcl-${VERS}"
LICENSE="LGPLv2.1"
export VERS SRC SRCURL BUILDDIR
# Load common functions
source ../common.sh
# Do not build if the "tcl" platform has been requested
not_platforms 'tcl'
# Do not support multiarch builds
not_platforms_regexp '^macosx.*i386-x86_64' '^macosx.*x86_64-i386'
# Requires Tcl 8.5 or newer
setup_tcl 8.5 8.6 || exit 1
# Download source
download_src
# Extract package
(
rm -rf build
mkdir build
cd build/ || exit 1
gzip -dc "../${SRC}" | tar -xf -
)
# Apply patches
apply_patches
# Build package
(
mkdir -p "${PLATDIR}" >/dev/null 2>/dev/null
cd "build" || exit 1
cd "${BUILDDIR}" || exit 1
# TCC ships with object files in the way
${MAKE:-make} distclean >/dev/null 2>/dev/null
bash ./configure --enable-shared --enable-threads --with-tcl="${TCLCONFIGDIR}" --prefix="${PLATDIR}" --libdir="${PLATDIR}" --bindir="${PLATDIR}" ${CONFIGUREEXTRA}
${MAKE:-make} PACKAGE_INSTALL_DIR="${PLATDIR}" || exit 1
${MAKE:-make} PACKAGE_INSTALL_DIR="${PLATDIR}" install || exit 1
) || exit 1
# Create metadata
../create_teapot "${PLATDIR}/teapot.txt" "tcc4tcl" "${VERS}" "${SRCURL}" "${PLATFORM}" "Tcl 8.5" "tcc4tcl provides a Tcl binding to the TinyCC compiler. It allows dynamic compilation of C code from within a Tcl interpreter." "${LICENSE}"
exit 0