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:03
Message-Id: 1617233924.0c13ca36bf039e92078a64b63d84d04949948ef4.sam@gentoo
1 commit: 0c13ca36bf039e92078a64b63d84d04949948ef4
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Wed Mar 31 20:28:10 2021 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Wed Mar 31 23:38:44 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0c13ca36
7
8 games-misc/bsd-games: add 2.17_p28
9
10 Upgrade to new Debian patchset (p28) which may help resolve
11 some of the open bugs. It's also a nice stopgap because
12 the new fork upstream drops some games and it means
13 we don't take as big of a risk when simply
14 porting away from games.eclass.
15
16 (Not dumping games.eclass *AND* choosing a new upstream
17 all at once, with no option for users to downgrade.)
18
19 Bug: https://bugs.gentoo.org/732374
20 Bug: https://bugs.gentoo.org/537010
21 Bug: https://bugs.gentoo.org/715778
22 Signed-off-by: Sam James <sam <AT> gentoo.org>
23
24 games-misc/bsd-games/Manifest | 2 +
25 games-misc/bsd-games/bsd-games-2.17_p28.ebuild | 155 +++++++++++++++++++++
26 .../bsd-games-2.17-rename-getdate-clash.patch | 39 ++++++
27 3 files changed, 196 insertions(+)
28
29 diff --git a/games-misc/bsd-games/Manifest b/games-misc/bsd-games/Manifest
30 index c48313d617e..2bccdb8acb3 100644
31 --- a/games-misc/bsd-games/Manifest
32 +++ b/games-misc/bsd-games/Manifest
33 @@ -1,2 +1,4 @@
34 DIST bsd-games-2.17.tar.gz 2563311 BLAKE2B 9dfff4e70929e14a422c536c661cd95c5f1ac81d9112494525b9ef13d7a39b66bd59b6a264e614cfb29784fdb63364f56b12b4d284b125b5b3c12e92def07fb0 SHA512 cb2ee60474f164d42e3d47700270bbeeda3c8279d64da409c9cc05e36437ef95b92d0a85543298e97604635fcf3e068f3a5cc812e90b5c61fb8d146cf35bc38f
35 DIST bsdgames_2.17-22.debian.tar.xz 32268 BLAKE2B 2485abc1d80b8319c7eb68e2747c0a4166d18079047eca67c1de549cd011f75a767b6fe69021cb4ce09aaf029823a097e6ac658efcab5e19e976a89ed798d06f SHA512 902d86557dd3813c31333fe18437d8046ae100814c9c1b340ab1f8266c817545f21e000702b1ca93babb9d632896ea5bada1e146436abfa7916b469681fceed5
36 +DIST bsdgames_2.17-28.debian.tar.xz 58464 BLAKE2B 3f5a70322341b153a8b3cb8df81fea1e773971d0f3b79ba8fb0c0877e95c61c8e8689952333f8ac4263948d781c2dc64c8178f9dac6a1c09ae702f91794b9583 SHA512 7e2db9f830c0657f3fcd1371635bda4a87e7a68180e486e44752904740c0710c02271522ff2d4b606542b3c502dd28795fcecf883360c3ac5bea78c148281f6a
37 +DIST bsdgames_2.17.orig.tar.gz 2563311 BLAKE2B 9dfff4e70929e14a422c536c661cd95c5f1ac81d9112494525b9ef13d7a39b66bd59b6a264e614cfb29784fdb63364f56b12b4d284b125b5b3c12e92def07fb0 SHA512 cb2ee60474f164d42e3d47700270bbeeda3c8279d64da409c9cc05e36437ef95b92d0a85543298e97604635fcf3e068f3a5cc812e90b5c61fb8d146cf35bc38f
38
39 diff --git a/games-misc/bsd-games/bsd-games-2.17_p28.ebuild b/games-misc/bsd-games/bsd-games-2.17_p28.ebuild
40 new file mode 100644
41 index 00000000000..fc382f97d8c
42 --- /dev/null
43 +++ b/games-misc/bsd-games/bsd-games-2.17_p28.ebuild
44 @@ -0,0 +1,155 @@
45 +# Copyright 1999-2021 Gentoo Authors
46 +# Distributed under the terms of the GNU General Public License v2
47 +
48 +EAPI=7
49 +
50 +inherit toolchain-funcs flag-o-matic
51 +
52 +DEB_PATCH_VER=28
53 +DESCRIPTION="Collection of games from NetBSD"
54 +HOMEPAGE="https://www.polyomino.org.uk/computer/software/bsd-games/"
55 +#SRC_URI="https://www.polyomino.org.uk/computer/software/bsd-games/${PN}-$(ver_cut 1-2).tar.gz"
56 +SRC_URI="http://deb.debian.org/debian/pool/main/b/bsdgames/bsdgames_2.17.orig.tar.gz"
57 +SRC_URI+=" mirror://debian/pool/main/b/bsdgames/bsdgames_$(ver_cut 1-2)-${DEB_PATCH_VER}.debian.tar.xz"
58 +S="${WORKDIR}/${PN}-$(ver_cut 1-2)"
59 +
60 +LICENSE="BSD"
61 +SLOT="0"
62 +KEYWORDS="~alpha ~amd64 ~x86"
63 +
64 +DEPEND="
65 + sys-apps/miscfiles
66 + sys-libs/ncurses:0
67 + app-misc/banner
68 + !games-misc/wtf
69 + !games-puzzle/hangman
70 +"
71 +RDEPEND="
72 + ${DEPEND}
73 + acct-group/gamestat
74 +"
75 +BDEPEND="
76 + sys-devel/bison
77 + sys-devel/flex
78 + virtual/pkgconfig
79 +"
80 +
81 +# Set GAMES_TO_BUILD variable to whatever you want
82 +GAMES_TO_BUILD=${GAMES_TO_BUILD:=adventure arithmetic atc
83 +backgammon banner battlestar bcd boggle caesar canfield countmail cribbage
84 +dab dm fish gomoku hack hangman hunt mille monop morse
85 +number phantasia pig pom primes ppt quiz rain random robots sail snake
86 +tetris trek wargames worm worms wtf}
87 +
88 +src_prepare() {
89 + local debian_patch_dir="${WORKDIR}"/debian/patches
90 + for patch in $(<"${debian_patch_dir}"/series) ; do
91 + eapply "${debian_patch_dir}"/${patch}
92 + done
93 +
94 + eapply "${FILESDIR}"/${PN}-2.17-64bitutmp.patch
95 + eapply -p0 "${FILESDIR}"/${PN}-2.17-bg.patch
96 + eapply -p0 "${FILESDIR}"/${PN}-2.17-gcc4.patch
97 + eapply "${FILESDIR}"/${PN}-2.17-rename-getdate-clash.patch
98 +
99 + default
100 +
101 + # TODO: Check this?
102 + # Used by gentoo config.params. See bug 531200
103 +
104 + # Use pkg-config to query Libs: from ncurses.pc (for eg. -ltinfo) wrt #459652
105 + sed -i \
106 + -e "/ncurses_lib/s:-lncurses:'$($(tc-getPKG_CONFIG) --libs-only-l ncurses)':" \
107 + configure || die
108 +
109 + sed -i \
110 + -e "s:/usr/games:/usr/bin:" \
111 + wargames/wargames || die
112 +
113 + sed -i \
114 + -e '/^CC :=/d' \
115 + -e '/^CXX :=/d' \
116 + -e '/^CFLAGS/s/OPTIMIZE/CFLAGS/' \
117 + -e '/^CXXFLAGS/s/OPTIMIZE/CXXFLAGS/' \
118 + -e '/^LDFLAGS/s/LDFLAGS := /LDFLAGS := \$(LDFLAGS) /' \
119 + Makeconfig.in || die
120 +
121 + # export GAMES_BINDIR GAMES_DATADIR GAMES_STATEDIR
122 + export GAMES_BINDIR=/usr/bin
123 + export GAMES_DATADIR=/usr/share
124 + export GAMES_STATEDIR=/var/games
125 + cp "${FILESDIR}"/config.params-gentoo config.params || die
126 +
127 + echo bsd_games_cfg_usrlibdir=\"$(get_libdir)\" >> ./config.params || die
128 + echo bsd_games_cfg_build_dirs=\"${GAMES_TO_BUILD}\" >> ./config.params || die
129 + echo bsd_games_cfg_docdir=\"/usr/share/doc/${PF}\" >> ./config.params || die
130 +}
131 +
132 +src_compile() {
133 + tc-export CC CXX
134 +
135 + emake
136 +}
137 +
138 +src_test() {
139 + addwrite /dev/full
140 + emake -j1 check
141 +}
142 +
143 +src_install() {
144 + # TODO: ${PN} or no?
145 + dodir /var/games /usr/share/man/man{1,6}
146 + emake -j1 DESTDIR="${D}" install
147 +
148 + dodoc AUTHORS BUGS ChangeLog ChangeLog.0 \
149 + README PACKAGING SECURITY THANKS TODO YEAR2000
150 +
151 + _build_game() {
152 + has ${1} ${GAMES_TO_BUILD}
153 + }
154 +
155 + _do_statefile() {
156 + touch "${ED}"/var/games/${1} || die
157 + chmod ug+rw "${ED}"/var/games/${1} || die
158 + }
159 +
160 + # set some binaries to run as games group (+S)
161 + _build_game atc && fperms g+s /usr/bin/atc
162 + _build_game battlestar && fperms g+s /usr/bin/battlestar
163 + _build_game canfield && fperms g+s /usr/bin/canfield
164 + _build_game cribbage && fperms g+s /usr/bin/cribbage
165 + _build_game phantasia && fperms g+s /usr/bin/phantasia
166 + _build_game robots && fperms g+s /usr/bin/robots
167 + _build_game sail && fperms g+s /usr/bin/sail
168 + _build_game snake && fperms g+s /usr/bin/snake
169 + _build_game tetris && fperms g+s /usr/bin/tetris-bsd
170 +
171 + elog "Renaming monop to monop-bsd to avoid collision with dev-lang/mono"
172 + mv "${ED}"/usr/bin/monop "${ED}"/usr/bin/monop-bsd || die
173 +
174 + # state files
175 + _build_game atc && _do_statefile atc_score
176 + _build_game battlestar && _do_statefile battlestar.log
177 + _build_game canfield && _do_statefile cfscores
178 + _build_game cribbage && _do_statefile criblog
179 + _build_game hack && keepdir /var/games/hack
180 + _build_game robots && _do_statefile robots_roll
181 + _build_game sail && _do_statefile sail/saillog
182 + _build_game snake && _do_statefile snake.log && _do_statefile snakerawscores
183 + _build_game tetris && _do_statefile tetris-bsd.scores
184 +
185 + # extra docs
186 + _build_game atc && { docinto atc ; dodoc atc/BUGS; }
187 + _build_game boggle && { docinto boggle ; dodoc boggle/README; }
188 + _build_game hack && { docinto hack ; dodoc hack/{OWNER,Original_READ_ME,READ_ME,help}; }
189 + _build_game hunt && { docinto hunt ; dodoc hunt/README; }
190 + _build_game phantasia && { docinto phantasia ; dodoc phantasia/{OWNER,README}; }
191 +
192 + # All of this needs to be owned by the gamestat group
193 + fowners -R :gamestat /var/games/
194 + # ... and so do the binaries
195 + fowners -R :gamestat /usr/bin/
196 +
197 + # State dirs
198 + chmod -R ug+rw "${ED}"/var/games/ || die
199 +}
200
201 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
202 new file mode 100644
203 index 00000000000..6cda335d7ae
204 --- /dev/null
205 +++ b/games-misc/bsd-games/files/bsd-games-2.17-rename-getdate-clash.patch
206 @@ -0,0 +1,39 @@
207 +diff --git a/hack/extern.h b/hack/extern.h
208 +index e2ef242..7c5085f 100644
209 +--- a/hack/extern.h
210 ++++ b/hack/extern.h
211 +@@ -583,7 +583,7 @@ int role_index(int);
212 + void setrandom(void);
213 + struct tm *getlt(void);
214 + int getyear(void);
215 +-char *getdate(void);
216 ++char *get_date(void);
217 + int phase_of_the_moon(void);
218 + int night(void);
219 + int midnight(void);
220 +diff --git a/hack/hack.end.c b/hack/hack.end.c
221 +index 3145fd7..36e4796 100644
222 +--- a/hack/hack.end.c
223 ++++ b/hack/hack.end.c
224 +@@ -360,7 +360,7 @@ topten()
225 + (t0->name)[NAMSZ] = 0;
226 + (void) strncpy(t0->death, killer, DTHSZ);
227 + (t0->death)[DTHSZ] = 0;
228 +- (void) strcpy(t0->date, getdate());
229 ++ (void) strcpy(t0->date, get_date());
230 +
231 + /* assure minimum number of points */
232 + if (t0->points < POINTSMIN)
233 +diff --git a/hack/hack.unix.c b/hack/hack.unix.c
234 +index 13f9724..ef17788 100644
235 +--- a/hack/hack.unix.c
236 ++++ b/hack/hack.unix.c
237 +@@ -118,7 +118,7 @@ getyear()
238 + }
239 +
240 + char *
241 +-getdate()
242 ++get_date()
243 + {
244 + static char datestr[7];
245 + struct tm *lt = getlt();