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

# source: james
TARBALL=zstd-$PKGVER.tar.gz
MD5SUM=2352b1f9ccc7446641046bb3d440c3ed
BUNDLE=fatdog-base-11.3.tar
SRC_URL=http://distro.ibiblio.org/fatdog/source/900/$BUNDLE
#SRC_URL=https://github.com/facebook/zstd/archive/v$PKGVER.tar.gz

SLACKREQ=
SLACKDESC="zstd32: zstd32 $PKGVER (Compression tool and library)
zstd32: 
zstd32: Zstandard, or zstd as short version, is a fast lossless compression 
zstd32: algorithm, targeting real-time compression scenarios at zlib-level 
zstd32: and better compression ratios. It's backed by a very fast entropy 
zstd32: stage, provided by Huff0 and FSE library.
zstd32: 
zstd32: https://github.com/facebook/zstd
zstd32: 
zstd32: This is the 32-bit version of zstd library.
zstd32: 
"

### override download for LFS sources
# $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
}

### prepare
pkg_prepare() {
	pkg_prepare_default &&
	cd tmp/zstd* &&

	# upstream patch
	# patch -Np1 -i $SRC_DIR/zstd-1.5.2-upstream_fixes-1.patch &&

	true
}

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

### build
pkg_build() {
	cd /tmp/zstd*
	MAKEFLAGS="$MAKEFLAGS prefix=/usr libdir=/usr/$LIBDIR"
	make $MAKEFLAGS && make $MAKEFLAGS install &&
	pkg_build_slackdesc
}


