Files
tcl/source.sh
T

74 lines
2.6 KiB
Bash

# This is the source.sh script. It is executed by BPM in a temporary directory when compiling a source package
# BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE
# BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT
DOWNLOAD="https://downloads.sourceforge.net/tcl/tcl${BPM_PKG_VERSION}-src.tar.gz"
FILENAME="${DOWNLOAD##*/}"
# The prepare function is executed in the root of the temp directory
# This function is used for downloading files and putting them into the correct location
prepare() {
wget "$DOWNLOAD"
tar -xvf "$FILENAME" --strip-components=1 -C "$BPM_SOURCE"
}
# The build function is executed in the source directory
# This function is used to compile the source code
build() {
cd unix
./configure --prefix=/usr \
--mandir=/usr/share/man \
--enable-threads \
--enable-64bit \
--disable-rpath
make -j1
# Remove build directory traces
tclver=8.6
sed -e "s|${BPM_SOURCE}/unix|/usr/lib|" \
-e "s|${BPM_SOURCE}|/usr/include|" \
-i tclConfig.sh
tdbcver=tdbc1.1.10
sed -e "s|${BPM_SOURCE}/unix/pkgs/$tdbcver|/usr/lib/$tdbcver|" \
-e "s|${BPM_SOURCE}/pkgs/$tdbcver/generic|/usr/include|" \
-e "s|${BPM_SOURCE}/pkgs/$tdbcver/library|/usr/lib/tcl${BPM_PKG_VERSION%.*}|" \
-e "s|${BPM_SOURCE}/pkgs/$tdbcver|/usr/include|" \
-i "pkgs/$tdbcver/tdbcConfig.sh"
itclver=itcl4.3.2
sed -e "s|${BPM_SOURCE}/unix/pkgs/$itclver|/usr/lib/$itclver|" \
-e "s|${BPM_SOURCE}/pkgs/$itclver/generic|/usr/include|" \
-e "s|${BPM_SOURCE}/pkgs/$itclver|/usr/include|" \
-i "pkgs/$itclver/itclConfig.sh"
}
# The check function is executed in the source directory
# This function is used to run tests to verify the package has been compiled correctly
check() {
cd unix
make -j1 test
}
# The package function is executed in the source directory
# This function is used to move the compiled files into the output directory
package() {
cd unix
make DESTDIR="$BPM_OUTPUT" install install-private-headers
# Create versioned tclsh link
ln -sf tclsh${BPM_PKG_VERSION%.*} "$BPM_OUTPUT"/usr/bin/tclsh
# Create versioned libtcl link
ln -sf libtcl${BPM_PKG_VERSION%.*}.so "$BPM_OUTPUT"/usr/lib/libtcl.so
# Move man page as it is in conflict with a perl man page
mv "$BPM_OUTPUT"/usr/share/man/man3/Thread.3 "$BPM_OUTPUT"/usr/share/man/man3/Tcl_Thread.3
# Install package license
install -Dm644 ../license.terms "$BPM_OUTPUT"/usr/share/licenses/tcl/license.terms
}