Github messages for voidlinux
 help / color / mirror / Atom feed
From: sgn <sgn@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: [PR PATCH] Bsd games cross compile
Date: Fri, 03 Apr 2020 11:43:07 +0200	[thread overview]
Message-ID: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-20589@inbox.vuxu.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 316 bytes --]

There is a new pull request by sgn against master on the void-packages repository

https://github.com/sgn/void-packages bsd-games-cross-compile
https://github.com/void-linux/void-packages/pull/20589

Bsd games cross compile


A patch file from https://github.com/void-linux/void-packages/pull/20589.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-bsd-games-cross-compile-20589.patch --]
[-- Type: text/x-diff, Size: 10810 bytes --]

From aa346e688f3503755777e8ba72788760635d3a04 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx+sgn@gmail.com>
Date: Fri, 3 Apr 2020 15:43:10 +0700
Subject: [PATCH 1/4] bsd-games: s/sed/vsed/

---
 srcpkgs/bsd-games/template | 27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/srcpkgs/bsd-games/template b/srcpkgs/bsd-games/template
index 24501b4515f..40a5b226de7 100644
--- a/srcpkgs/bsd-games/template
+++ b/srcpkgs/bsd-games/template
@@ -39,21 +39,20 @@ patch_args="-Np1"
 nocross=yes
 
 post_extract() {
-	sed -i "s/FISH/GO-FISH/g; s/\.Nm fish/\.Nm go-fish/g" fish/fish.6
-	sed -i "s/tenths/tenth/g" tests/number.-0.1
-	sed -i "s/Elegy{ Written in a Country Church{-| }Yard:/Elegy{ Written in a Country Church{-| }Yard}:/g" quiz/datfiles/poetry
-	sed -i "s/\.tI friend/\.It friend/g" hunt/hunt/hunt.6.in
-	sed -i "s/it\'s initial/its initial/g" backgammon/teachgammon/ttext1.c
-	sed -i "s/two player\'s/two players/g" backgammon/teachgammon/ttext2.c
-	sed -i  "s/\.I range/\.It range/g" arithmetic/arithmetic.6
-	sed -i "s/game were the/game where the/g" gomoku/gomoku.6
-	sed -i 's|/usr/games|/usr/bin|g' wargames/wargames
+	vsed -i "s/FISH/GO-FISH/g; s/\.Nm fish/\.Nm go-fish/g" fish/fish.6
+	vsed -i "s/tenths/tenth/g" tests/number.-0.1
+	vsed -i "s/Elegy{ Written in a Country Church{-| }Yard:/Elegy{ Written in a Country Church{-| }Yard}:/g" quiz/datfiles/poetry
+	vsed -i "s/\.tI friend/\.It friend/g" hunt/hunt/hunt.6.in
+	vsed -i  "s/\.I range/\.It range/g" arithmetic/arithmetic.6
+	vsed -i "s/game were the/game where the/g" gomoku/gomoku.6
+	vsed -i 's|/usr/games|/usr/bin|g' wargames/wargames
 
-	sed -i '1i#include <sys/types.h>' banner/banner.c
-	sed -i 's/getdate/get_date/g' hack/*.[ch]
-	sed -i '1i#include <fcntl.h>' wump/wump.c
-	sed -i 's/-DOTTO//' hunt/Makeconfig
+	vsed -i '1i#include <sys/types.h>' banner/banner.c
+	vsed -i 's/getdate/get_date/g' hack/extern.h hack/hack.{end,unix}.c
+	vsed -i '1i#include <fcntl.h>' wump/wump.c
+	vsed -i 's/-DOTTO//' hunt/Makeconfig
 }
+
 pre_configure() {
 	cp ${FILESDIR}/config.params .
 	echo "bsd_games_cfg_cc='$CC'" >>config.params
@@ -61,6 +60,7 @@ pre_configure() {
 	echo "bsd_games_cfg_other_cflags='$CFLAGS'" >>config.params
 	echo "bsd_games_cfg_other_ldflags='$LDFLAGS'" >>config.params
 }
+
 do_install() {
 	echo >install-score
 	sed -i "s|PKGDIR|$DESTDIR|g" hide-game install-man install-score Makeconfig subst.sed
@@ -74,4 +74,3 @@ do_install() {
 	rm "${DESTDIR}/usr/share/doc/trek.me"
 	vlicense COPYING
 }
-

From e24117d64d813c45f622d49ad18eaf777c036271 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx+sgn@gmail.com>
Date: Fri, 3 Apr 2020 16:40:28 +0700
Subject: [PATCH 2/4] bsd-games: configure DESTDIR by config.params

---
 srcpkgs/bsd-games/files/config.params | 1 -
 srcpkgs/bsd-games/template            | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/srcpkgs/bsd-games/files/config.params b/srcpkgs/bsd-games/files/config.params
index e2cd8dc4563..b4221a21510 100644
--- a/srcpkgs/bsd-games/files/config.params
+++ b/srcpkgs/bsd-games/files/config.params
@@ -1,5 +1,4 @@
 bsd_games_cfg_non_interactive=y
-bsd_games_cfg_install_prefix=PKGDIR
 bsd_games_cfg_no_build_dirs='fortune factor wtf monop dm'
 bsd_games_cfg_gamesdir=/usr/bin
 bsd_games_cfg_sbindir=/usr/bin
diff --git a/srcpkgs/bsd-games/template b/srcpkgs/bsd-games/template
index 40a5b226de7..3b8e07fedaf 100644
--- a/srcpkgs/bsd-games/template
+++ b/srcpkgs/bsd-games/template
@@ -59,11 +59,11 @@ pre_configure() {
 	echo "bsd_games_cfg_cxx='$CXX'" >>config.params
 	echo "bsd_games_cfg_other_cflags='$CFLAGS'" >>config.params
 	echo "bsd_games_cfg_other_ldflags='$LDFLAGS'" >>config.params
+	echo "bsd_games_cfg_install_prefix='$DESTDIR'" >>config.params
 }
 
 do_install() {
 	echo >install-score
-	sed -i "s|PKGDIR|$DESTDIR|g" hide-game install-man install-score Makeconfig subst.sed
 	make install
 
 	# Remove conflict with fish-shell

From 1124059dbccce0a7027861cc75de33ac58c41ea8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx+sgn@gmail.com>
Date: Fri, 3 Apr 2020 15:44:35 +0700
Subject: [PATCH 3/4] bsd-games: fix musl build

---
 srcpkgs/bsd-games/template | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/srcpkgs/bsd-games/template b/srcpkgs/bsd-games/template
index 3b8e07fedaf..48d25814c09 100644
--- a/srcpkgs/bsd-games/template
+++ b/srcpkgs/bsd-games/template
@@ -38,6 +38,10 @@ mutable_files="/var/games/bsdgames/atc_score
 patch_args="-Np1"
 nocross=yes
 
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	makedepends+=" musl-legacy-compat"
+fi
+
 post_extract() {
 	vsed -i "s/FISH/GO-FISH/g; s/\.Nm fish/\.Nm go-fish/g" fish/fish.6
 	vsed -i "s/tenths/tenth/g" tests/number.-0.1

From f4b76f01e3f788abdf1fef4f50bb79c0eca17d75 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx+sgn@gmail.com>
Date: Fri, 3 Apr 2020 16:42:39 +0700
Subject: [PATCH 4/4] bsd-games: fix cross-compile

---
 srcpkgs/bsd-games/patches/cross.patch | 86 +++++++++++++++++++++++++++
 srcpkgs/bsd-games/template            | 35 +++++++++--
 2 files changed, 117 insertions(+), 4 deletions(-)
 create mode 100644 srcpkgs/bsd-games/patches/cross.patch

diff --git a/srcpkgs/bsd-games/patches/cross.patch b/srcpkgs/bsd-games/patches/cross.patch
new file mode 100644
index 00000000000..947f6443a84
--- /dev/null
+++ b/srcpkgs/bsd-games/patches/cross.patch
@@ -0,0 +1,86 @@
+diff --git a/adventure/Makefrag b/adventure/Makefrag
+index 64bc7e2..ee02de8 100644
+--- a/adventure/Makefrag
++++ b/adventure/Makefrag
+@@ -28,11 +28,12 @@
+ 
+ adventure_CLEANFILES := data.c
+ adventure_DIRS := $(GAMESDIR) $(MAN6DIR)
++ADVENTURE_SETUP = adventure/setup
+ 
+ adventure_all:	adventure/adventure adventure/adventure.6
+ 
+ adventure/data.c:	adventure/glorkz adventure/setup
+-	adventure/setup $< >$@
++	$(ADVENTURE_SETUP) $< >$@
+ 
+ adventure_install:	adventure_all
+ 	$(INSTALL_BINARY) adventure/adventure $(INSTALL_PREFIX)$(GAMESDIR)/adventure
+diff --git a/boggle/mkdict/Makefrag b/boggle/mkdict/Makefrag
+index 3e27969..1556e72 100644
+--- a/boggle/mkdict/Makefrag
++++ b/boggle/mkdict/Makefrag
+@@ -34,9 +34,10 @@ boggle_mkdict_DICTSRC := $(DICTIONARY_SRC)
+ 
+ boggle_mkdict_DIRS := $(BOGGLE_DIR)
+ boggle_mkdict_INCS := -Iboggle/boggle
++BOGGLE_MKDICT_MKDICT = boggle/mkdict/mkdict
+ 
+ boggle/mkdict/dictionary:	boggle/mkdict/mkdict $(boggle_mkdict_DICTSRC)
+-	$< <$(boggle_mkdict_DICTSRC) >$@
++	$(BOGGLE_MKDICT_MKDICT) <$(boggle_mkdict_DICTSRC) >$@
+ 
+ boggle_mkdict_all:	boggle/mkdict/dictionary
+ 
+diff --git a/boggle/mkindex/Makefrag b/boggle/mkindex/Makefrag
+index 5d406b3..08afad7 100644
+--- a/boggle/mkindex/Makefrag
++++ b/boggle/mkindex/Makefrag
+@@ -29,9 +29,10 @@
+ boggle_mkindex_CLEANFILES := dictindex
+ boggle_mkindex_DIRS := $(BOGGLE_DIR)
+ boggle_mkindex_INCS := -Iboggle/boggle
++BOGGLE_MKINDEX_MKINDEX = boggle/mkindex/mkindex
+ 
+ boggle/mkindex/dictindex:	boggle/mkindex/mkindex boggle/mkdict/dictionary
+-	$< <boggle/mkdict/dictionary >$@
++	$(BOGGLE_MKINDEX_MKINDEX) <boggle/mkdict/dictionary >$@
+ 
+ boggle_mkindex_all:	boggle/mkindex/dictindex
+ 
+diff --git a/hack/Makefrag b/hack/Makefrag
+index eabbd2a..bc4388b 100644
+--- a/hack/Makefrag
++++ b/hack/Makefrag
+@@ -29,11 +29,12 @@
+ hack_DIRS := $(GAMESDIR) $(MAN6DIR)
+ 
+ hack_CLEANFILES := hack.onames.h
++HACK_MAKEDEFS = hack/makedefs
+ 
+ hack_all:	hack/hack hack/hack.6
+ 
+ hack/hack.onames.h:	hack/def.objects.h hack/makedefs
+-	hack/makedefs $< >$@
++	$(HACK_MAKEDEFS) $< >$@
+ 
+ hack/alloc.d hack/hack.Decl.d hack/hack.apply.d hack/hack.bones.d \
+ hack/hack.d hack/hack.cmd.d hack/hack.do.d hack/hack.do_name.d \
+diff --git a/phantasia/Makefrag b/phantasia/Makefrag
+index 96c3e6a..a041d45 100644
+--- a/phantasia/Makefrag
++++ b/phantasia/Makefrag
+@@ -30,11 +30,12 @@ phantasia_DIRS := $(GAMESDIR) $(MAN6DIR) $(PHANTASIA_DIR)
+ phantasia_VFILES1 := gold lastdead mess monsters motd void
+ phantasia_VFILES2 := scoreboard characs
+ phantasia_CLEANFILES := $(phantasia_VFILES1) $(phantasia_VFILES2) scorefiles.stamp
++PHANTASIA_SETUP = ./setup
+ 
+ phantasia_all:	phantasia/phantasia phantasia/phantasia.6 phantasia/scorefiles.stamp
+ 
+ phantasia/scorefiles.stamp: phantasia/setup phantasia/monsters.asc
+-	cd phantasia && ./setup -m monsters.asc
++	cd phantasia && $(PHANTASIA_SETUP) -m monsters.asc
+ 	touch phantasia/scorefiles.stamp
+ 
+ phantasia_install:	phantasia_all
diff --git a/srcpkgs/bsd-games/template b/srcpkgs/bsd-games/template
index 48d25814c09..6a641a540bb 100644
--- a/srcpkgs/bsd-games/template
+++ b/srcpkgs/bsd-games/template
@@ -7,8 +7,8 @@ make_dirs="
  /var/games/bsdgames/hack 0775 root users
  /var/games/bsdgames/hack/save 0775 root users
  /var/games/bsdgames/phantasia 0775 root users"
-hostmakedepends="flex words-en"
-makedepends="ncurses-devel"
+hostmakedepends="flex words-en ncurses-devel"
+makedepends="ncurses-devel libfl-devel"
 depends="words-en"
 short_desc="Linux port for a collection of BSD command line games"
 maintainer="Leah Neukirchen <leah@vuxu.org>"
@@ -36,7 +36,22 @@ mutable_files="/var/games/bsdgames/atc_score
  /var/games/bsdgames/hack/record
  /var/games/bsdgames/hack/perm"
 patch_args="-Np1"
-nocross=yes
+
+if [ "$CROSS_BUILD" ]; then
+	local _file _var
+	_native_target="adventure/setup boggle/mkdict/mkdict boggle/mkindex/mkindex
+		hack/makedefs"
+	for _file in $_native_target; do
+		_var=${_file//\//_}
+		make_build_args+=" ${_var^^}=native/$_file"
+	done
+	_native_target+=" phantasia/setup"
+	make_build_args+=" PHANTASIA_SETUP=../native/phantasia/setup"
+fi
+
+if [ "$XBPS_LIBC" = musl ]; then
+	hostmakedepends+=" musl-legacy-compat"
+fi
 
 if [ "$XBPS_TARGET_LIBC" = musl ]; then
 	makedepends+=" musl-legacy-compat"
@@ -59,6 +74,18 @@ post_extract() {
 
 pre_configure() {
 	cp ${FILESDIR}/config.params .
+	if [ "$CROSS_BUILD" ]; then
+		mkdir -p native
+		cp -a * native 2>/dev/null || true
+		pushd native
+		echo "bsd_games_cfg_cc='$CC_FOR_BUILD'" >>config.params
+		echo "bsd_games_cfg_cxx='$CXX_FOR_BUILD'" >>config.params
+		echo "bsd_games_cfg_other_cflags='$CFLAGS_FOR_BUILD'" >>config.params
+		echo "bsd_games_cfg_other_ldflags='$LDFLAGS_FOR_BUILD'" >>config.params
+		./configure
+		make $_native_target
+		popd
+	fi
 	echo "bsd_games_cfg_cc='$CC'" >>config.params
 	echo "bsd_games_cfg_cxx='$CXX'" >>config.params
 	echo "bsd_games_cfg_other_cflags='$CFLAGS'" >>config.params
@@ -68,7 +95,7 @@ pre_configure() {
 
 do_install() {
 	echo >install-score
-	make install
+	make $make_build_args install
 
 	# Remove conflict with fish-shell
 	mv "${DESTDIR}/usr/bin/fish" "${DESTDIR}/usr/bin/go-fish"

             reply	other threads:[~2020-04-03  9:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-03  9:43 sgn [this message]
2020-04-07 16:14 ` [PR PATCH] [Merged]: " xtraeme

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-20589@inbox.vuxu.org \
    --to=sgn@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).