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

# source: BLFS 8.2
TARBALL=tk$PKGVER-src.tar.gz
MD5SUM=5e0faecba458ee1386078fb228d008ba
SRC_URL=http://downloads.sourceforge.net/tcl/$TARBALL
BUNDLE=

SLACKREQ='tcl libX11'
SLACKDESC="tk: tk $PKGVER (GUI toolkit for Tcl)  
tk:  
tk: Tk is the GUI toolkit for Tcl.  
tk: 
tk: 
tk: 
tk: 
tk: 
tk: 
tk: 
tk: 
"

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

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


