Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: games-misc/bsd-games/files/, games-misc/bsd-games/
Date: Wed, 31 Mar 2021 23:39:04
Message-Id: 1617233925.6898e5b44450c1c69205203bc8f9d1ee3f9b08d3.sam@gentoo
1 commit: 6898e5b44450c1c69205203bc8f9d1ee3f9b08d3
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Wed Mar 31 17:56:11 2021 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Wed Mar 31 23:38:45 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6898e5b4
7
8 games-misc/bsd-games: add 3.1
9
10 This is a fork of bsd-games after many years. Thanks to the new maintainer
11 upstream for reaching out to us.
12
13 Closes: https://bugs.gentoo.org/732374
14 Bug: https://bugs.gentoo.org/537010
15 Bug: https://bugs.gentoo.org/715778
16 Signed-off-by: Sam James <sam <AT> gentoo.org>
17
18 games-misc/bsd-games/Manifest | 2 +
19 games-misc/bsd-games/bsd-games-3.1.ebuild | 151 +++++++++++++++++++++
20 ...mes-3.1-no-install-manpages-automatically.patch | 15 ++
21 3 files changed, 168 insertions(+)
22
23 diff --git a/games-misc/bsd-games/Manifest b/games-misc/bsd-games/Manifest
24 index 2bccdb8acb3..fa75813e015 100644
25 --- a/games-misc/bsd-games/Manifest
26 +++ b/games-misc/bsd-games/Manifest
27 @@ -1,4 +1,6 @@
28 DIST bsd-games-2.17.tar.gz 2563311 BLAKE2B 9dfff4e70929e14a422c536c661cd95c5f1ac81d9112494525b9ef13d7a39b66bd59b6a264e614cfb29784fdb63364f56b12b4d284b125b5b3c12e92def07fb0 SHA512 cb2ee60474f164d42e3d47700270bbeeda3c8279d64da409c9cc05e36437ef95b92d0a85543298e97604635fcf3e068f3a5cc812e90b5c61fb8d146cf35bc38f
29 +DIST bsd-games-3.1-verbose-build.patch.gz 4633 BLAKE2B cc75175ac2ef9d476c03bdb08b8c054d13090d6cdd1a14dd44022d13290112c68a7663d0c03f9ca7535ea10f2bb5e49a84acca4f782f0ced59685f762efd5151 SHA512 120c0859bb73a026dae017bcc2bc7505ca156b454bf5f87c91b4887417d5ac62f3dec706af91b22b11be8b5bce11d168f9205d722a9fd30dea654f682a66b1c8
30 +DIST bsd-games-3.1.tar.gz 267636 BLAKE2B 116b340e383430fc56e9d2379a398494b43664aa124157bfa01f2c6a76ebdc90128cc676abae83b6d74680b0ad9396d24f1c0d11adcff1f552a3e68717b8cc8f SHA512 3f311e89481913b734a21fc7d0765628637af8251228d5a38349c27cc702c307240e81711785bbd7428e208a142bd07597630d29e97e2c7bf5bd9cac1ebc6ada
31 DIST bsdgames_2.17-22.debian.tar.xz 32268 BLAKE2B 2485abc1d80b8319c7eb68e2747c0a4166d18079047eca67c1de549cd011f75a767b6fe69021cb4ce09aaf029823a097e6ac658efcab5e19e976a89ed798d06f SHA512 902d86557dd3813c31333fe18437d8046ae100814c9c1b340ab1f8266c817545f21e000702b1ca93babb9d632896ea5bada1e146436abfa7916b469681fceed5
32 DIST bsdgames_2.17-28.debian.tar.xz 58464 BLAKE2B 3f5a70322341b153a8b3cb8df81fea1e773971d0f3b79ba8fb0c0877e95c61c8e8689952333f8ac4263948d781c2dc64c8178f9dac6a1c09ae702f91794b9583 SHA512 7e2db9f830c0657f3fcd1371635bda4a87e7a68180e486e44752904740c0710c02271522ff2d4b606542b3c502dd28795fcecf883360c3ac5bea78c148281f6a
33 DIST bsdgames_2.17.orig.tar.gz 2563311 BLAKE2B 9dfff4e70929e14a422c536c661cd95c5f1ac81d9112494525b9ef13d7a39b66bd59b6a264e614cfb29784fdb63364f56b12b4d284b125b5b3c12e92def07fb0 SHA512 cb2ee60474f164d42e3d47700270bbeeda3c8279d64da409c9cc05e36437ef95b92d0a85543298e97604635fcf3e068f3a5cc812e90b5c61fb8d146cf35bc38f
34
35 diff --git a/games-misc/bsd-games/bsd-games-3.1.ebuild b/games-misc/bsd-games/bsd-games-3.1.ebuild
36 new file mode 100644
37 index 00000000000..9d1bc6d4120
38 --- /dev/null
39 +++ b/games-misc/bsd-games/bsd-games-3.1.ebuild
40 @@ -0,0 +1,151 @@
41 +# Copyright 1999-2021 Gentoo Authors
42 +# Distributed under the terms of the GNU General Public License v2
43 +
44 +EAPI=7
45 +
46 +inherit toolchain-funcs flag-o-matic
47 +
48 +DESCRIPTION="collection of games from NetBSD"
49 +HOMEPAGE="https://www.polyomino.org.uk/computer/software/bsd-games/"
50 +SRC_URI="https://github.com/msharov/bsd-games/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"
51 +SRC_URI+=" https://dev.gentoo.org/~sam/distfiles/${CATEGORY}/${PN}/${P}-verbose-build.patch.gz"
52 +
53 +LICENSE="BSD"
54 +SLOT="0"
55 +KEYWORDS="~amd64"
56 +
57 +DEPEND="
58 + sys-apps/miscfiles
59 + sys-libs/ncurses:=
60 + !games-misc/wtf
61 + !app-misc/banner
62 + !games-puzzle/hangman
63 +"
64 +RDEPEND="
65 + ${DEPEND}
66 + acct-group/gamestat
67 +"
68 +BDEPEND="
69 + sys-devel/bison
70 + sys-devel/flex
71 + virtual/pkgconfig
72 +"
73 +
74 +PATCHES=(
75 + "${FILESDIR}"/${PN}-3.1-no-install-manpages-automatically.patch
76 +)
77 +
78 +# Set GAMES_TO_BUILD variable to whatever you want
79 +GAMES_TO_BUILD=${GAMES_TO_BUILD:=adventure atc battlestar caesar cribbage
80 +dab drop4 gofish gomoku hangman klondike robots sail snake spirhunt
81 +worm wump}
82 +
83 +src_prepare() {
84 + eapply "${WORKDIR}"/${PN}-3.1-verbose-build.patch
85 +
86 + default
87 +
88 + # Use completely our own CFLAGS/LDFLAGS, no stripping and so on
89 + sed -i \
90 + -e 's/+= -std=c11 @pkgcflags@ ${CFLAGS}/= -std=c11 @pkgcflags@ ${CFLAGS}/' \
91 + -e 's/+= @pkgldflags@ ${LDFLAGS}/= @pkgldflags@ ${LDFLAGS}/' \
92 + -e s'/${INSTALL} -m 755 -s/${INSTALL} -m 755/' \
93 + -e '/man[6]dir/d' \
94 + Config.mk.in || die
95 +
96 + # Yes, this stinks.
97 + # Right now, the custom configure script calls pkg-config manually
98 + # and seds it a bunch, and this is easier.
99 + if has_version sys-libs/ncurses[unicode] ; then
100 + # Force looking for both ncurses and ncursesw
101 + sed -i -e 's/pkgs="ncurses"/pkgs="ncursesw"/' configure || die
102 + fi
103 +
104 + cp "${FILESDIR}"/config.params-gentoo config.params || die
105 + echo bsd_games_cfg_usrlibdir=\"$(get_libdir)\" >> ./config.params || die
106 + echo bsd_games_cfg_build_dirs=\"${GAMES_TO_BUILD}\" >> ./config.params || die
107 + echo bsd_games_cfg_docdir=\"/usr/share/doc/${PF}\" >> ./config.params || die
108 +}
109 +
110 +src_configure() {
111 + tc-export AR CC RANLIB
112 +
113 + econf
114 +}
115 +
116 +src_compile() {
117 + emake CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}"
118 +}
119 +
120 +src_test() {
121 + addwrite /dev/full
122 + emake -j1 check
123 +}
124 +
125 +src_install() {
126 + dodir /var/games
127 + emake -j1 DESTDIR="${D}" install
128 +
129 + _build_game() {
130 + has ${1} ${GAMES_TO_BUILD}
131 + }
132 +
133 + _do_statefile() {
134 + touch "${ED}"/var/games/${1} || die
135 + chmod ug+rw "${ED}"/var/games/${1} || die
136 + }
137 +
138 + # set some binaries to run as games group (+S)
139 + _build_game atc && fperms g+s /usr/bin/atc
140 + _build_game battlestar && fperms g+s /usr/bin/battlestar
141 + _build_game canfield && fperms g+s /usr/bin/canfield
142 + _build_game cribbage && fperms g+s /usr/bin/cribbage
143 + _build_game phantasia && fperms g+s /usr/bin/phantasia
144 + _build_game robots && fperms g+s /usr/bin/robots
145 + _build_game sail && fperms g+s /usr/bin/sail
146 + _build_game snake && fperms g+s /usr/bin/snake
147 + _build_game tetris && fperms g+s /usr/bin/tetris-bsd
148 +
149 + # state files
150 + _build_game atc && _do_statefile atc_score
151 + _build_game battlestar && _do_statefile battlestar.log
152 + _build_game canfield && _do_statefile cfscores
153 + _build_game cribbage && _do_statefile criblog
154 + _build_game hack && keepdir /var/games/hack
155 + _build_game robots && _do_statefile robots_roll
156 + _build_game sail && _do_statefile saillog
157 + _build_game snake && _do_statefile snake.log && _do_statefile snakerawscores
158 + _build_game tetris && _do_statefile tetris-bsd.scores
159 +
160 + # extra docs
161 + _build_game atc && docinto atc
162 + _build_game boggle && { docinto boggle ; dodoc boggle/README; }
163 + _build_game hack && { docinto hack ; dodoc hack/{OWNER,Original_READ_ME,READ_ME,help}; }
164 + _build_game hunt && { docinto hunt ; dodoc hunt/README; }
165 + _build_game phantasia && { docinto phantasia ; dodoc phantasia/{OWNER,README}; }
166 +
167 + # Install the man pages manually to make life easier (circumventing compression)
168 + local game
169 + for game in ${GAMES_TO_BUILD[@]} ; do
170 + if [[ -e ${game}/${game}.1 ]] ; then
171 + doman ${game}/${game}.1
172 + else
173 + doman ${game}/${game}.6
174 + fi
175 + done
176 +
177 + # Since factor is usually not installed, and primes.6 is a symlink to
178 + # factor.6, make sure that primes.6 is ok ...
179 + if _build_game primes && [[ ! $(_build_game factor) ]] ; then
180 + rm -f "${ED}"/usr/share/man/man6/{factor,primes}.6 || die
181 + newman factor/factor.6 primes.6
182 + fi
183 +
184 + # All of this needs to be owned by the gamestat group
185 + fowners -R :gamestat /var/games/
186 + # ... and so do the binaries
187 + fowners -R :gamestat /usr/bin/
188 +
189 + # State dirs
190 + chmod -R ug+rw "${ED}"/var/games/ || die
191 +}
192
193 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
194 new file mode 100644
195 index 00000000000..46645e162a4
196 --- /dev/null
197 +++ b/games-misc/bsd-games/files/bsd-games-3.1-no-install-manpages-automatically.patch
198 @@ -0,0 +1,15 @@
199 +diff --git a/Makefile b/Makefile
200 +index 9de05a8..e047213 100644
201 +--- a/Makefile
202 ++++ b/Makefile
203 +@@ -20,10 +20,6 @@ $O%.o: %.c
204 + echo " Compiling $< to assembly ..."
205 + ${CC} ${cflags} -S -o $@ -c $<
206 +
207 +-$O%.6.gz: %.6
208 +- echo " Compressing $@ ..."
209 +- gzip -c9 $< > $@
210 +-
211 + ################ Installation ##########################################
212 +
213 + ifdef bindir