Gentoo Archives: gentoo-commits

From: Ionen Wolkens <ionen@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: games-emulation/zsnes/, games-emulation/zsnes/files/
Date: Wed, 22 Dec 2021 18:15:06
Message-Id: 1640196746.484cf796cfa38577842783be53a79346b65a8dcf.ionen@gentoo
1 commit: 484cf796cfa38577842783be53a79346b65a8dcf
2 Author: Ionen Wolkens <ionen <AT> gentoo <DOT> org>
3 AuthorDate: Wed Dec 22 10:53:17 2021 +0000
4 Commit: Ionen Wolkens <ionen <AT> gentoo <DOT> org>
5 CommitDate: Wed Dec 22 18:12:26 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=484cf796
7
8 games-emulation/zsnes: add 2.0.9 (fork) with new dumbed down ebuild
9
10 zsnes is very fragile, and supporting many configurations/flags
11 doesn't seem worth it anymore. So this uses current upstream
12 defaults for safety (no libao+debugger, and enable sdl+png+opengl).
13
14 May possibly have some new issues / regressions to iron out, notably
15 given doesn't use autoconf anymore which shifted many things around.
16
17 Unsure if this fork will be maintained on the long term, if not
18 then this package may be better off last-rited.
19
20 bug 817395: fork uses FORTIFY_SOURCE=0 which combined with -U should
21 ensure it's unused even if our gcc enables it by default
22 (issue does exist still, was able to reproduce if letting it use it)
23 bug 829785: cause is unknown but can't reproduce when using the fork
24
25 Closes: https://bugs.gentoo.org/817395
26 Closes: https://bugs.gentoo.org/829785
27 Signed-off-by: Ionen Wolkens <ionen <AT> gentoo.org>
28
29 games-emulation/zsnes/Manifest | 1 +
30 .../zsnes/files/zsnes-2.0.9-cc-quotes.patch | 8 +++
31 .../zsnes/files/zsnes-2.0.9-gentoo-zlib.patch | 12 +++++
32 games-emulation/zsnes/zsnes-2.0.9.ebuild | 62 ++++++++++++++++++++++
33 4 files changed, 83 insertions(+)
34
35 diff --git a/games-emulation/zsnes/Manifest b/games-emulation/zsnes/Manifest
36 index 23bb4c0f0963..84c9a0519a79 100644
37 --- a/games-emulation/zsnes/Manifest
38 +++ b/games-emulation/zsnes/Manifest
39 @@ -1 +1,2 @@
40 DIST zsnes-1.51-20071031.tar.bz2 1072340 BLAKE2B d67c92e382ca130d4138d21fbb2effc06539d1c7e3aabf0339c9b7e773521daf2d3cb0bcef75991e1a4453fcc86903d3dead48d90806489c8b4bf7677f8ebf3b SHA512 b10373cf81b201a33dc60c728431d4f69d36de31fcf6f137b623ea206a2998f722dcd6132daec1d0bf14a05ae52f3ee9ecee4334517039be554db85c9f7b8274
41 +DIST zsnes-2.0.9.tar.gz 935183 BLAKE2B a9b72ed15b2ed6d9e4631b4f12b2291ddca76a7236da008eba0f8b3ee27c94b98f00ff16a4929929adf484bc16554474b942b9f8306f46ab713e8a40e1f64624 SHA512 ea9244e98a175db9bceddf14e8212b3474ddaba1f508d698d8cfc43270fa3dabf51dca43dd30255272aba3cd061bf450bef04e005ce8087d550400e66faea565
42
43 diff --git a/games-emulation/zsnes/files/zsnes-2.0.9-cc-quotes.patch b/games-emulation/zsnes/files/zsnes-2.0.9-cc-quotes.patch
44 new file mode 100644
45 index 000000000000..d2615149601b
46 --- /dev/null
47 +++ b/games-emulation/zsnes/files/zsnes-2.0.9-cc-quotes.patch
48 @@ -0,0 +1,8 @@
49 +Does not expect CC may have arguments rather than being in CFLAGS, e.g. -m32
50 +--- a/Makefile
51 ++++ b/Makefile
52 +@@ -355,3 +355,3 @@
53 + @echo '===> PSR $@'
54 +- $(Q)./$(PSR) $(CFGDEFS) -gcc $(CC_TARGET) -compile -flags '$(CFLAGS)' -cheader $@ -fname $(*F) $(@:.h=.o) $<
55 ++ $(Q)./$(PSR) $(CFGDEFS) -gcc '$(CC_TARGET)' -compile -flags '$(CFLAGS)' -cheader $@ -fname $(*F) $(@:.h=.o) $<
56 +
57
58 diff --git a/games-emulation/zsnes/files/zsnes-2.0.9-gentoo-zlib.patch b/games-emulation/zsnes/files/zsnes-2.0.9-gentoo-zlib.patch
59 new file mode 100644
60 index 000000000000..a5b5f584e177
61 --- /dev/null
62 +++ b/games-emulation/zsnes/files/zsnes-2.0.9-gentoo-zlib.patch
63 @@ -0,0 +1,12 @@
64 +Gentoo-specific workaround due to https://bugs.gentoo.org/383179
65 +--- a/zip/zunzip.h
66 ++++ b/zip/zunzip.h
67 +@@ -48,4 +48,8 @@
68 + #include <zlib.h>
69 +
70 ++#ifndef OF
71 ++#define OF _Z_OF
72 ++#endif
73 ++
74 + #if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP)
75 + /* like the STRICT of WIN32, we define a pointer that cannot be converted
76
77 diff --git a/games-emulation/zsnes/zsnes-2.0.9.ebuild b/games-emulation/zsnes/zsnes-2.0.9.ebuild
78 new file mode 100644
79 index 000000000000..a948fb8c0346
80 --- /dev/null
81 +++ b/games-emulation/zsnes/zsnes-2.0.9.ebuild
82 @@ -0,0 +1,62 @@
83 +# Copyright 2021 Gentoo Authors
84 +# Distributed under the terms of the GNU General Public License v2
85 +
86 +EAPI=8
87 +
88 +inherit desktop flag-o-matic multilib toolchain-funcs
89 +
90 +DESCRIPTION="Fork of the classic Super Nintendo emulator"
91 +HOMEPAGE="https://github.com/xyproto/zsnes/ https://www.zsnes.com/"
92 +SRC_URI="https://github.com/xyproto/zsnes/archive/${PV}.tar.gz -> ${P}.tar.gz"
93 +
94 +LICENSE="GPL-2"
95 +SLOT="0"
96 +KEYWORDS="-* ~amd64 ~x86 ~amd64-linux ~x86-linux"
97 +IUSE="custom-cflags"
98 +
99 +RDEPEND="
100 + media-libs/libpng:=[abi_x86_32(-)]
101 + media-libs/libsdl[abi_x86_32(-),joystick,opengl,sound,video]
102 + sys-libs/zlib:=[abi_x86_32(-)]
103 + virtual/opengl[abi_x86_32(-)]
104 + x11-libs/libX11[abi_x86_32(-)]"
105 +DEPEND="
106 + ${RDEPEND}
107 + x11-base/xorg-proto"
108 +BDEPEND="
109 + dev-lang/nasm
110 + sys-libs/zlib
111 + virtual/pkgconfig"
112 +
113 +PATCHES=(
114 + "${FILESDIR}"/${PN}-2.0.9-cc-quotes.patch
115 + "${FILESDIR}"/${PN}-2.0.9-gentoo-zlib.patch
116 +)
117 +
118 +src_compile() {
119 + # config.linux forces many CFLAGS that are questionable, but zsnes'
120 + # ancient x86 asm is very fragile, not pic safe (bug #427104), broken
121 + # by FORTIFY_SOURCE (bug #257963), and can be affected by -march=* and
122 + # similar. Stick to upstream's choices, this is non-portable either way.
123 + use custom-cflags || strip-flags
124 + append-cppflags -U_FORTIFY_SOURCE
125 +
126 + # used to build and run parsegen at build time (uses zlib wrt BDEPEND)
127 + local buildcxx="$(tc-getBUILD_CXX) ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}"
128 +
129 + use amd64 && multilib_toolchain_setup x86
130 + tc-export CC CXX
131 + append-cflags "${CPPFLAGS}"
132 + append-cxxflags "${CPPFLAGS}"
133 +
134 + emake CXX_HOST="${buildcxx}"
135 +}
136 +
137 +src_install() {
138 + emake DESTDIR="${D}" PREFIX="${EPREFIX}"/usr install
139 +
140 + dodoc README.md TODO.md
141 +
142 + newicon icons/64x64x32.png ${PN}.png
143 + make_desktop_entry ${PN} ${PN^^}
144 +}