summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2021-03-31 17:56:11 +0000
committerSam James <sam@gentoo.org>2021-03-31 23:38:45 +0000
commit6898e5b44450c1c69205203bc8f9d1ee3f9b08d3 (patch)
tree10a299d0c236bea27f6936db10c37709e0debac5 /games-misc
parentgames-misc/bsd-games: add 2.17_p28 (diff)
downloadgentoo-6898e5b44450c1c69205203bc8f9d1ee3f9b08d3.tar.gz
gentoo-6898e5b44450c1c69205203bc8f9d1ee3f9b08d3.tar.bz2
gentoo-6898e5b44450c1c69205203bc8f9d1ee3f9b08d3.zip
games-misc/bsd-games: add 3.1
This is a fork of bsd-games after many years. Thanks to the new maintainer upstream for reaching out to us. Closes: https://bugs.gentoo.org/732374 Bug: https://bugs.gentoo.org/537010 Bug: https://bugs.gentoo.org/715778 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'games-misc')
-rw-r--r--games-misc/bsd-games/Manifest2
-rw-r--r--games-misc/bsd-games/bsd-games-3.1.ebuild151
-rw-r--r--games-misc/bsd-games/files/bsd-games-3.1-no-install-manpages-automatically.patch15
3 files changed, 168 insertions, 0 deletions
diff --git a/games-misc/bsd-games/Manifest b/games-misc/bsd-games/Manifest
index 2bccdb8acb3a..fa75813e0150 100644
--- a/games-misc/bsd-games/Manifest
+++ b/games-misc/bsd-games/Manifest
@@ -1,4 +1,6 @@
DIST bsd-games-2.17.tar.gz 2563311 BLAKE2B 9dfff4e70929e14a422c536c661cd95c5f1ac81d9112494525b9ef13d7a39b66bd59b6a264e614cfb29784fdb63364f56b12b4d284b125b5b3c12e92def07fb0 SHA512 cb2ee60474f164d42e3d47700270bbeeda3c8279d64da409c9cc05e36437ef95b92d0a85543298e97604635fcf3e068f3a5cc812e90b5c61fb8d146cf35bc38f
+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-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-3.1.ebuild b/games-misc/bsd-games/bsd-games-3.1.ebuild
new file mode 100644
index 000000000000..9d1bc6d4120d
--- /dev/null
+++ b/games-misc/bsd-games/bsd-games-3.1.ebuild
@@ -0,0 +1,151 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit toolchain-funcs flag-o-matic
+
+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"
+SLOT="0"
+KEYWORDS="~amd64"
+
+DEPEND="
+ sys-apps/miscfiles
+ sys-libs/ncurses:=
+ !games-misc/wtf
+ !app-misc/banner
+ !games-puzzle/hangman
+"
+RDEPEND="
+ ${DEPEND}
+ acct-group/gamestat
+"
+BDEPEND="
+ sys-devel/bison
+ sys-devel/flex
+ virtual/pkgconfig
+"
+
+PATCHES=(
+ "${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() {
+ eapply "${WORKDIR}"/${PN}-3.1-verbose-build.patch
+
+ 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-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..46645e162a47
--- /dev/null
+++ b/games-misc/bsd-games/files/bsd-games-3.1-no-install-manpages-automatically.patch
@@ -0,0 +1,15 @@
+diff --git a/Makefile b/Makefile
+index 9de05a8..e047213 100644
+--- 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