From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 8C65A158041 for ; Thu, 21 Mar 2024 02:19:43 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id A8804E29AE; Thu, 21 Mar 2024 02:19:42 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 8914DE29AA for ; Thu, 21 Mar 2024 02:19:42 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id C2E53340813 for ; Thu, 21 Mar 2024 02:19:41 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 55F591597 for ; Thu, 21 Mar 2024 02:19:40 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1710987345.7d3a275c4d3a648219cf757d3ec160e082557c2e.sam@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: games-emulation/bsnes-jg/files/, games-emulation/bsnes-jg/ X-VCS-Repository: repo/gentoo X-VCS-Files: games-emulation/bsnes-jg/bsnes-jg-1.1.2-r2.ebuild games-emulation/bsnes-jg/files/bsnes-jg-1.1.2-strict-aliasing.patch X-VCS-Directories: games-emulation/bsnes-jg/ games-emulation/bsnes-jg/files/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 7d3a275c4d3a648219cf757d3ec160e082557c2e X-VCS-Branch: master Date: Thu, 21 Mar 2024 02:19:40 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: f1add519-b7d2-46fb-9054-fd3ddf875a0d X-Archives-Hash: 0a91f2caa594e819b94472189e29fc9c commit: 7d3a275c4d3a648219cf757d3ec160e082557c2e Author: orbea riseup net> AuthorDate: Thu Mar 21 01:41:04 2024 +0000 Commit: Sam James gentoo org> CommitDate: Thu Mar 21 02:15:45 2024 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7d3a275c games-emulation/bsnes-jg: fix strict aliasing Closes: https://bugs.gentoo.org/926077 Upstream-PR: https://github.com/LIJI32/SameBoy/pull/593 Upstream-Commit: https://github.com/LIJI32/SameBoy/commit/8739da61c013e20e1cc94f0619c622a65c713408 Upstream-PR: https://gitlab.com/jgemu/bsnes/-/merge_requests/419 Upstream-Commit: https://gitlab.com/jgemu/bsnes/-/commit/966545bb79cc9810fbcedbe34fd52f7b9b5ef04e Signed-off-by: orbea riseup.net> Closes: https://github.com/gentoo/gentoo/pull/35847 Signed-off-by: Sam James gentoo.org> games-emulation/bsnes-jg/bsnes-jg-1.1.2-r2.ebuild | 53 +++++++++++++++++ .../files/bsnes-jg-1.1.2-strict-aliasing.patch | 67 ++++++++++++++++++++++ 2 files changed, 120 insertions(+) diff --git a/games-emulation/bsnes-jg/bsnes-jg-1.1.2-r2.ebuild b/games-emulation/bsnes-jg/bsnes-jg-1.1.2-r2.ebuild new file mode 100644 index 000000000000..fe035e7a3b86 --- /dev/null +++ b/games-emulation/bsnes-jg/bsnes-jg-1.1.2-r2.ebuild @@ -0,0 +1,53 @@ +# Copyright 2022-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit toolchain-funcs + +MY_PN=${PN%-*} +MY_P=${MY_PN}-${PV} +DESCRIPTION="Jolly Good Fork of bsnes" +HOMEPAGE="https://gitlab.com/jgemu/bsnes" +if [[ "${PV}" == *9999 ]] ; then + inherit git-r3 + EGIT_REPO_URI="https://gitlab.com/jgemu/${MY_PN}.git" +else + SRC_URI="https://gitlab.com/jgemu/${MY_PN}/-/archive/${PV}/${MY_P}.tar.bz2" + S="${WORKDIR}/${MY_P}" + KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86" +fi + +LICENSE="ISC GPL-3+ LGPL-2.1+ MIT ZLIB" +SLOT="1" + +DEPEND=" + media-libs/jg:1= + media-libs/libsamplerate +" +RDEPEND=" + ${DEPEND} + games-emulation/jgrf +" +BDEPEND=" + virtual/pkgconfig +" + +PATCHES=( + # https://bugs.gentoo.org/891201#c9 + "${FILESDIR}"/${P}-endianness.patch + # https://bugs.gentoo.org/926077 + "${FILESDIR}"/${P}-strict-aliasing.patch +) + +src_compile() { + emake CC="$(tc-getCC)" CXX="$(tc-getCXX)" PKG_CONFIG="$(tc-getPKG_CONFIG)" +} + +src_install() { + emake install \ + DESTDIR="${D}" \ + PREFIX="${EPREFIX}"/usr \ + DOCDIR="${EPREFIX}"/usr/share/doc/${PF} \ + LIBDIR="${EPREFIX}/usr/$(get_libdir)" +} diff --git a/games-emulation/bsnes-jg/files/bsnes-jg-1.1.2-strict-aliasing.patch b/games-emulation/bsnes-jg/files/bsnes-jg-1.1.2-strict-aliasing.patch new file mode 100644 index 000000000000..106ea27730da --- /dev/null +++ b/games-emulation/bsnes-jg/files/bsnes-jg-1.1.2-strict-aliasing.patch @@ -0,0 +1,67 @@ +https://bugs.gentoo.org/926077 +https://github.com/LIJI32/SameBoy/pull/593 +https://gitlab.com/jgemu/bsnes/-/merge_requests/419 +https://gitlab.com/jgemu/bsnes/-/commit/966545bb79cc9810fbcedbe34fd52f7b9b5ef04e + +From 966545bb79cc9810fbcedbe34fd52f7b9b5ef04e Mon Sep 17 00:00:00 2001 +From: Lior Halphon +Date: Sat, 9 Mar 2024 11:08:01 -0800 +Subject: [PATCH 1/2] Avoid strict aliasing violations. Closes #593 + +Backported from: + +https://github.com/LIJI32/SameBoy/commit/8739da61c013e20e1cc94f0619c622a65c713408 +--- + deps/gb/apu.c | 4 ++-- + deps/gb/apu.h | 11 +++++++++++ + 2 files changed, 13 insertions(+), 2 deletions(-) + +diff --git a/deps/gb/apu.c b/deps/gb/apu.c +index e621e82a..0f0ed16b 100644 +--- a/deps/gb/apu.c ++++ b/deps/gb/apu.c +@@ -100,7 +100,7 @@ static void update_sample(GB_gameboy_t *gb, GB_channel_t index, int8_t value, un + output.left = output.right = 0; + } + +- if (*(uint32_t *)&(gb->apu_output.current_sample[index]) != *(uint32_t *)&output) { ++ if (gb->apu_output.current_sample[index].packed != output.packed) { + refresh_channel(gb, index, cycles_offset); + gb->apu_output.current_sample[index] = output; + } +@@ -131,7 +131,7 @@ static void update_sample(GB_gameboy_t *gb, GB_channel_t index, int8_t value, un + if (likely(!gb->apu_output.channel_muted[index])) { + output = (GB_sample_t){(0xF - value * 2) * left_volume, (0xF - value * 2) * right_volume}; + } +- if (*(uint32_t *)&(gb->apu_output.current_sample[index]) != *(uint32_t *)&output) { ++ if (gb->apu_output.current_sample[index].packed != output.packed) { + refresh_channel(gb, index, cycles_offset); + gb->apu_output.current_sample[index] = output; + } +diff --git a/deps/gb/apu.h b/deps/gb/apu.h +index c8700c80..15b54a87 100644 +--- a/deps/gb/apu.h ++++ b/deps/gb/apu.h +@@ -25,11 +25,22 @@ + + /* APU ticks are 2MHz, triggered by an internal APU clock. */ + ++#ifdef GB_INTERNAL ++typedef union ++{ ++ struct { ++ int16_t left; ++ int16_t right; ++ }; ++ uint32_t packed; ++} GB_sample_t; ++#else + typedef struct + { + int16_t left; + int16_t right; + } GB_sample_t; ++#endif + + typedef struct + {