build.sh at [ba02ddd48a]

File server/buildpkgs/ctk/build.sh artifact a29f46985e part of check-in ba02ddd48a


#! /bin/bash

# Define parameters
VERS=8.0.2801
SRC="src/ctk-${VERS}.tar.gz"
SRCURL="http://www.rkeene.org/devel/ctk/ctk-${VERS}.tar.gz"
BUILDDIR="ctk-${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

# Build package
(
	cd "build/${BUILDDIR}" || 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/ctk${VERS}/* "${PLATDIR}/"
	mv "${PLATDIR}"/lib/* "${PLATDIR}/"

	cat << _EOF_ > "${PLATDIR}/pkgIndex.tcl"
package ifneeded CTk $VERS "[list set env(CTK_LIBRARY) \$dir]; [list load [file join \$dir libctk.so] Tk]; package provide CTk $VERS"
_EOF_

	rm -f "${PLATDIR}"/*.a
	rm -rf "${PLATDIR}/man" "${PLATDIR}/include" "${PLATDIR}/ctk${VERS}" "${PLATDIR}/demos" "${PLATDIR}/lib" "${PLATDIR}/bin"
) || exit 1

# Create metadata
../create_teapot "${PLATDIR}/teapot.txt" "CTk" "${VERS}" "${SRCURL}" "${PLATFORM}" "Tcl 8.4" "Curses-based Tk"

exit 0