### this file is sourced not run
PKGVER=8.6.4
PKGBUILD=1
PKGARCH=i686

# source: post BLFS 7.8 2016-01-06
TARBALL=tcl$PKGVER-src.tar.gz
MD5SUM=d7cbb91f1ded1919370a30edd1534304
SRC_URL=http://downloads.sourceforge.net/tcl/$TARBALL
BUNDLE=

SLACKREQ=
SLACKDESC="tcl32: tcl32 $PKGVER (Tcl programming language)  
tcl32:  
tcl32: The Tcl package contains the Tool Command Language, a robust 
tcl32: general-purpose scripting language.  
tcl32: 
tcl32: This contains 32-bit version of the library.
tcl32: 
tcl32: 
tcl32: 
tcl32: 
tcl32:
"

### default pkg_download
### prepare
pkg_prepare() {
	pkg_prepare_default &&
	cd tmp/tcl*/unix &&
	patch -Np1 -i $CHROOT_DIR/tmp/pkg/tcl-remove-hardcoded-install-path.patch
}

### package - only collect the libraries
pkg_package() {
	rm -rf bin sbin usr/bin usr/sbin usr/include usr/share
	mkdir -p usr/bin &&
	mv -v tmp/*-32 usr/bin &&
	ln -v -sf tclsh8.6-32 usr/bin/tclsh-32
}

### build
pkg_build() {
	cd /tmp/tcl* &&
	cd unix &&
	./configure --prefix=/usr --libdir=/usr/$LIBDIR \
				--mandir=/usr/share/man \
				--without-tzdata \
				--enable-threads &&
	#			--enable-64bit &&
	make $MAKEFLAGS &&

	# BLFS 7.8 tcl 8.6.4 patches
	sed -e "s#$SRCDIR/unix#/usr/$LIBDIR#" \
		-e "s#$SRCDIR#/usr/include#"  \
		-i tclConfig.sh               &&

	sed -e "s#$SRCDIR/unix/pkgs/tdbc1.0.3#/usr/$LIBDIR/tdbc1.0.3#" \
		-e "s#$SRCDIR/pkgs/tdbc1.0.3/generic#/usr/include#"    \
		-e "s#$SRCDIR/pkgs/tdbc1.0.3/library#/usr/$LIBDIR/tcl8.6#" \
		-e "s#$SRCDIR/pkgs/tdbc1.0.3#/usr/include#"            \
		-i pkgs/tdbc1.0.3/tdbcConfig.sh                        &&

	sed -e "s#$SRCDIR/unix/pkgs/itcl4.0.3#/usr/$LIBDIR/itcl4.0.3#" \
		-e "s#$SRCDIR/pkgs/itcl4.0.3/generic#/usr/include#"    \
		-e "s#$SRCDIR/pkgs/itcl4.0.3#/usr/include#"            \
		-i pkgs/itcl4.0.3/itclConfig.sh                        &&
	
	make install &&
	make install-private-headers &&
	pkg_build_slackdesc &&
	
	chmod -v 755 /usr/$LIBDIR/libtcl8.6.so		 &&
	#ln -v -sf tclsh8.6 /usr/bin/tclsh && # replaced with multilib

	# multilib
	mv -v /usr/bin/tclsh8.6 /tmp/tclsh8.6-32
}


