From e1f38607ff772f7936497b759cdc3d245e93bfb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= Date: Thu, 13 Feb 2020 16:38:24 +0700 Subject: [PATCH] fortune-mod: fix cross compile Also bump revision to ship LICENSE file according to BSD requirements. --- srcpkgs/fortune-mod/patches/cross.patch | 33 +++++++++++++++++++++++++ srcpkgs/fortune-mod/template | 18 +++++++++++--- 2 files changed, 47 insertions(+), 4 deletions(-) create mode 100644 srcpkgs/fortune-mod/patches/cross.patch diff --git a/srcpkgs/fortune-mod/patches/cross.patch b/srcpkgs/fortune-mod/patches/cross.patch new file mode 100644 index 00000000000..02a852e04c8 --- /dev/null +++ b/srcpkgs/fortune-mod/patches/cross.patch @@ -0,0 +1,33 @@ +--- a/datfiles/off/Makefile ++++ b/datfiles/off/Makefile +@@ -9,7 +9,7 @@ OCOOKIES_ROTATED= + OCOOKIES=$(OCOOKIES_UNROTATED) $(OCOOKIES_ROTATED) + + STRFILE=../../util/strfile +-ROT=../../util/rot ++ROT=../../util/rot_for_build + + + all: ocookies-stamp +diff --git a/util/Makefile b/util/Makefile +index 6356e4f..0f1b35a 100644 +--- a/util/Makefile ++++ b/util/Makefile +@@ -5,7 +5,7 @@ + # and make install-uman. make clean will work properly if called in + # this directory. + +-all: strfile unstr rot ++all: strfile unstr rot rot_for_build + + strfile: strfile.o + $(CC) $(LDFLAGS) -o strfile strfile.o +@@ -19,5 +19,8 @@ randstr: randstr.o + rot: rot.o + $(CC) -fsigned-char $(LDFLAGS) -o rot rot.o + ++rot_for_build: ++ $(CC_FOR_BUILD) -fsigned-char $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o rot_for_build rot.c ++ + clean: + rm -f *.o unstr strfile randstr rot ansify diff --git a/srcpkgs/fortune-mod/template b/srcpkgs/fortune-mod/template index 10515f073d9..0eb27936c07 100644 --- a/srcpkgs/fortune-mod/template +++ b/srcpkgs/fortune-mod/template @@ -1,7 +1,7 @@ # Template file for 'fortune-mod' pkgname=fortune-mod version=1.99.1 -revision=4 +revision=5 hostmakedepends="recode" makedepends="recode-devel" short_desc="Implementation of the BSDGames 'fortune' program" @@ -10,7 +10,12 @@ 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 -nocross=yes +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 @@ -22,8 +27,13 @@ do_build() { 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 + 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 + make prefix=${DESTDIR} FORTDIR=${DESTDIR}/usr/bin \ + COOKIEDIR=$DESTDIR/usr/share/fortunes \ + install + vlicense LICENSE }