build.sh at [b4c6d05df2]

File server/buildpkgs/Tk85/build.sh artifact ea016838c5 part of check-in b4c6d05df2


#! /bin/bash

# Define parameters
VERS=8.5.10
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'

# 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

	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.5/* "${PLATDIR}/"

	rm -f "${PLATDIR}"/*.a
	rm -f "${PLATDIR}/tkConfig.sh" "${PLATDIR}/wish8.5"*
	rm -rf "${PLATDIR}/man" "${PLATDIR}/include" "${PLATDIR}/tk8.5" "${PLATDIR}/demos" "${PLATDIR}/lib"

	LIBFILE='libtk8.5.so'
	for chk_libfile in 'libtk8.5.so' 'tk85.dll' 'libtk8.5.dylib'; do
		if [ -f "${PLATDIR}/${chk_libfile}" ]; then
			LIBFILE="${chk_libfile}"
			break
		fi
	done

	cat << \_EOF_ | sed 's|@@VERS@@|'"${VERS}"'|g;s|@@LIBFILE@@|'"${LIBFILE}"'|g' > "${PLATDIR}/pkgIndex.tcl"
if {[catch {package present Tcl 8.5.0}]} { return }
package ifneeded Tk @@VERS@@ "[list set tk_library $dir]; [list load [file join $dir @@LIBFILE@@] Tk]"
_EOF_
) || 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