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

# 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="tcl: tcl $PKGVER (Tcl programming language)  
tcl:  
tcl: The Tcl package contains the Tool Command Language, a robust 
tcl: general-purpose scripting language.  
tcl: 
tcl: 
tcl: 
tcl: 
tcl: 
tcl: 
tcl:
"

### 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
}

### default pkg_package
### 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{,-64} &&
	ln -v -sf multiarch_wrapper /usr/bin/tclsh8.6 &&
	ln -v -sf tclsh8.6-64 /usr/bin/tclsh-64 &&
	ln -v -sf multiarch_wrapper /usr/bin/tclsh	
}


