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

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

SLACKREQ=tcl32
SLACKDESC="tk32: tk32 $PKGVER (GUI toolkit for Tcl)  
tk32:  
tk32: Tk is the GUI toolkit for Tcl.  
tk32: 
tk32: This contains 32-bit version of the library.
tk32: 
tk32: 
tk32: 
tk32: 
tk32: 
tk32: 
"

### default pkg_download
### prepare
pkg_prepare() {
	pkg_prepare_default &&
	cd tmp/tk*/unix &&
	patch -Np2 -i $CHROOT_DIR/tmp/pkg/tk-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 wish8.6-32 usr/bin/wish-32
}

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

	# make sure it refers to system-wide libs
	sed -e "s@^\(TK_SRC_DIR='\).*@\1/usr/include'@" \
		-e "/TK_B/s@='\(-L\)\?.*unix@='\1/usr/$LIBDIR@" \
		-i tkConfig.sh

		
	make install &&
	make install-private-headers &&
	pkg_build_slackdesc &&
	
	chmod -v 755 /usr/$LIBDIR/libtk8.6.so &&
	#ln -v -sf wish8.6 /usr/bin/wish &&

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


