### this file is sourced not run
PKGVER=2.5.39
PKGBUILD=1

TARBALL=flex-$PKGVER.tar.bz2
MD5SUM=77d44c6bb8c0705e0017ab9a84a1502b 
SRC_URL=http://distro.ibiblio.org/fatdog/source/710/clfs-packages-3.0.0.tar
BUNDLE=clfs-packages-3.0.0.tar

SLACKREQ=
SLACKDESC="flex: flex $PKGVER (Fast lexical generator)  
flex:  
flex: The Flex package contains a utility for generating programs that 
flex: recognize patterns in text.  
flex: 
flex: This is the 32-bit version of flex.
flex: 
flex: 
flex: 
flex: 
flex:
"


### override download for LFS sources bundle
# $1-src-dir $2-tarball 
pkg_download() {
	echo downloading $BUNDLE for $TARBALL
	wget -P $1 $SRC_URL
	tar -xf $1/$BUNDLE --strip-components=1 -C $1 
	rm $1/$BUNDLE
}

### default pkg_prepare
### default pkg_package
### build
pkg_build() {
	cd /tmp/flex*
	
	CC="gcc ${BUILD64}" ./configure --prefix=/usr \
		--libdir=/usr/lib64 --docdir=/usr/share/doc/flex-2.5.39 &&
	make $MAKEFLAGS && make install &&
	pkg_build_slackdesc &&
	
	# create wrapper
	cat << "EOF" > /usr/bin/lex &&
#!/bin/sh
# Begin /usr/bin/lex

exec /usr/bin/flex -l "$@"

# End /usr/bin/lex
EOF
	chmod -v 755 /usr/bin/lex
}
