build.sh at [4f7df8a8e2]

File server/buildpkgs/Tclx/build.sh artifact 7bcc2fd890 part of check-in 4f7df8a8e2


#! /bin/bash

if [ ! -x "../platform" ]; then
	echo "No platform script found, aborting." >&2

	exit 1
fi

VERS=8.4
SRC="src/tclx${VERS}.tar.bz2"
SRCURL="http://sourceforge.net/projects/tclx/files/TclX/${VERS}.0/tclx${VERS}.tar.bz2/download"
BUILDDIR="tclx${VERS}"
WORKDIR="${TMPDIR:-/tmp}/tclx-$$${RANDOM}${RANDOM}${RANDOM}"
PLATFORM="$(../platform)"
PLATDIR="$(pwd)/out/${PLATFORM}"

export VERS SRC SRCURL BUILDDIR WORKDIR PLATFORM PLATDIR

(
	rm -rf build
	mkdir build
) || exit 1

if [ ! -f "${SRC}" ]; then
	mkdir src >/dev/null 2>/dev/null

	wget -O "${SRC}" "${SRCURL}" || exit 1
fi

TCLPRIVATE="${TCLCONFIGDIR}/../include/tcl-private"
if [ ! -d "${TCLPRIVATE}" ]; then
	if [ ! -f src/tcl8.4.19.tar.gz ]; then
		wget -O src/tcl8.4.19.tar.gz http://prdownloads.sourceforge.net/tcl/tcl8.4.19-src.tar.gz
	fi

	(
		mkdir build >/dev/null 2>/dev/null
		cd build || exit 1
		gzip -dc ../src/tcl8.4.19.tar.gz | tar -xf -
	)

	TCLPRIVATE="$(pwd)/build/tcl8.4.19"
	export TCLPRIVATE

	(
		cd "${TCLPRIVATE}/unix" || exit 1

		./configure

		${MAKE:-make}
	)

	TCLCONFIGDIR="${TCLPRIVATE}/unix"
fi
echo "TCLPRIVATE = \"${TCLPRIVATE}\""
CFLAGS="-I${TCLPRIVATE} -I${TCLPRIVATE}/generic -I${TCLPRIVATE}/unix ${CFLAGS}"
export CFLAGS


(
	cd build/ || exit 1

	bzip2 -dc "../${SRC}" | tar -xf -
	cd "${BUILDDIR}" || exit 1

	cat << \__EOF__ | patch -p1
--- tclx8.4/configure.relid	2006-02-03 16:13:25.000000000 -0500
+++ tclx8.4/configure	2006-02-03 16:13:33.000000000 -0500
@@ -6999,7 +6999,7 @@
 	    # results, and the version is kept in special file).
 
 	    if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
-		system=MP-RAS-`awk '{print }' /etc/.relid'`
+		system=MP-RAS-`awk '{print }' /etc/.relid`
 	    fi
 	    if test "`uname -s`" = "AIX" ; then
 		system=AIX-`uname -v`.`uname -r`
--- tclx8.4/tclconfig/tcl.m4.relid	2006-02-03 16:13:43.000000000 -0500
+++ tclx8.4/tclconfig/tcl.m4	2006-02-03 16:13:57.000000000 -0500
@@ -859,7 +859,7 @@
 	    # results, and the version is kept in special file).
 	
 	    if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
-		system=MP-RAS-`awk '{print $3}' /etc/.relid'`
+		system=MP-RAS-`awk '{print $3}' /etc/.relid`
 	    fi
 	    if test "`uname -s`" = "AIX" ; then
 		system=AIX-`uname -v`.`uname -r`
@@ -2302,7 +2302,7 @@
 	    # results, and the version is kept in special file).
 	
 	    if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
-		system=MP-RAS-`awk '{print $3}' /etc/.relid'`
+		system=MP-RAS-`awk '{print $3}' /etc/.relid`
 	    fi
 	    if test "`uname -s`" = "AIX" ; then
 		system=AIX-`uname -v`.`uname -r`
__EOF__
	cat << \__EOF__ | patch -p1
--- tclx8.4/generic/tclXdup.c.varinit	2006-02-03 15:54:38.000000000 -0500
+++ tclx8.4/generic/tclXdup.c	2006-02-03 15:54:53.000000000 -0500
@@ -202,7 +202,7 @@
 {
     Tcl_Channel newChannel;
     int bindFnum, fnum;
-    char *srcChannelId, *targetChannelId;
+    char *srcChannelId = NULL, *targetChannelId;
 
     if ((objc < 2) || (objc > 3)) {
         return TclX_WrongArgs (interp, objv [0],
__EOF__


	bash ./configure --enable-shared --with-tcl="${TCLCONFIGDIR}" --libdir="${PLATDIR}"
	${MAKE:-make} || exit 1

	mkdir -p "${PLATDIR}" >/dev/null 2>/dev/null

	${MAKE:-make} install-lib-binaries PKG_DIR='' || exit 1

) || exit 1

../create_teapot "${PLATDIR}/teapot.txt" "Tclx" "${VERS}" "${SRCURL}" "${PLATFORM}" "Tcl 8.4" "Extended Tcl"

exit 0