build.sh at [326afc96d5]

File server/buildpkgs/Tk84/build.sh artifact afef541d02 part of check-in 326afc96d5


#! /bin/bash

# Define parameters
VERS=8.4.19
SRC="src/tk${VERS}-src.tar.gz"
SRCURL="http://prdownloads.sourceforge.net/tcl/tk${VERS}-src.tar.gz"
BUILDDIR="tk${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'

# Download source
download_src

# Extract source
(
	rm -rf build
	mkdir -p "${PLATDIR}" >/dev/null 2>/dev/null
	mkdir build

	cd build/ || exit 1

	gzip -dc "../${SRC}" | tar -xf -
) || exit 1

# Apply patches
apply_patches

# Build package
(
	cd "build/${BUILDDIR}" || exit 1

	TCL_PLAT_BUILD_DIR="$(basename "${TCLBUILDDIR}")"

	cd "${TCL_PLAT_BUILD_DIR}" || exit 1

	bash ./configure --enable-shared --with-tcl="${TCLCONFIGDIR}" --prefix="${PLATDIR}" --libdir="${PLATDIR}" --bindir="${PLATDIR}" ${CONFIGUREEXTRA}

	${MAKE:-make} || exit 1

	${MAKE:-make} install || exit 1

	mv "${PLATDIR}"/lib/tk8.4/* "${PLATDIR}/"

	cat << \_EOF_ > "${PLATDIR}/pkgIndex.tcl"
if {[package vcompare [package provide Tcl] 8.4] != 0} { return }
package ifneeded Tk 8.4 "[list set tk_library $dir]; [list load [file join $dir libtk8.4.so] Tk]"
_EOF_

	rm -f "${PLATDIR}"/*.a
	rm -f "${PLATDIR}/tkConfig.sh" "${PLATDIR}/wish8.4"
	rm -rf "${PLATDIR}/man" "${PLATDIR}/include" "${PLATDIR}/tk8.4" "${PLATDIR}/demos" "${PLATDIR}/lib"
) || exit 1

# Create metadata
../create_teapot "${PLATDIR}/teapot.txt" "Tk" "${VERS}" "${SRCURL}" "${PLATFORM}" "Tcl ${VERS}" "Cross-platform widget toolkit that provides a library of basic elements for building a graphical user interface (GUI)."

exit 0