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

# source: james
TARBALL=upx-$PKGVER-src.tar.xz
MD5SUM=bf5564f33fe9062bc48b53abd4b34223
SRC_URL=https://github.com/upx/upx/releases/download/v${PKGVER}/$TARBALL
BUNDLE=

LZMASDK_TARBALL=upx-lzma-sdk-$PKGVER.tar.gz
LZMASDK_MD5SUM=627d85e6cf403f9a0805ac49dda024f4
LZMASDK_URL=https://github.com/upx/upx-lzma-sdk/archive/v$PKGVER.tar.gz

SLACKREQ= # libucl build-time only
SLACKDESC="upx: upx $PKGVER (Executable compressor)  
upx:  
upx: UPX is a free, portable, extendable, high-performance executable packer 
upx: for several executable formats. UPX achieves an excellent compression 
upx: ratio and offers very fast decompression. Your executables suffer no 
upx: memory overhead or other drawbacks for most of the formats supported, 
upx: because of in-place decompression.  
upx: 
upx: https://upx.github.io/
upx: 
upx: 
"

### default pkg_download
### default pkg_prepare
pkg_prepare() {
	pkg_prepare_default &&
	SRC_URL=$LZMASDK_URL MD5SUM=$LZMASDK_MD5SUM TARBALL=$LZMASDK_TARBALL &&
	pkg_prepare_default &&

	# some of these have already been upstreamed but not in release yet.
	#cd tmp/upx-$PKGVER &&
	#tar -xf ../pkg/upx-ucl_3.94-4.debian.tar.xz &&
	#for p in $(cat debian/patches/series); do
	#	patch -Np1 -i debian/patches/$p || return 1
	#done &&
	
	# delete whitespace check line
	#sed -i -e '89d' src/Makefile &&
	true
}

### default pkg_package
### build
pkg_build() {
	cd /tmp/upx-$PKGVER-src &&
	rm -r src/lzma-sdk &&
	mv ../upx-lzma-sdk-$PKGVER src/lzma-sdk &&

	make $MAKEFLAGS all &&
	cp src/upx.out /usr/bin/upx &&
	cp doc/upx.1 /usr/share/man/man1 &&
	
	mkdir -p /usr/share/doc/upx &&
	cp doc/upx.doc doc/upx.html /usr/share/doc/upx/ &&
	pkg_build_slackdesc
}

