Files
Pmodules/20-build-tcl
T

62 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
#
# https://www.tcl.tk
#
set -x
P=tcl
V=${TCL_VERSION:-8.6.12}
FNAME="$P$V-src.tar.gz"
DOWNLOAD_URL="https://prdownloads.sourceforge.net/tcl/${FNAME}"
PREFIX="${PMODULES_HOME}"
SRC_FILE="${PMODULES_DISTFILESDIR}/${FNAME}"
SRC_DIR="${PMODULES_TMPDIR}/$P-$V/src"
BUILD_DIR="${PMODULES_TMPDIR}/$P-$V/build"
trap "pb_exit" EXIT
# download
test -r "${SRC_FILE}" || curl -L --output "$_" "${DOWNLOAD_URL}" || exit ${PB_ERR_DOWNLOAD}
# unpack
mkdir -p "${SRC_DIR}" && cd "$_" || exit ${PB_ERR_SYSTEM}
tar --directory "${SRC_DIR}" --strip-components 1 -xv -f "${SRC_FILE}" || exit ${PB_ERR_UNTAR}
# configure
mkdir -p "${BUILD_DIR}" && cd "$_" || exit ${PB_ERR_SYSTEM}
case $(uname -s) in
Linux )
srcdir="${SRC_DIR}/unix"
;;
Darwin )
srcdir="${SRC_DIR}/macosx"
;;
* )
echo "Oops: unsupported OS!" 1>&2
exit ${PB_ERR_SYSTEM}
;;
esac
"${srcdir}"/configure \
--prefix="${PREFIX}" \
--bindir="${PREFIX}/${UTILBIN_DIR}" \
--mandir="${PREFIX}/share/man" \
--enable-shared=no \
|| exit ${PB_ERR_CONFIGURE}
# compile & install
make -j ${NJOBS} || exit ${PB_ERR_MAKE}
make install || exit ${PB_ERR_INSTALL}
# post-install
{ cd "${PREFIX}/${UTILBIN_DIR}" && rm -f tclsh && ln -fs tclsh${V%.*} tclsh; };
rm -rf "${PREFIX}/share/man/man3"
rm -rf "${PREFIX}/share/man/mann"
# Local Variables:
# mode: shell-script-mode
# sh-basic-offset: 8
# End: