From 7c35f92617885751c6bcc2a6b6d3777c8565fbfa Mon Sep 17 00:00:00 2001 From: Ionen Wolkens Date: Sat, 1 Aug 2026 11:32:07 -0400 Subject: [PATCH] games-emulation/zsnes: add 2.2.3 Re-add filter-lto wrt bug #979357 given this version broke ODR again. Looking at the previous issue upstream, they also do not seem too interested in these right now and focusing on getting rid of the asm. It may make more sense to leave it there even if it works in future versions until things settle down (then could hopefully re-evaluate all the things that we filter, not just lto). There's always USE=custom-cflags if anyone really wants lto meanwhile. Bug: https://bugs.gentoo.org/979357 Signed-off-by: Ionen Wolkens --- games-emulation/zsnes/Manifest | 1 + games-emulation/zsnes/zsnes-2.2.3.ebuild | 85 ++++++++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 games-emulation/zsnes/zsnes-2.2.3.ebuild diff --git a/games-emulation/zsnes/Manifest b/games-emulation/zsnes/Manifest index eab71f40b67e8..6b99427e7e731 100644 --- a/games-emulation/zsnes/Manifest +++ b/games-emulation/zsnes/Manifest @@ -1,2 +1,3 @@ DIST zsnes-2.2.1.tar.gz 1241244 BLAKE2B 28f6f5b9acffd6109f30fbed1952866ed7952679124e7d39bd6e2004a53f3124b984489c848965fdaa882b1f488fd35259d22d6cdf3bd6cf5ce7bafb2bc5f5a1 SHA512 599fe81b296e00ad47158d57fc1d844ebd58639054b4d39c3a961bb8c9a057c1132b2dd9c5476bccb96da7bd5cf54073e76db54e2cb0a75d080ade73e3795214 DIST zsnes-2.2.2.tar.gz 1272812 BLAKE2B d95b71f3d4136e7aeb7ce0ba210a2f9700be082fa2abe2b25ccd688699f67a6adaa960d15f1f1e7ea342ffad902d6bc3ae31dfba000921e5109c85c4f1d8449d SHA512 3c31991221f531dee1c74465b3545465d89a85bd4429ca6650d1525b43e54dc7a7e8e0549971df4ecaeaa73530e352c3c6b6cec54515542bc5682e8ff46b8ef3 +DIST zsnes-2.2.3.tar.gz 1332451 BLAKE2B def6c74f63fc2bae0a7041306efc8cf7e35c24ca4c4a81ca51ff07b781ac7f990a23015ef8fc6af155c718a4ed67e2a37a91e1758e25c59a80a76918242b9334 SHA512 fb61d44fef6e80eb70c6c5e0658cce5fb2c365c96a2cb40c959b60672ef09665405f6fd0753ba95ff65ce3abab881bfe05c1a182e21da889710c41e12385b6b9 diff --git a/games-emulation/zsnes/zsnes-2.2.3.ebuild b/games-emulation/zsnes/zsnes-2.2.3.ebuild new file mode 100644 index 0000000000000..98efce6bb1f73 --- /dev/null +++ b/games-emulation/zsnes/zsnes-2.2.3.ebuild @@ -0,0 +1,85 @@ +# Copyright 2021-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{12..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(-)] + ao? ( media-libs/libao[abi_x86_32(-)] ) + pipewire? ( media-video/pipewire:=[abi_x86_32(-)] ) +" +DEPEND="${RDEPEND}" +BDEPEND=" + ${PYTHON_DEPS} + dev-lang/nasm + sys-devel/gcc:* + 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 + + # furthermore fails with -Werror=strict-aliasing+lto-type-mismatch + # https://github.com/xyproto/zsnes/issues/59#issuecomment-5024118435 + append-cflags -fno-strict-aliasing + filter-lto + fi + + # zsnes passes -mno-sse while profiles do -mfpmath=sse -- gcc will fallback + # to 387, but clang errors out at the combination (bug #884827) + append-flags -mfpmath=387 + + # asm issues with clang (bug #830491), the asm may never get fixed at this + # point but zsnes is slowly porting it to C and so may work eventually + if tc-is-clang; then + CC=${CHOST}-gcc + strip-unsupported-flags + fi + + use amd64 && multilib_toolchain_setup x86 + tc-export CC PKG_CONFIG + append-cflags ${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 +}