summaryrefslogtreecommitdiff
path: root/games-misc/bsd-games
diff options
context:
space:
mode:
Diffstat (limited to 'games-misc/bsd-games')
-rw-r--r--games-misc/bsd-games/Manifest18
-rw-r--r--games-misc/bsd-games/bsd-games-2.17-r5.ebuild132
-rw-r--r--games-misc/bsd-games/bsd-games-2.17_p28-r1.ebuild153
-rw-r--r--games-misc/bsd-games/bsd-games-3.1-r1.ebuild157
-rw-r--r--games-misc/bsd-games/files/bsd-games-2.17-64bitutmp.patch4
-rw-r--r--games-misc/bsd-games/files/bsd-games-2.17-bg.patch4
-rw-r--r--games-misc/bsd-games/files/bsd-games-2.17-gcc4.patch8
-rw-r--r--games-misc/bsd-games/files/bsd-games-2.17-headers.patch16
-rw-r--r--games-misc/bsd-games/files/bsd-games-2.17-rename-getdate-clash.patch33
-rw-r--r--games-misc/bsd-games/files/bsd-games-3.1-no-install-manpages-automatically.patch13
10 files changed, 375 insertions, 163 deletions
diff --git a/games-misc/bsd-games/Manifest b/games-misc/bsd-games/Manifest
index f4a90198b77c..9b4748f8b5a3 100644
--- a/games-misc/bsd-games/Manifest
+++ b/games-misc/bsd-games/Manifest
@@ -1,9 +1,13 @@
-AUX bsd-games-2.17-64bitutmp.patch 681 BLAKE2B 2ef7ad184787ecab40e3082992bfb562be4477dfe331f2ab68e93f619f9cf5b1ee33b8d4f2b342c44f8a22d19c51b341557670c9bebb5fe827f6fbfd601b99c1 SHA512 ba5a261950bd0f5f5b6aae0ee961a84f06bc6b68504c859db387d9c32875cb4f849c555c56c52f66b00af85d44d9a2324a2d1cccc6811acf6f980cefe9508258
-AUX bsd-games-2.17-bg.patch 732 BLAKE2B 84e76aa2d3e6eeb34b92140adb2cfb1ca6ad1ad23a1261225277d3cc439e98d70ba4e93af5d44e080c71bb4c62c906b68a872191c09aedb93345949b9db512a9 SHA512 006ce0aa632c1ff671bc98584307fcfabed62e81a4680271fcbbaebf93e0f6f7c89cb1fbe311ffa472facd02991c456ced6b198c02753958b1178aa9ef16d8ba
-AUX bsd-games-2.17-gcc4.patch 893 BLAKE2B 54eb6b43592d83dd40c8e00e82438e3cbd818f2fc61cd121f0e9a3c555e57505668946bc6033f799791da96484ec834379ca657640b8541c4ba5b394fcc87070 SHA512 fca57d3887f202b973bf5c03eb0d9a8e62a0ef8f746ccec0cb6e3ad2494bdf1208a1a8833bd3b762281289802b8c58d90cab62fe2642915acaf1ff87233329c5
-AUX bsd-games-2.17-headers.patch 268 BLAKE2B e3b1761e4373e2ed22c3a4b1d31e30f5af8ecd16de8c33bee0f02aa988f5e8dad78395d786a55214ef9f714864723f71ea3913bb832b3fd322bbcc0f8ab01040 SHA512 cc7c62109e835b31db0dfbb84de35fcb962bebee04b901c727b7ff087c194bfb12e4edac6b7e2f3ca0e414bd486c18962e8f5ad1f33a997e2782f58b9b62469f
+AUX bsd-games-2.17-64bitutmp.patch 665 BLAKE2B 1513cb2d08d4749dd20da92664349db25df1833538c6c1494e4f3edeb6ca78290ee0428013212667755ffd02196ae0ae410aafac5ed38867fcb95d59bdc5cc96 SHA512 5f16bbd2538add0f67fdabf108ea6677cd3745b7acc50dd5e4c8b4de9132174a644825239d730a5a5e7bef00a4521e009f5d81f334337b561f446ac6da867e4d
+AUX bsd-games-2.17-bg.patch 660 BLAKE2B 7852051346beb6c33ef0728a64570a8a02c3883e7dd2daa2711d4b83737eb1bc7f4d38484a7365462dd7a275183473317403bc427874149c922917546884fcac SHA512 31584681cfca28e020b8216d8ceafeda1bd37c3fb24d730a05c1aeceb85a49f1dc9e42c61c69247900c18ef31cf0e9db8550184dbb994088afb5a60ace7f700a
+AUX bsd-games-2.17-gcc4.patch 747 BLAKE2B ce3fdad6643efd29c5dd63e82241b5e2f209a682cebed2e696791580491c275c739c2e82e24469fb6efe26e75204bb7ad368db393f27f2beeb58d79f7d2903a7 SHA512 3ac710726807d2893befd0a3ef24ca9d329123c79b68880c2cb18ca4ccd63ceaaf7cf798d77b1026a440e4ed4e6de9d4745d0f5d6b4280a6c963d9b397b398f7
+AUX bsd-games-2.17-rename-getdate-clash.patch 767 BLAKE2B 164e73f598583f46df09b3b5f8651839d4fe878cd57a84830fc25596ae1b9752b0a6b1f7eee13f57b6e06101105a85114fb0574bc4491e7171205fc703460454 SHA512 50338cda948f4186ab9a6590b7177cce74c466a4098b06b396f893e1c63281f99e14a968ae38ce739148a4aeb930dcba2e9ee8ee7689174d14aad4c1f626ff2b
+AUX bsd-games-3.1-no-install-manpages-automatically.patch 295 BLAKE2B e0c02a1fda3a79e6263a52a2155075b286239ac58da3b84bab14d1e3c203806b75928968e89db80f02661011b19ee12758e6f2c6a848661ef7219ee704ca6d59 SHA512 266f523c7bdf46599f99f3bbbf728705a7fa6fbf71548033198dd361468dfe5e233e40c975235b166a099cba5fa4fe0fa88b05825935c3449c2c7e5f884198fd
AUX config.params-gentoo 1204 BLAKE2B 638b52df3c92928a78a0e0833c2bc84a76906144b36d5a6b3523f4de24452aeeab355268afadb9d32933e5c0c19ab4145062bf3968a9d440af1a659a403b32c4 SHA512 b6734409235caec3deb531bbcdb37527b3090c41b803ccc11895ea403543722437f84bdfa044c6aa70b306384ce94a40979a347e6031bc1d937841c7222d6618
-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
-EBUILD bsd-games-2.17-r5.ebuild 4367 BLAKE2B b8c622107c70c26e540a780ffbf6ba2f8a2e993967425a2a42ff8cffb213935aa0ddbbff8ade6e856506afc57279a413a8a02784cda16d6484caf6f5bdbaa6db SHA512 c928e89b3a53484636946e5042f815c7ebd732012ff056ec7996e7d50167e5c798a111abf88ae6aa0ffd77bc03f1217cc25a9170644b991cc639bba192a625c6
+DIST bsd-games-3.1-verbose-build.patch.gz 4633 BLAKE2B cc75175ac2ef9d476c03bdb08b8c054d13090d6cdd1a14dd44022d13290112c68a7663d0c03f9ca7535ea10f2bb5e49a84acca4f782f0ced59685f762efd5151 SHA512 120c0859bb73a026dae017bcc2bc7505ca156b454bf5f87c91b4887417d5ac62f3dec706af91b22b11be8b5bce11d168f9205d722a9fd30dea654f682a66b1c8
+DIST bsd-games-3.1.tar.gz 267636 BLAKE2B 116b340e383430fc56e9d2379a398494b43664aa124157bfa01f2c6a76ebdc90128cc676abae83b6d74680b0ad9396d24f1c0d11adcff1f552a3e68717b8cc8f SHA512 3f311e89481913b734a21fc7d0765628637af8251228d5a38349c27cc702c307240e81711785bbd7428e208a142bd07597630d29e97e2c7bf5bd9cac1ebc6ada
+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
+EBUILD bsd-games-2.17_p28-r1.ebuild 4691 BLAKE2B 48957fd49d61fc12cb118ef1b63adfd7eba179754431f574f8d1638349a33d41b5b8660406879b77618829999b6d7b48e6f55aa972e53113ead0d3eef4c96a25 SHA512 c1708121adaa36105ae2d528b059d9bd5d46e387b295b029bd2bbea51e3e7a25e39d3acb4a8bb220ce0537ef5a4d6f7868ad15e35ddc8f2cc751d7e36525b97a
+EBUILD bsd-games-3.1-r1.ebuild 4649 BLAKE2B b22be924f94aff44fab7968a74ed9773ba8f8e687eb4ac8fa6232752f613dd29164f55ec01ac8c368d314360c5f06a1e81289c675b46bab7d4cc939faa4074c2 SHA512 45e47481b2057c436b9f8a72e7246d1f992e30bc376ad2a0ac69d14f9b6fdf33bea3278abab7ba02ffbeddaf86b9b9c2d43a68c475389abe07e17db64a545f87
MISC metadata.xml 326 BLAKE2B 264f08d8e1036db642114667e4dd07d5b4212b85c0254c55e2a0ec541b408f7129322dc133cc0bd875714e1535699d067fe0b625048b14ba002744e7269c4b6d SHA512 6e4e98607587faadf0aae1ba28287c2e694ef629b6ce915db751427f8f46c425e7aa120ef5fc978b2a0e4d4e33ad1cb0b0e136b0a0641c555f6471a8c286ccf5
diff --git a/games-misc/bsd-games/bsd-games-2.17-r5.ebuild b/games-misc/bsd-games/bsd-games-2.17-r5.ebuild
deleted file mode 100644
index 6679e61b5fc7..000000000000
--- a/games-misc/bsd-games/bsd-games-2.17-r5.ebuild
+++ /dev/null
@@ -1,132 +0,0 @@
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=5
-inherit eutils toolchain-funcs games
-
-DEB_PATCH_VER=22
-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/${P}.tar.gz
- mirror://debian/pool/main/b/bsdgames/bsdgames_${PV}-${DEB_PATCH_VER}.debian.tar.xz"
-
-LICENSE="BSD"
-SLOT="0"
-KEYWORDS="~alpha ~amd64 ~x86"
-IUSE=""
-
-RDEPEND="!games-misc/wtf
- !app-misc/banner
- !games-puzzle/hangman
- sys-libs/ncurses:0
- sys-apps/miscfiles"
-DEPEND="${RDEPEND}
- sys-devel/flex
- sys-devel/bison
- 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 factor fish gomoku hack hangman hunt mille monop morse
-number phantasia pig pom ppt primes quiz rain random robots sail snake
-tetris trek wargames worm worms wtf}
-
-src_prepare() {
- local d="${WORKDIR}"/debian/patches
- EPATCH_SOURCE="${d}" epatch $(<"${d}"/series)
-
- # Used by gentoo config.params. See bug 531200
- export GAMES_BINDIR GAMES_DATADIR GAMES_STATEDIR
-
- epatch \
- "${FILESDIR}"/${P}-64bitutmp.patch \
- "${FILESDIR}"/${P}-headers.patch \
- "${FILESDIR}"/${P}-bg.patch \
- "${FILESDIR}"/${P}-gcc4.patch
-
- # 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:${GAMES_BINDIR}:" \
- 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
-
- cp "${FILESDIR}"/config.params-gentoo config.params || die
- echo bsd_games_cfg_usrlibdir=\"$(games_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_test() {
- addwrite /dev/full
- emake -j1 check
-}
-
-build_game() {
- has ${1} ${GAMES_TO_BUILD}
-}
-
-do_statefile() {
- touch "${D}/${GAMES_STATEDIR}/${1}" || die
- chmod ug+rw "${D}/${GAMES_STATEDIR}/${1}" || die
-}
-
-src_install() {
- dodir "${GAMES_BINDIR}" "${GAMES_STATEDIR}" /usr/share/man/man{1,6}
- emake -j1 DESTDIR="${D}" install
-
- dodoc AUTHORS BUGS ChangeLog ChangeLog.0 \
- README PACKAGING SECURITY THANKS TODO YEAR2000
-
- # set some binaries to run as games group (+S)
- build_game atc && fperms g+s "${GAMES_BINDIR}"/atc
- build_game battlestar && fperms g+s "${GAMES_BINDIR}"/battlestar
- build_game canfield && fperms g+s "${GAMES_BINDIR}"/canfield
- build_game cribbage && fperms g+s "${GAMES_BINDIR}"/cribbage
- build_game phantasia && fperms g+s "${GAMES_BINDIR}"/phantasia
- build_game robots && fperms g+s "${GAMES_BINDIR}"/robots
- build_game sail && fperms g+s "${GAMES_BINDIR}"/sail
- build_game snake && fperms g+s "${GAMES_BINDIR}"/snake
- build_game tetris && fperms g+s "${GAMES_BINDIR}"/tetris-bsd
-
- # 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 "${GAMES_STATEDIR}"/hack
- build_game robots && do_statefile robots_roll
- build_game sail && do_statefile 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}; }
-
- # Since factor is usually not installed, and primes.6 is a symlink to
- # factor.6, make sure that primes.6 is ok ...
- if build_game primes && [[ ! $(build_game factor) ]] ; then
- rm -f "${D}"/usr/share/man/man6/{factor,primes}.6
- newman factor/factor.6 primes.6
- fi
-
- prepgamesdirs
-
- # state dirs
- chmod -R ug+rw "${D}/${GAMES_STATEDIR}"/* || die
-}
diff --git a/games-misc/bsd-games/bsd-games-2.17_p28-r1.ebuild b/games-misc/bsd-games/bsd-games-2.17_p28-r1.ebuild
new file mode 100644
index 000000000000..c98a641fd78d
--- /dev/null
+++ b/games-misc/bsd-games/bsd-games-2.17_p28-r1.ebuild
@@ -0,0 +1,153 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit toolchain-funcs
+
+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
+
+ # Additional patches on top of Debian patchset
+ eapply "${FILESDIR}"/${PN}-2.17-64bitutmp.patch
+ eapply "${FILESDIR}"/${PN}-2.17-bg.patch
+ eapply "${FILESDIR}"/${PN}-2.17-gcc4.patch
+ eapply "${FILESDIR}"/${PN}-2.17-rename-getdate-clash.patch
+
+ default
+
+ # 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
+
+ # Used by config.params
+ 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/bsd-games-3.1-r1.ebuild b/games-misc/bsd-games/bsd-games-3.1-r1.ebuild
new file mode 100644
index 000000000000..5c2e6fdd1312
--- /dev/null
+++ b/games-misc/bsd-games/bsd-games-3.1-r1.ebuild
@@ -0,0 +1,157 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit toolchain-funcs
+
+DESCRIPTION="collection of games from NetBSD"
+HOMEPAGE="https://www.polyomino.org.uk/computer/software/bsd-games/"
+SRC_URI="https://github.com/msharov/bsd-games/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"
+SRC_URI+=" https://dev.gentoo.org/~sam/distfiles/${CATEGORY}/${PN}/${P}-verbose-build.patch.gz"
+
+LICENSE="BSD"
+# Subslot indicates the fork / new version
+# 3 doesn't include the same games as the classic variant, etc
+SLOT="0/3"
+KEYWORDS="~amd64"
+
+# 'check' target doesn't exist, nor do any actual tests
+# bug #779649
+RESTRICT="test"
+
+DEPEND="
+ sys-apps/miscfiles
+ sys-libs/ncurses:=
+ !games-misc/wtf
+ !app-misc/banner
+ !games-puzzle/hangman
+ !games-misc/wumpus
+"
+RDEPEND="
+ ${DEPEND}
+ acct-group/gamestat
+"
+BDEPEND="
+ sys-devel/bison
+ sys-devel/flex
+ virtual/pkgconfig
+"
+
+PATCHES=(
+ "${WORKDIR}"/${PN}-3.1-verbose-build.patch
+ "${FILESDIR}"/${PN}-3.1-no-install-manpages-automatically.patch
+)
+
+# Set GAMES_TO_BUILD variable to whatever you want
+GAMES_TO_BUILD=${GAMES_TO_BUILD:=adventure atc battlestar caesar cribbage
+dab drop4 gofish gomoku hangman klondike robots sail snake spirhunt
+worm wump}
+
+src_prepare() {
+ default
+
+ # Use completely our own CFLAGS/LDFLAGS, no stripping and so on
+ sed -i \
+ -e 's/+= -std=c11 @pkgcflags@ ${CFLAGS}/= -std=c11 @pkgcflags@ ${CFLAGS}/' \
+ -e 's/+= @pkgldflags@ ${LDFLAGS}/= @pkgldflags@ ${LDFLAGS}/' \
+ -e s'/${INSTALL} -m 755 -s/${INSTALL} -m 755/' \
+ -e '/man[6]dir/d' \
+ Config.mk.in || die
+
+ # Yes, this stinks.
+ # Right now, the custom configure script calls pkg-config manually
+ # and seds it a bunch, and this is easier.
+ if has_version sys-libs/ncurses[unicode] ; then
+ # Force looking for both ncurses and ncursesw
+ sed -i -e 's/pkgs="ncurses"/pkgs="ncursesw"/' configure || die
+ fi
+
+ 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_configure() {
+ tc-export AR CC RANLIB
+
+ econf
+}
+
+src_compile() {
+ emake CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}"
+}
+
+src_test() {
+ addwrite /dev/full
+ emake -j1 check
+}
+
+src_install() {
+ dodir /var/games
+ emake -j1 DESTDIR="${D}" install
+
+ _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
+
+ # 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 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
+ _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}; }
+
+ # Install the man pages manually to make life easier (circumventing compression)
+ local game
+ for game in ${GAMES_TO_BUILD[@]} ; do
+ if [[ -e ${game}/${game}.1 ]] ; then
+ doman ${game}/${game}.1
+ else
+ doman ${game}/${game}.6
+ fi
+ done
+
+ # Since factor is usually not installed, and primes.6 is a symlink to
+ # factor.6, make sure that primes.6 is ok ...
+ if _build_game primes && [[ ! $(_build_game factor) ]] ; then
+ rm -f "${ED}"/usr/share/man/man6/{factor,primes}.6 || die
+ newman factor/factor.6 primes.6
+ fi
+
+ # 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-64bitutmp.patch b/games-misc/bsd-games/files/bsd-games-2.17-64bitutmp.patch
index 3be1b3de074b..7afd0019efb4 100644
--- a/games-misc/bsd-games/files/bsd-games-2.17-64bitutmp.patch
+++ b/games-misc/bsd-games/files/bsd-games-2.17-64bitutmp.patch
@@ -7,8 +7,8 @@ structure. Work around is to assign the submembers instead.
http://bugs.gentoo.org/show_bug.cgi?id=102667
---- bsd-games/dm/utmpentry.c
-+++ bsd-games/dm/utmpentry.c
+--- a/dm/utmpentry.c
++++ b/dm/utmpentry.c
@@ -291,7 +291,8 @@
e->line[sizeof(e->line) - 1] = '\0';
(void)strncpy(e->host, up->ut_host, sizeof(up->ut_host));
diff --git a/games-misc/bsd-games/files/bsd-games-2.17-bg.patch b/games-misc/bsd-games/files/bsd-games-2.17-bg.patch
index 07dc520b77e4..6503d9afcb5d 100644
--- a/games-misc/bsd-games/files/bsd-games-2.17-bg.patch
+++ b/games-misc/bsd-games/files/bsd-games-2.17-bg.patch
@@ -1,5 +1,5 @@
---- backgammon/common_source/fancy.c.old 2007-05-16 20:16:46.000000000 +0200
-+++ backgammon/common_source/fancy.c 2007-05-16 20:19:00.000000000 +0200
+--- a/backgammon/common_source/fancy.c
++++ b/backgammon/common_source/fancy.c
@@ -58,7 +58,7 @@
int lUP; /* length of UP */
int CO; /* number of columns */
diff --git a/games-misc/bsd-games/files/bsd-games-2.17-gcc4.patch b/games-misc/bsd-games/files/bsd-games-2.17-gcc4.patch
index 7de07effc25d..dabb38460a66 100644
--- a/games-misc/bsd-games/files/bsd-games-2.17-gcc4.patch
+++ b/games-misc/bsd-games/files/bsd-games-2.17-gcc4.patch
@@ -1,5 +1,5 @@
---- trek/getpar.h.orig 2005-08-14 19:45:29.000000000 -0400
-+++ trek/getpar.h 2005-08-14 19:46:33.000000000 -0400
+--- a/trek/getpar.h
++++ b/trek/getpar.h
@@ -31,6 +31,9 @@
* @(#)getpar.h 8.1 (Berkeley) 5/31/93
*/
@@ -16,8 +16,8 @@
int readdelim(int);
+
+#endif /*__GETPAR_H_*/
---- trek/trek.h.orig 2005-08-14 19:45:37.000000000 -0400
-+++ trek/trek.h 2005-08-14 19:48:17.000000000 -0400
+--- a/trek/trek.h
++++ b/trek/trek.h
@@ -31,6 +31,13 @@
* @(#)trek.h 8.1 (Berkeley) 5/31/93
*/
diff --git a/games-misc/bsd-games/files/bsd-games-2.17-headers.patch b/games-misc/bsd-games/files/bsd-games-2.17-headers.patch
deleted file mode 100644
index 953a5d35765a..000000000000
--- a/games-misc/bsd-games/files/bsd-games-2.17-headers.patch
+++ /dev/null
@@ -1,16 +0,0 @@
-http://bugs.gentoo.org/128348
-
---- include/stdio.h
-+++ include/stdio.h
-@@ -35,5 +35,11 @@
- #include_next <stdio.h>
-
- #ifndef HAVE_fgetln
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
- extern char *fgetln(FILE *stream, size_t *len);
-+#ifdef __cplusplus
-+}
-+#endif
- #endif
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 000000000000..0618abd0d3dc
--- /dev/null
+++ b/games-misc/bsd-games/files/bsd-games-2.17-rename-getdate-clash.patch
@@ -0,0 +1,33 @@
+--- 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);
+--- 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)
+--- 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();
diff --git a/games-misc/bsd-games/files/bsd-games-3.1-no-install-manpages-automatically.patch b/games-misc/bsd-games/files/bsd-games-3.1-no-install-manpages-automatically.patch
new file mode 100644
index 000000000000..590b595afa5f
--- /dev/null
+++ b/games-misc/bsd-games/files/bsd-games-3.1-no-install-manpages-automatically.patch
@@ -0,0 +1,13 @@
+--- a/Makefile
++++ b/Makefile
+@@ -20,10 +20,6 @@ $O%.o: %.c
+ echo " Compiling $< to assembly ..."
+ ${CC} ${cflags} -S -o $@ -c $<
+
+-$O%.6.gz: %.6
+- echo " Compressing $@ ..."
+- gzip -c9 $< > $@
+-
+ ################ Installation ##########################################
+
+ ifdef bindir