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

# source: james
TARBALL=haveged-master-20181106.tar.gz # this is version 1.9.4
MD5SUM=c38242b96767b27046236b6d7f61cba8
SRC_URL=http://distro.ibiblio.org/fatdog/source/800/$TARBALL
BUNDLE=

SLACKREQ=
SLACKDESC="haveged: haveged $PKGVER (Entropy generator)
haveged: 
haveged: havaged it an entropy RNG based on HAVEGE algorithm. The purpose is 
haveged: to remedy entropy starvation on /dev/random on some systems without 
haveged: hardware RNG (e.g virtual machines)
haveged: 
haveged: https://issihosts.com/haveged/
haveged: https://github.com/jirka-h/haveged
haveged: 
haveged: 
haveged: 
"

STATIC_BUILD= # yes to enable

### default pkg_download
### default pkg_prepare
### default pkg_package
### build
pkg_build() {
	if [ $STATIC_BUILD ]; then
		# static build is 10x the size (20K vs ~200K, but run time memory is 3x less)
		# plus we got to keep the library
		CONFFLAGS="$CONFFLAGS --disable-shared"
		export CC="musl-gcc -static" CFLAGS="$CFLAGS -I/usr/musl/kernel/include"
	else
		CONFFLAGS="$CONFFLAGS --disable-static"
	fi

	pkg_build_autoconf &&
	pkg_build_slackdesc &&

	if [ $STATIC_BUILD ]; then
		rm -rf /usr/include/haveged /usr/share/man/man3/libhavege.3 /usr/$LIBDIR/libhavege.a
	fi &&

	# init script
	mkdir -p /etc/init.d &&
	install -m 644 /tmp/pkg/00-haveged /etc/init.d &&
	install -m 755 /tmp/pkg/00-haveged-boot /etc/init.d
}
 
