Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: games-roguelike/nethack/files/, games-roguelike/nethack/
Date: Thu, 23 Aug 2018 19:50:19
Message-Id: 1535053807.c9efdc6e013f8e2fdaf9b83e39e4f1339b793387.mgorny@gentoo
1 commit: c9efdc6e013f8e2fdaf9b83e39e4f1339b793387
2 Author: Luis Ressel <aranea <AT> aixah <DOT> de>
3 AuthorDate: Tue Aug 21 21:11:34 2018 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Thu Aug 23 19:50:07 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c9efdc6e
7
8 games-roguelike/nethack: Bump to 3.6.1
9
10 * Bump to EAPI 7
11 * Update SRC_URI
12 * (Hopefully?) support prefix builds
13 * Various improvements suggested by mgorny
14 * Set SGID on the /var/games/nethack directory to avoid a potential
15 privilege escalation during package upgrades
16 * Don't redefine LINUX and STATUS_HILITES
17 * Unconditionally enable DUMPLOG and SCORE_ON_BOTL per upstream
18 recommendations
19 * Remove obsolete STATUS_VIA_WINDOWPORT and the now empty "experimental"
20 USE flag
21
22 Thanks-to: Michał Górny <mgorny <AT> gentoo.org>
23 Thanks-to: Laurent Bercot
24 Closes: https://github.com/gentoo/gentoo/pull/9661
25
26 games-roguelike/nethack/Manifest | 1 +
27 .../nethack/files/nethack-3.6.1-recover.patch | 115 ++++++++++++++++++
28 games-roguelike/nethack/nethack-3.6.1.ebuild | 128 +++++++++++++++++++++
29 3 files changed, 244 insertions(+)
30
31 diff --git a/games-roguelike/nethack/Manifest b/games-roguelike/nethack/Manifest
32 index 8acf7589107..97ad7b566d2 100644
33 --- a/games-roguelike/nethack/Manifest
34 +++ b/games-roguelike/nethack/Manifest
35 @@ -1 +1,2 @@
36 DIST nethack-360-src.tgz 4261282 BLAKE2B 7be22b8bdc7b5124418fa904aa3776d77440f67ec18782b878e037b989a18092ed88ca192224c7bc1eaa3cb438823188035c3e6d2aa85d13a7aa1e86c8527d32 SHA512 92370a3c60a4f6861b9c0f1e1320fc23d91cedc1615d0d09e06a0ee3e13c9c8c0cd931389bfd7a25845ed07ef966d19d9e46e77ae07084a941685dc67f49c813
37 +DIST nethack-361-src.tgz 4640769 BLAKE2B 3793a753e4012df64335e7e7ec60284de206012d5bb5d30a7ccfb458e456818f30dd0b4bfa9c41b1691bd01ee6aec2e44b57327586f0c9d76a573bf4c9bb00b1 SHA512 bd6e36c163f0d85e1ab1fc659464696b5a02c3864a800ad47e047fdc4a35fff4ef7dd28a9b071fa46f7f67fa45c97fdc77bc1f2bdbad80cc02950d73731d9c30
38
39 diff --git a/games-roguelike/nethack/files/nethack-3.6.1-recover.patch b/games-roguelike/nethack/files/nethack-3.6.1-recover.patch
40 new file mode 100644
41 index 00000000000..c7ad7808a2c
42 --- /dev/null
43 +++ b/games-roguelike/nethack/files/nethack-3.6.1-recover.patch
44 @@ -0,0 +1,115 @@
45 +From 5d9a3ac6b9eaf63167e5c7c01f0bb33d383dab14 Mon Sep 17 00:00:00 2001
46 +From: Luis Ressel <aranea@×××××.de>
47 +Date: Tue, 21 Aug 2018 22:57:09 +0200
48 +Subject: [PATCH] doc: Rename recover to recover-nethack
49 +
50 +---
51 + doc/recover.6 | 30 +++++++++++++++---------------
52 + 1 file changed, 15 insertions(+), 15 deletions(-)
53 +
54 +diff --git a/doc/recover.6 b/doc/recover.6
55 +index 1209d31d..c3fdd851 100644
56 +--- a/doc/recover.6
57 ++++ b/doc/recover.6
58 +@@ -1,4 +1,4 @@
59 +-.TH RECOVER 6 "14 December 2015" NETHACK
60 ++.TH RECOVER-NETHACK 6 "14 December 2015" NETHACK
61 + .de ND
62 + .ds Nd \\$3
63 + ..
64 +@@ -13,9 +13,9 @@
65 + .NR $NHDT-Revision: 1.9 $
66 + .ds Na Kenneth Lorber
67 + .SH NAME
68 +-recover \- recover a NetHack game interrupted by disaster
69 ++recover-nethack \- recover a NetHack game interrupted by disaster
70 + .SH SYNOPSIS
71 +-.B recover
72 ++.B recover-nethack
73 + [
74 + .B \-d
75 + .I directory
76 +@@ -33,7 +33,7 @@ so such games can be recovered at the point of the last level change.
77 + The
78 + .I base
79 + options tell
80 +-.I recover
81 ++.I recover-nethack
82 + which files to process.
83 + Each base option specifies recovery of a separate game.
84 + .PP
85 +@@ -83,47 +83,47 @@ by a user number to avoid conflicts,
86 + or "xlock" if the number of concurrent players is being limited.
87 + It may be necessary to look in the playground to find the correct
88 + base name of the interrupted game.
89 +-.I recover
90 ++.I recover-nethack
91 + will transform these level files into a save file of the same name as
92 + .I nethack
93 + would have used.
94 + .PP
95 + Since
96 +-.I recover
97 ++.I recover-nethack
98 + must be able to read and delete files from the playground
99 + and create files in the save directory,
100 + it has interesting interactions with game security.
101 + Giving ordinary players access to
102 +-.I recover
103 ++.I recover-nethack
104 + through setuid or setgid is tantamount to leaving the playground
105 + world-writable,
106 + with respect to both cheating and messing up other players.
107 + For a single-user system, this of course does not change anything,
108 + so some of the microcomputer ports install
109 +-.I recover
110 ++.I recover-nethack
111 + by default.
112 + .PP
113 + For a multi-user system,
114 + the game administrator may want to arrange for all .0 files in the
115 +-playground to be fed to recover when the host machine boots,
116 ++playground to be fed to recover-nethack when the host machine boots,
117 + and handle game crashes individually.
118 + If the user population is sufficiently trustworthy,
119 +-.I recover
120 ++.I recover-nethack
121 + can be installed with the same permissions the
122 + .I nethack
123 + executable has.
124 + In either case,
125 +-.I recover
126 ++.I recover-nethack
127 + is easily compiled from the distribution utility directory.
128 + .SH NOTES
129 + .PP
130 + Like
131 + .I nethack
132 + itself,
133 +-.I recover
134 ++.I recover-nethack
135 + will overwrite existing savefiles of the same name.
136 + Savefiles created by
137 +-.I recover
138 ++.I recover-nethack
139 + are uncompressed;
140 + they may be compressed afterwards if desired,
141 + but even a compression-using
142 +@@ -133,12 +133,12 @@ will find them in the uncompressed form.
143 + nethack(6)
144 + .SH BUGS
145 + .PP
146 +-.I recover
147 ++.I recover-nethack
148 + makes no attempt to find out if a base name specifies a game in progress.
149 + If multiple machines share a playground, this would be impossible to
150 + determine.
151 + .PP
152 +-.I recover
153 ++.I recover-nethack
154 + should be taught to use the nethack playground locking mechanism to
155 + avoid conflicts.
156 + .SH COPYRIGHT
157 +--
158 +2.18.0
159 +
160
161 diff --git a/games-roguelike/nethack/nethack-3.6.1.ebuild b/games-roguelike/nethack/nethack-3.6.1.ebuild
162 new file mode 100644
163 index 00000000000..3c6526d8c1c
164 --- /dev/null
165 +++ b/games-roguelike/nethack/nethack-3.6.1.ebuild
166 @@ -0,0 +1,128 @@
167 +# Copyright 1999-2018 Gentoo Foundation
168 +# Distributed under the terms of the GNU General Public License v2
169 +
170 +EAPI=7
171 +inherit desktop flag-o-matic toolchain-funcs user
172 +
173 +MY_PV=${PV//.}
174 +DESCRIPTION="The ultimate old-school single player dungeon exploration game"
175 +HOMEPAGE="https://www.nethack.org/"
176 +SRC_URI="https://nethack.org/download/${PV}/nethack-${MY_PV}-src.tgz"
177 +
178 +LICENSE="nethack"
179 +SLOT="0"
180 +KEYWORDS="~amd64 ~arm ~hppa ~x86 ~x86-fbsd"
181 +IUSE="X"
182 +
183 +RDEPEND="sys-libs/ncurses:0=
184 + X? (
185 + x11-libs/libXaw
186 + x11-libs/libXpm
187 + x11-libs/libXt
188 + )"
189 +DEPEND="${RDEPEND}
190 + X? ( x11-base/xorg-proto )
191 + "
192 +BDEPEND="virtual/pkgconfig
193 + X? (
194 + x11-apps/bdftopcf
195 + x11-apps/mkfontdir
196 + )"
197 +
198 +src_prepare() {
199 + eapply "${FILESDIR}/${P}-recover.patch"
200 + eapply_user
201 +
202 + cp "${FILESDIR}/${PN}-3.6.0-hint-$(usex X x11 tty)" hint || die "Failed to copy hint file"
203 + sys/unix/setup.sh hint || die "Failed to run setup.sh"
204 +}
205 +
206 +src_compile() {
207 + append-cflags -I../include -DDLB -DSECURE -DTIMED_DELAY -DVISION_TABLES -DDUMPLOG -DSCORE_ON_BOTL
208 + append-cflags '-DCOMPRESS=\"${EPREFIX}/bin/gzip\"' '-DCOMPRESS_EXTENSION=\".gz\"'
209 + append-cflags "-DHACKDIR=\\\"${EPREFIX}/usr/$(get_libdir)/nethack\\\"" "-DVAR_PLAYGROUND=\\\"${EPREFIX}/var/games/nethack\\\""
210 + append-cflags "-DDEF_PAGER=\\\"${PAGER}\\\""
211 + append-cflags -DSYSCF "-DSYSCF_FILE=\\\"${EPREFIX}/etc/nethack.sysconf\\\""
212 +
213 + use X && append-cflags -DX11_GRAPHICS -DUSE_XPM
214 +
215 + LOCAL_MAKEOPTS=(
216 + CC="$(tc-getCC)" CFLAGS="${CFLAGS}" LFLAGS="${LDFLAGS}"
217 + WINTTYLIB="$($(tc-getPKG_CONFIG) --libs ncurses)"
218 + HACKDIR="${EPREFIX}/usr/$(get_libdir)/nethack" INSTDIR="${ED}/usr/$(get_libdir)/nethack"
219 + SHELLDIR="${ED}/usr/bin" VARDIR="${ED}/var/games/nethack"
220 + )
221 +
222 + emake "${LOCAL_MAKEOPTS[@]}" nethack recover Guidebook spec_levs
223 +
224 + # Upstream still has some parallel compilation bugs
225 + emake -j1 "${LOCAL_MAKEOPTS[@]}" all
226 +}
227 +
228 +src_install() {
229 + emake "${LOCAL_MAKEOPTS[@]}" install
230 +
231 + mv "${ED}/usr/$(get_libdir)/nethack/recover" "${ED}/usr/bin/recover-nethack" || die "Failed to move recover-nethack"
232 +
233 + doman doc/nethack.6
234 + newman doc/recover.6 recover-nethack.6
235 + dodoc doc/Guidebook.txt
236 +
237 + insinto /etc
238 + newins sys/unix/sysconf nethack.sysconf
239 +
240 + insinto /etc/skel
241 + newins "${FILESDIR}/${PN}-3.6.0-nethackrc" .nethackrc
242 +
243 + if use X ; then
244 + cd "${S}/win/X11" || die "Failed to enter win/X11 directory"
245 +
246 + mkdir -p "${ED}/etc/X11/app-defaults/" || die "Failed to make app-defaults directory"
247 + mv "${ED}/usr/$(get_libdir)/nethack/NetHack.ad" "${ED}/etc/X11/app-defaults/" || die "Failed to move NetHack.ad"
248 +
249 + newicon nh_icon.xpm nethack.xpm
250 + make_desktop_entry ${PN} Nethack
251 +
252 + # install nethack fonts
253 + bdftopcf -o nh10.pcf nh10.bdf || die "Converting fonts failed"
254 + bdftopcf -o ibm.pcf ibm.bdf || die "Converting fonts failed"
255 + insinto "/usr/$(get_libdir)/nethack/fonts"
256 + doins *.pcf
257 + mkfontdir "${ED}/usr/$(get_libdir)/nethack/fonts" || die "mkfontdir failed"
258 + fi
259 +
260 + rm -r "${ED}/var/games/nethack" || die "Failed to clean var/games/nethack"
261 + keepdir /var/games/nethack/save
262 +}
263 +
264 +pkg_preinst() {
265 + enewgroup gamestat 36
266 +
267 + fowners root:gamestat /var/games/nethack /var/games/nethack/save
268 + fperms 2770 /var/games/nethack /var/games/nethack/save
269 +
270 + fowners root:gamestat "/usr/$(get_libdir)/nethack/nethack"
271 + fperms g+s "/usr/$(get_libdir)/nethack/nethack"
272 +}
273 +
274 +pkg_postinst() {
275 + cd "${EROOT}/var/games/nethack" || die "Failed to enter ${EROOT}/var/games/nethack directory"
276 +
277 + # Transition mechanism for <nethack-3.6.1 ebuilds. It's perfectly safe, so we'll just run it unconditionally.
278 + chmod 2770 . save || die "Failed to chmod statedir"
279 +
280 + # Those files can't be created earlier because we don't want portage to wipe them during upgrades
281 + ( umask 007 && touch logfile perm record xlogfile ) || die "Failed to create log files"
282 +
283 + # Instead of using a proper version header in its save files, nethack checks for incompatibilities
284 + # by comparing the mtimes of save files and its own binary. This would require admin interaction even
285 + # during upgrades which don't change the file format, so we'll just touch the files and warn the admin
286 + # manually in case of compatibility issues.
287 + ( shopt -s nullglob
288 + local saves=( bones* save/* )
289 + test ${#saves[@]} -gt 0 && touch -c "${saves[@]}"
290 + ) # non-fatal
291 +
292 + elog "A minimal default .nethackrc has been placed in /etc/skel/"
293 + elog "The sysconf file is at /etc/nethack.sysconf"
294 +}