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

# source: BLFS 8.1 / LFS 8.2	
TARBALL=libffi-$PKGVER.tar.gz
MD5SUM=83b89587607e3eb65c70d361f13bab43
BUNDLE=fatdog-base-8.2.tar
SRC_URL=http://distro.ibiblio.org/fatdog/source/800/$BUNDLE

#MD5SUM=83b89587607e3eb65c70d361f13bab43
#SRC_URL=ftp://sourceware.org/pub/libffi/$TARBALL
#BUNDLE=

SLACKREQ=
SLACKDESC="libffi32: libffi $PKGVER (Foreign Function Interface library)  
libffi32:  
libffi32: The libffi library provides a portable, high level programming 
libffi32: interface to various calling conventions. This allows a programmer to 
libffi32: call any function specified by a call interface description at run 
libffi32: time.  
libffi32: 
libffi32: This is the 32-bit version of the library.
libffi32: 
libffi32: 
libffi32:
"

### 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
### package - only collect the libraries
pkg_package() {
	rm -rf bin sbin usr/bin usr/sbin usr/include usr/share
}

### build
pkg_build() {
	cd /tmp/libffi*/ &&
	
	# BLFS 8.1: Install headers in /usr/include
	sed -e '/^includesdir/ s/$(libdir).*$/$(includedir)/' \
		-i include/Makefile.in &&

	sed -e '/^includedir/ s/=.*$/=@includedir@/' \
		-e 's/^Cflags: -I${includedir}/Cflags:/' \
		-i libffi.pc.in        &&

	CONFFLAGS="$CONFFLAGS --disable-static" &&
	pkg_build_autoconf && pkg_build_slackdesc
}


