void-packages/srcpkgs/fortune-mod/template
Đoàn Trần Công Danh e1f38607ff fortune-mod: fix cross compile
Also bump revision to ship LICENSE file according to BSD requirements.
2020-02-13 15:24:21 +01:00

39 lines
1.3 KiB
Bash

# Template file for 'fortune-mod'
pkgname=fortune-mod
version=1.99.1
revision=5
hostmakedepends="recode"
makedepends="recode-devel"
short_desc="Implementation of the BSDGames 'fortune' program"
maintainer="Tj Vanderpoel (bougyman) <tj@rubyists.com>"
license="BSD-4-Clause-UC"
homepage="http://www.redellipse.net/code/fortune"
distfiles="${DEBIAN_SITE}/main/f/fortune-mod/${pkgname}_${version}.orig.tar.gz"
checksum=fc51aee1f73c936c885f4e0f8b6b48f4f68103e3896eaddc6a45d2b71e14eace
patch_args=-Np1
if [ "$CROSS_BUILD" ]; then
hostmakedepends+=" fortune-mod"
_strfile="STRFILE=/usr/bin/strfile"
fi
do_build() {
sed -i "s|^CFLAGS=.*|CFLAGS=${CFLAGS} -fsigned-char \$(DEFINES)|" Makefile
sed -i "s|^LDFLAGS=.*|LDFLAGS=${LDFLAGS}|" Makefile
sed -i "s;u_int;uint;" util/strfile.h
case "$XBPS_TARGET_MACHINE" in
*-musl)
cp ${FILESDIR}/error.{c,h} ${wrksrc}/fortune
sed -e "s;-DBSD_REGEX;-DPOSIX_REGEX;" -i Makefile
sed -e "s;fortune\.o;fortune.o error.o;" -i fortune/Makefile
esac
make CC=$CC COOKIEDIR=/usr/share/fortunes $_strfile
sed -n '/[*][[:space:]]*The Regents/,/SUCH DAMAGE/p' fortune/fortune.c |
sed -e 's/^ [*][[:space:]]\?//' >LICENSE
}
do_install() {
make prefix=${DESTDIR} FORTDIR=${DESTDIR}/usr/bin \
COOKIEDIR=$DESTDIR/usr/share/fortunes \
install
vlicense LICENSE
}