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

# source: james
TARBALL=lz4-$PKGVER.tar.gz
MD5SUM=3898c56c82fb3d9455aefd48db48eaad
SRC_URL=https://github.com/lz4/lz4/archive/v${PKGVER}.tar.gz
BUNDLE=

SLACKREQ=''
SLACKDESC="liblz4_32: liblz4_32 $PKGVER (Fast compression program)
liblz4_32: 
liblz4_32: LZ4 is lossless compression algorithm, providing compression speed at 
liblz4_32: 400 MB/s per core, scalable with multi-cores CPU. It also features an 
liblz4_32: extremely fast decoder, with speed in multiple GB/s per core, 
liblz4_32: typically reaching RAM speed limits on multi-core systems.
liblz4_32: 
liblz4_32: This is 32-bit version of the library.
liblz4_32: 
liblz4_32: https://github.com/Cyan4973/lz4
liblz4_32: 
"

### default pkg_download
### default pkg_prepare
### package - only collect the libraries
pkg_package() {
	rm -rf bin sbin usr/bin usr/sbin usr/include usr/share etc
}

### build
pkg_build() {
	rm -f /usr/bin/*lz4*
	export LIBDIR=lib CC="gcc ${BUILD32}" CFLAGS="$CFLAGS -fPIC"
	cd /tmp/lz4*
	MAKEFLAGS="$MAKEFLAGS PREFIX=/usr LIBDIR=/usr/$LIBDIR"

	# In v1.9.2 building via the main Makefile produces liblz4.a that breaks
	# linking, while building libarchive (only x86_64, but let's make it consistent):
	# liblz4.a(lz4.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
	make $MAKEFLAGS -C lib &&
	make $MAKEFLAGS -C programs lz4 lz4c &&
	make $MAKEFLAGS install &&

	rm -rf /usr/$LIBDIR/liblz4.so* # don't want the shared library
	pkg_build_slackdesc &&
	
	true
}
