commit:     77a24bfc0c45de778ae23531e31a41446972bf10
Author:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 13 02:31:15 2026 +0000
Commit:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
CommitDate: Fri Mar 13 03:22:06 2026 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=77a24bfc

games-emulation/zsnes: add 2.1.0

Notable changes:
* sdl3 support (also gained sdl2 support but doing sdl3-only)
* pipewire support wrt USE=pipewire
* libao support wrt USE=ao
* parsegen was replaced by a python script, so can drop CBUILD logic
* drop zlib patch, this shouldn't matter anymore unless using a
  very old zlib
* drop duplicate .desktop, seems was overlooekd last bump when it
  started installing its own

Tried it a bit with SDL3 and seems to run fine, not that I've
really used this since early 2000s.

Signed-off-by: Ionen Wolkens <ionen <AT> gentoo.org>

 games-emulation/zsnes/Manifest                     |  1 +
 .../zsnes/files/zsnes-2.1.0-cc-quotes.patch        |  6 ++
 games-emulation/zsnes/metadata.xml                 |  3 +
 games-emulation/zsnes/zsnes-2.1.0.ebuild           | 73 ++++++++++++++++++++++
 4 files changed, 83 insertions(+)

diff --git a/games-emulation/zsnes/Manifest b/games-emulation/zsnes/Manifest
index 2a900b7a9f29..4cf9b9bd213c 100644
--- a/games-emulation/zsnes/Manifest
+++ b/games-emulation/zsnes/Manifest
@@ -1 +1,2 @@
 DIST zsnes-2.0.12.tar.gz 963569 BLAKE2B 
c11496cb5f08930dac23598ade337d9ab5d41f484b8f0ad68b1f01832d3d5ef078d65b3d639719b23eaaaf4406248eb47959b582ab7b96b142993ff532c1f3d2
 SHA512 
f321582a32a334cb32d9276c88c03db7d99c7ccce67a73a777bea6d66f3551a3013d1cfd38fda37867fb2424cde79ca4220894b27615f0f5c5a6de8ffaef037a
+DIST zsnes-2.1.0.tar.gz 1209591 BLAKE2B 
f0bc9de0cad3ee52b552a66be3dea43d63d8587b21ae016685a5917d0939b4939d51088feba8f6afc3cb881ab85d37fc2af55ef952b477a90fba87adf0d9af4e
 SHA512 
65169452bc9f31dbb2282960c57fe804980776ebd5d46cfec9e59240d3fb40f11a6720db5a77e8e3d58c2ca6b260a97ac68ed98b162aa3a6ac79458dfaef242b

diff --git a/games-emulation/zsnes/files/zsnes-2.1.0-cc-quotes.patch 
b/games-emulation/zsnes/files/zsnes-2.1.0-cc-quotes.patch
new file mode 100644
index 000000000000..b84209d83b8c
--- /dev/null
+++ b/games-emulation/zsnes/files/zsnes-2.1.0-cc-quotes.patch
@@ -0,0 +1,6 @@
+Does not expect CC may have arguments rather than being in CFLAGS, e.g. -m32
+--- a/Makefile
++++ b/Makefile
+@@ -574 +574 @@
+-      $(Q)$(PYTHON) ./$(PSR) $(CFGDEFS) -gcc $(CC_TARGET) -compile -flags 
'$(CFLAGS)' -cheader $*.h -fname $(*F) $*.o $*.psr
++      $(Q)$(PYTHON) ./$(PSR) $(CFGDEFS) -gcc '$(CC_TARGET)' -compile -flags 
'$(CFLAGS)' -cheader $*.h -fname $(*F) $*.o $*.psr

diff --git a/games-emulation/zsnes/metadata.xml 
b/games-emulation/zsnes/metadata.xml
index a775a3d1ea84..b5c71cbc9985 100644
--- a/games-emulation/zsnes/metadata.xml
+++ b/games-emulation/zsnes/metadata.xml
@@ -5,6 +5,9 @@
                <email>[email protected]</email>
                <name>Gentoo Games Project</name>
        </maintainer>
+       <use>
+               <flag name="pipewire">Enable using 
<pkg>media-video/pipewire</pkg> for audio</flag>
+       </use>
        <upstream>
                <remote-id type="github">xyproto/zsnes</remote-id>
                <remote-id type="sourceforge">zsnes</remote-id>

diff --git a/games-emulation/zsnes/zsnes-2.1.0.ebuild 
b/games-emulation/zsnes/zsnes-2.1.0.ebuild
new file mode 100644
index 000000000000..47840e93f414
--- /dev/null
+++ b/games-emulation/zsnes/zsnes-2.1.0.ebuild
@@ -0,0 +1,73 @@
+# Copyright 2021-2026 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{11..14} )
+inherit flag-o-matic multilib python-any-r1 toolchain-funcs xdg
+
+DESCRIPTION="Fork of the classic Super Nintendo emulator"
+HOMEPAGE="https://github.com/xyproto/zsnes/ https://www.zsnes.com/";
+SRC_URI="
+       https://github.com/xyproto/zsnes/archive/refs/tags/${PV}.tar.gz
+               -> ${P}.tar.gz
+"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86"
+IUSE="ao custom-cflags pipewire"
+
+RDEPEND="
+       media-libs/libglvnd[X,abi_x86_32(-)]
+       media-libs/libpng:=[abi_x86_32(-)]
+       media-libs/libsdl3[abi_x86_32(-),opengl]
+       virtual/zlib:=[abi_x86_32(-)]
+       x11-libs/libX11[abi_x86_32(-)]
+       ao? ( media-libs/libao[abi_x86_32(-)] )
+       pipewire? (  media-video/pipewire:=[abi_x86_32(-)] )
+"
+DEPEND="
+       ${RDEPEND}
+       x11-base/xorg-proto
+"
+BDEPEND="
+       ${PYTHON_DEPS}
+       dev-lang/nasm
+       virtual/pkgconfig
+       virtual/zlib:=
+"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-2.1.0-cc-quotes.patch
+)
+
+src_compile() {
+       # Makefile forces many CFLAGS that are questionable, but zsnes' ancient 
x86
+       # asm is fragile, not pic safe (bug #427104), broken by F_S=3 (formerly
+       # broken with =2 as well), and can be affected by -march=* and similar.
+       # Stick to upstream's choices, this is non-portable either way.
+       if use !custom-cflags; then
+               strip-flags
+               append-cppflags -U_FORTIFY_SOURCE # to disable =3, Makefile 
enables =2
+       fi
+
+       use amd64 && multilib_toolchain_setup x86
+       tc-export CC CXX
+       append-cflags ${CPPFLAGS}
+       append-cxxflags ${CPPFLAGS}
+
+       ZSNES_MAKEARGS=(
+               ARCH=LINUX
+               PREFIX="${EPREFIX}"/usr
+               WITH_AO=$(usex ao)
+               WITH_PIPEWIRE=$(usex pipewire)
+       )
+
+       emake "${ZSNES_MAKEARGS[@]}"
+}
+
+src_install() {
+       emake "${ZSNES_MAKEARGS[@]}" DESTDIR="${D}" install
+       einstalldocs
+}

Reply via email to