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?= 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 ' banner/banner.c - sed -i 's/getdate/get_date/g' hack/*.[ch] - sed -i '1i#include ' wump/wump.c - sed -i 's/-DOTTO//' hunt/Makeconfig + vsed -i '1i#include ' banner/banner.c + vsed -i 's/getdate/get_date/g' hack/extern.h hack/hack.{end,unix}.c + vsed -i '1i#include ' 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?= 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?= 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?= 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_MKINDEX_MKINDEX) $@ + + 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 " @@ -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"