Check-in [05cbe23afb]
Overview
Comment:Added Tclx build script
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:05cbe23afb7dbe997dc97dd7a86573a598d1105a
User & Date: rkeene on 2013-12-19 15:37:58
Other Links: manifest | tags
Context
2014-01-03
02:53
Added support for projects including subprojects check-in: 912b38cd97 user: rkeene tags: trunk
2013-12-19
15:37
Added Tclx build script check-in: 05cbe23afb user: rkeene tags: trunk
2013-11-19
16:24
Updated to build Android builds with -static-libgcc check-in: 6f659c9189 user: rkeene tags: trunk
Changes

Added tclx/build.sh version [f74133378a].

            1  +#! /usr/bin/env bash
            2  +
            3  +if [ ! -f 'build.sh' ]; then
            4  +	echo 'ERROR: This script must be run from the directory it is in' >&2
            5  +
            6  +	exit 1
            7  +fi
            8  +if [ -z "${TCLVERS}" ]; then
            9  +	echo 'ERROR: The TCLVERS environment variable is not set' >&2
           10  +
           11  +	exit 1
           12  +fi
           13  +
           14  +TCLXVERS="8.4.1"
           15  +SRC="src/tclx${TCLXVERS}.tar.bz2"
           16  +SRCURL="http://sourceforge.net/projects/tclx/files/TclX/${TCLXVERS}/tclx${TCLXVERS}.tar.bz2/download"
           17  +BUILDDIR="$(pwd)/build/tclx8.4"
           18  +OUTDIR="$(pwd)/out"
           19  +INSTDIR="$(pwd)/inst"
           20  +PATCHDIR="$(pwd)/patches"
           21  +export TCLXVERS SRC SRCURL BUILDDIR OUTDIR INSTDIR PATCHDIR
           22  +
           23  +# Set configure options for this sub-project
           24  +LDFLAGS="${KC_TCLX_LDFLAGS}"
           25  +CFLAGS="${KC_TCLX_CFLAGS}"
           26  +CPPFLAGS="${KC_TCLX_CPPFLAGS}"
           27  +LIBS="${KC_TCLX_LIBS}"
           28  +export LDFLAGS CFLAGS CPPFLAGS LIBS
           29  +
           30  +rm -rf 'build' 'out' 'inst'
           31  +mkdir 'build' 'out' 'inst' || exit 1
           32  +
           33  +TCL_VERSION="unknown"
           34  +if [ -f "${TCLCONFIGDIR}/tclConfig.sh" ]; then
           35  +        source "${TCLCONFIGDIR}/tclConfig.sh"
           36  +fi
           37  +export TCL_VERSION
           38  +
           39  +if [ ! -f "${SRC}" ]; then
           40  +	mkdir 'src' >/dev/null 2>/dev/null
           41  +
           42  +	if [ ! -d 'buildsrc' ]; then
           43  +		rm -f "${SRC}.tmp"
           44  +		wget -O "${SRC}.tmp" "${SRCURL}" || exit 1
           45  +		mv "${SRC}.tmp" "${SRC}"
           46  +	fi
           47  +fi
           48  +
           49  +(
           50  +	cd 'build' || exit 1
           51  +
           52  +	if [ ! -d '../buildsrc' ]; then
           53  +		bzip2 -dc "../${SRC}" | tar -xf -
           54  +	else    
           55  +		cp -rp ../buildsrc/* './'
           56  +	fi
           57  +
           58  +	# Apply required patches
           59  +	cd "${BUILDDIR}" || exit 1
           60  +	for patch in "${PATCHDIR}/all"/tclx-${TCLXVERS}-*.diff "${PATCHDIR}/${TCL_VERSION}"/tclx-${TCLXVERS}-*.diff; do
           61  +		if [ ! -f "${patch}" ]; then
           62  +			continue
           63  +		fi
           64  +
           65  +		echo "Applying: ${patch}"
           66  +		${PATCH:-patch} -p1 < "${patch}"
           67  +	done
           68  +
           69  +	cd "${BUILDDIR}" || exit 1
           70  +
           71  +	# Try to build as a shared object if requested
           72  +	if [ "${STATICTCLX}" = "0" ]; then
           73  +		tryopts="--enable-shared --disable-shared"
           74  +	elif [ "${STATICTCLX}" = "-1" ]; then
           75  +		tryopts="--enable-shared"
           76  +	else
           77  +		tryopts="--disable-shared"
           78  +	fi
           79  +
           80  +	SAVE_CFLAGS="${CFLAGS}"
           81  +	for tryopt in $tryopts __fail__; do
           82  +		# Clean up, if needed
           83  +		make distclean >/dev/null 2>/dev/null
           84  +		rm -rf "${INSTDIR}"
           85  +		mkdir "${INSTDIR}"
           86  +
           87  +		if [ "${tryopt}" = "__fail__" ]; then
           88  +			exit 1
           89  +		fi
           90  +
           91  +		if [ "${tryopt}" == "--enable-shared" ]; then
           92  +			isshared="1"
           93  +		else
           94  +			isshared="0"
           95  +		fi
           96  +
           97  +		# If build a static TclX for KitDLL, ensure that we use PIC
           98  +		# so that it can be linked into the shared object
           99  +		if [ "${isshared}" = "0" -a "${KITTARGET}" = "kitdll" ]; then
          100  +			CFLAGS="${SAVE_CFLAGS} -fPIC"
          101  +		else
          102  +			CFLAGS="${SAVE_CFLAGS}"
          103  +		fi
          104  +		export CFLAGS
          105  +
          106  +		if [ "${isshared}" = '0' ]; then
          107  +			sed 's@USE_TCL_STUBS@XXX_TCL_STUBS@g' configure > configure.new
          108  +		else
          109  +			sed 's@XXX_TCL_STUBS@USE_TCL_STUBS@g' configure > configure.new
          110  +		fi
          111  +		cat configure.new > configure
          112  +		rm -f configure.new
          113  +
          114  +		(
          115  +			echo "Running: ./configure $tryopt --prefix=\"${INSTDIR}\" --exec-prefix=\"${INSTDIR}\" --libdir=\"${INSTDIR}/lib\" --with-tcl=\"${TCLCONFIGDIR}\" ${CONFIGUREEXTRA}"
          116  +			./configure $tryopt --prefix="${INSTDIR}" --exec-prefix="${INSTDIR}" --libdir="${INSTDIR}/lib" --with-tcl="${TCLCONFIGDIR}" ${CONFIGUREEXTRA}
          117  +
          118  +			echo "Running: ${MAKE:-make} tcllibdir=\"${INSTDIR}/lib\" AR=\"${AR:-ar}\" RANLIB=\"${RANLIB:-ranlib}\""
          119  +			${MAKE:-make} tcllibdir="${INSTDIR}/lib" AR="${AR:-ar}" RANLIB="${RANLIB:-ranlib}" || exit 1
          120  +
          121  +			echo "Running: ${MAKE:-make} tcllibdir=\"${INSTDIR}/lib\" AR=\"${AR:-ar}\" RANLIB=\"${RANLIB:-ranlib}\" install"
          122  +			${MAKE:-make} tcllibdir="${INSTDIR}/lib" AR="${AR:-ar}" RANLIB="${RANLIB:-ranlib}" install || exit 1
          123  +		) || continue
          124  +
          125  +		break
          126  +	done
          127  +
          128  +	if [ ! -e "${INSTDIR}/lib/tclx8.4/pkgIndex.tcl" ]; then
          129  +		cat << _EOF_ > "${INSTDIR}/lib/tclx8.4/pkgIndex.tcl"
          130  +package ifneeded Tclx 8.4 [list load {} Tclx]
          131  +_EOF_
          132  +        fi
          133  +
          134  +
          135  +	# Install files needed by installation
          136  +	cp -r "${INSTDIR}/lib" "${OUTDIR}" || exit 1
          137  +	find "${OUTDIR}" -name '*.a' -type f | xargs -n 1 rm -f --
          138  +
          139  +	exit 0
          140  +) || exit 1
          141  +
          142  +exit 0