commit:     0c13ca36bf039e92078a64b63d84d04949948ef4
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 31 20:28:10 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Mar 31 23:38:44 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0c13ca36

games-misc/bsd-games: add 2.17_p28

Upgrade to new Debian patchset (p28) which may help resolve
some of the open bugs. It's also a nice stopgap because
the new fork upstream drops some games and it means
we don't take as big of a risk when simply
porting away from games.eclass.

(Not dumping games.eclass *AND* choosing a new upstream
all at once, with no option for users to downgrade.)

Bug: https://bugs.gentoo.org/732374
Bug: https://bugs.gentoo.org/537010
Bug: https://bugs.gentoo.org/715778
Signed-off-by: Sam James <sam <AT> gentoo.org>

 games-misc/bsd-games/Manifest                      |   2 +
 games-misc/bsd-games/bsd-games-2.17_p28.ebuild     | 155 +++++++++++++++++++++
 .../bsd-games-2.17-rename-getdate-clash.patch      |  39 ++++++
 3 files changed, 196 insertions(+)

diff --git a/games-misc/bsd-games/Manifest b/games-misc/bsd-games/Manifest
index c48313d617e..2bccdb8acb3 100644
--- a/games-misc/bsd-games/Manifest
+++ b/games-misc/bsd-games/Manifest
@@ -1,2 +1,4 @@
 DIST bsd-games-2.17.tar.gz 2563311 BLAKE2B 
9dfff4e70929e14a422c536c661cd95c5f1ac81d9112494525b9ef13d7a39b66bd59b6a264e614cfb29784fdb63364f56b12b4d284b125b5b3c12e92def07fb0
 SHA512 
cb2ee60474f164d42e3d47700270bbeeda3c8279d64da409c9cc05e36437ef95b92d0a85543298e97604635fcf3e068f3a5cc812e90b5c61fb8d146cf35bc38f
 DIST bsdgames_2.17-22.debian.tar.xz 32268 BLAKE2B 
2485abc1d80b8319c7eb68e2747c0a4166d18079047eca67c1de549cd011f75a767b6fe69021cb4ce09aaf029823a097e6ac658efcab5e19e976a89ed798d06f
 SHA512 
902d86557dd3813c31333fe18437d8046ae100814c9c1b340ab1f8266c817545f21e000702b1ca93babb9d632896ea5bada1e146436abfa7916b469681fceed5
+DIST bsdgames_2.17-28.debian.tar.xz 58464 BLAKE2B 
3f5a70322341b153a8b3cb8df81fea1e773971d0f3b79ba8fb0c0877e95c61c8e8689952333f8ac4263948d781c2dc64c8178f9dac6a1c09ae702f91794b9583
 SHA512 
7e2db9f830c0657f3fcd1371635bda4a87e7a68180e486e44752904740c0710c02271522ff2d4b606542b3c502dd28795fcecf883360c3ac5bea78c148281f6a
+DIST bsdgames_2.17.orig.tar.gz 2563311 BLAKE2B 
9dfff4e70929e14a422c536c661cd95c5f1ac81d9112494525b9ef13d7a39b66bd59b6a264e614cfb29784fdb63364f56b12b4d284b125b5b3c12e92def07fb0
 SHA512 
cb2ee60474f164d42e3d47700270bbeeda3c8279d64da409c9cc05e36437ef95b92d0a85543298e97604635fcf3e068f3a5cc812e90b5c61fb8d146cf35bc38f

diff --git a/games-misc/bsd-games/bsd-games-2.17_p28.ebuild 
b/games-misc/bsd-games/bsd-games-2.17_p28.ebuild
new file mode 100644
index 00000000000..fc382f97d8c
--- /dev/null
+++ b/games-misc/bsd-games/bsd-games-2.17_p28.ebuild
@@ -0,0 +1,155 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit toolchain-funcs flag-o-matic
+
+DEB_PATCH_VER=28
+DESCRIPTION="Collection of games from NetBSD"
+HOMEPAGE="https://www.polyomino.org.uk/computer/software/bsd-games/";
+#SRC_URI="https://www.polyomino.org.uk/computer/software/bsd-games/${PN}-$(ver_cut
 1-2).tar.gz"
+SRC_URI="http://deb.debian.org/debian/pool/main/b/bsdgames/bsdgames_2.17.orig.tar.gz";
+SRC_URI+=" mirror://debian/pool/main/b/bsdgames/bsdgames_$(ver_cut 
1-2)-${DEB_PATCH_VER}.debian.tar.xz"
+S="${WORKDIR}/${PN}-$(ver_cut 1-2)"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~x86"
+
+DEPEND="
+       sys-apps/miscfiles
+       sys-libs/ncurses:0
+       app-misc/banner
+       !games-misc/wtf
+       !games-puzzle/hangman
+"
+RDEPEND="
+       ${DEPEND}
+       acct-group/gamestat
+"
+BDEPEND="
+       sys-devel/bison
+       sys-devel/flex
+       virtual/pkgconfig
+"
+
+# Set GAMES_TO_BUILD variable to whatever you want
+GAMES_TO_BUILD=${GAMES_TO_BUILD:=adventure arithmetic atc
+backgammon banner battlestar bcd boggle caesar canfield countmail cribbage
+dab dm fish gomoku hack hangman hunt mille monop morse
+number phantasia pig pom primes ppt quiz rain random robots sail snake
+tetris trek wargames worm worms wtf}
+
+src_prepare() {
+       local debian_patch_dir="${WORKDIR}"/debian/patches
+       for patch in $(<"${debian_patch_dir}"/series) ; do
+               eapply "${debian_patch_dir}"/${patch}
+       done
+
+       eapply "${FILESDIR}"/${PN}-2.17-64bitutmp.patch
+       eapply -p0 "${FILESDIR}"/${PN}-2.17-bg.patch
+       eapply -p0 "${FILESDIR}"/${PN}-2.17-gcc4.patch
+       eapply "${FILESDIR}"/${PN}-2.17-rename-getdate-clash.patch
+
+       default
+
+       # TODO: Check this?
+       # Used by gentoo config.params. See bug 531200
+
+       # Use pkg-config to query Libs: from ncurses.pc (for eg. -ltinfo) wrt 
#459652
+       sed -i \
+               -e "/ncurses_lib/s:-lncurses:'$($(tc-getPKG_CONFIG) 
--libs-only-l ncurses)':" \
+               configure || die
+
+       sed -i \
+               -e "s:/usr/games:/usr/bin:" \
+               wargames/wargames || die
+
+       sed -i \
+               -e '/^CC :=/d' \
+               -e '/^CXX :=/d' \
+               -e '/^CFLAGS/s/OPTIMIZE/CFLAGS/' \
+               -e '/^CXXFLAGS/s/OPTIMIZE/CXXFLAGS/' \
+               -e '/^LDFLAGS/s/LDFLAGS := /LDFLAGS := \$(LDFLAGS) /' \
+               Makeconfig.in || die
+
+    # export GAMES_BINDIR GAMES_DATADIR GAMES_STATEDIR
+       export GAMES_BINDIR=/usr/bin
+       export GAMES_DATADIR=/usr/share
+       export GAMES_STATEDIR=/var/games
+       cp "${FILESDIR}"/config.params-gentoo config.params || die
+
+       echo bsd_games_cfg_usrlibdir=\"$(get_libdir)\" >> ./config.params || die
+       echo bsd_games_cfg_build_dirs=\"${GAMES_TO_BUILD}\" >> ./config.params 
|| die
+       echo bsd_games_cfg_docdir=\"/usr/share/doc/${PF}\" >> ./config.params 
|| die
+}
+
+src_compile() {
+       tc-export CC CXX
+
+       emake
+}
+
+src_test() {
+       addwrite /dev/full
+       emake -j1 check
+}
+
+src_install() {
+       # TODO: ${PN} or no?
+       dodir /var/games /usr/share/man/man{1,6}
+       emake -j1 DESTDIR="${D}" install
+
+       dodoc AUTHORS BUGS ChangeLog ChangeLog.0 \
+               README PACKAGING SECURITY THANKS TODO YEAR2000
+
+       _build_game() {
+               has ${1} ${GAMES_TO_BUILD}
+       }
+
+       _do_statefile() {
+               touch "${ED}"/var/games/${1} || die
+               chmod ug+rw "${ED}"/var/games/${1} || die
+       }
+
+       # set some binaries to run as games group (+S)
+       _build_game atc && fperms g+s /usr/bin/atc
+       _build_game battlestar && fperms g+s /usr/bin/battlestar
+       _build_game canfield && fperms g+s /usr/bin/canfield
+       _build_game cribbage && fperms g+s /usr/bin/cribbage
+       _build_game phantasia && fperms g+s /usr/bin/phantasia
+       _build_game robots && fperms g+s /usr/bin/robots
+       _build_game sail && fperms g+s /usr/bin/sail
+       _build_game snake && fperms g+s /usr/bin/snake
+       _build_game tetris && fperms g+s /usr/bin/tetris-bsd
+
+       elog "Renaming monop to monop-bsd to avoid collision with dev-lang/mono"
+       mv "${ED}"/usr/bin/monop "${ED}"/usr/bin/monop-bsd || die
+
+       # state files
+       _build_game atc && _do_statefile atc_score
+       _build_game battlestar && _do_statefile battlestar.log
+       _build_game canfield && _do_statefile cfscores
+       _build_game cribbage && _do_statefile criblog
+       _build_game hack && keepdir /var/games/hack
+       _build_game robots && _do_statefile robots_roll
+       _build_game sail && _do_statefile sail/saillog
+       _build_game snake && _do_statefile snake.log && _do_statefile 
snakerawscores
+       _build_game tetris && _do_statefile tetris-bsd.scores
+
+       # extra docs
+       _build_game atc && { docinto atc ; dodoc atc/BUGS; }
+       _build_game boggle && { docinto boggle ; dodoc boggle/README; }
+       _build_game hack && { docinto hack ; dodoc 
hack/{OWNER,Original_READ_ME,READ_ME,help}; }
+       _build_game hunt && { docinto hunt ; dodoc hunt/README; }
+       _build_game phantasia && { docinto phantasia ; dodoc 
phantasia/{OWNER,README}; }
+
+       # All of this needs to be owned by the gamestat group
+       fowners -R :gamestat /var/games/
+       # ... and so do the binaries
+       fowners -R :gamestat /usr/bin/
+
+       # State dirs
+       chmod -R ug+rw "${ED}"/var/games/ || die
+}

diff --git 
a/games-misc/bsd-games/files/bsd-games-2.17-rename-getdate-clash.patch 
b/games-misc/bsd-games/files/bsd-games-2.17-rename-getdate-clash.patch
new file mode 100644
index 00000000000..6cda335d7ae
--- /dev/null
+++ b/games-misc/bsd-games/files/bsd-games-2.17-rename-getdate-clash.patch
@@ -0,0 +1,39 @@
+diff --git a/hack/extern.h b/hack/extern.h
+index e2ef242..7c5085f 100644
+--- a/hack/extern.h
++++ b/hack/extern.h
+@@ -583,7 +583,7 @@ int role_index(int);
+ void setrandom(void);
+ struct tm *getlt(void);
+ int getyear(void);
+-char *getdate(void);
++char *get_date(void);
+ int phase_of_the_moon(void);
+ int night(void);
+ int midnight(void);
+diff --git a/hack/hack.end.c b/hack/hack.end.c
+index 3145fd7..36e4796 100644
+--- a/hack/hack.end.c
++++ b/hack/hack.end.c
+@@ -360,7 +360,7 @@ topten()
+       (t0->name)[NAMSZ] = 0;
+       (void) strncpy(t0->death, killer, DTHSZ);
+       (t0->death)[DTHSZ] = 0;
+-      (void) strcpy(t0->date, getdate());
++      (void) strcpy(t0->date, get_date());
+ 
+       /* assure minimum number of points */
+       if (t0->points < POINTSMIN)
+diff --git a/hack/hack.unix.c b/hack/hack.unix.c
+index 13f9724..ef17788 100644
+--- a/hack/hack.unix.c
++++ b/hack/hack.unix.c
+@@ -118,7 +118,7 @@ getyear()
+ }
+ 
+ char           *
+-getdate()
++get_date()
+ {
+       static char     datestr[7];
+       struct tm      *lt = getlt();

Reply via email to