commit:     f91dbfff15725550ce099f1d5fdb6192bed00236
Author:     Azamat H. Hackimov <azamat.hackimov <AT> gmail <DOT> com>
AuthorDate: Mon Jun  9 14:01:32 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Jun 12 11:34:51 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f91dbfff

app-emulation/punes: fix build with Qt 6.9

Closes: https://bugs.gentoo.org/957576
Signed-off-by: Azamat H. Hackimov <azamat.hackimov <AT> gmail.com>
Part-of: https://github.com/gentoo/gentoo/pull/42517
Closes: https://github.com/gentoo/gentoo/pull/42517
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/punes-0.111-qt6.9-compatibility.patch    | 50 +++++++++++++++++++
 app-emulation/punes/punes-0.111-r2.ebuild          | 57 ++++++++++++++++++++++
 2 files changed, 107 insertions(+)

diff --git a/app-emulation/punes/files/punes-0.111-qt6.9-compatibility.patch 
b/app-emulation/punes/files/punes-0.111-qt6.9-compatibility.patch
new file mode 100644
index 000000000000..a9befea9bb35
--- /dev/null
+++ b/app-emulation/punes/files/punes-0.111-qt6.9-compatibility.patch
@@ -0,0 +1,50 @@
+From 
https://github.com/punesemu/puNES/commit/ff906e0a79eeac9a2d16783e0accf65748bb275e
+From: Fabio Cavallo <[email protected]>
+Date: Fri, 9 May 2025 16:24:54 +0200
+Subject: [PATCH] Updated code for Qt 6.9.0 compatibility (#423).
+
+--- a/src/gui/qt.cpp
++++ b/src/gui/qt.cpp
+@@ -1137,8 +1137,8 @@ BYTE gui_load_lut(void *l, const uTCHAR *path) {
+       return (EXIT_OK);
+ }
+ void gui_save_screenshot(int w, int h, int stride, char *buffer, BYTE flip) {
+-      QString basename = QString(uQString(gui_data_folder())) + 
QString(SCRSHT_FOLDER) + "/"
+-              + QFileInfo(uQString(info.rom.file)).completeBaseName();
++      QString basename = QString(uQString(gui_data_folder())) + 
QString(SCRSHT_FOLDER) + "/" +
++              QFileInfo(uQString(info.rom.file)).completeBaseName();
+       QImage screenshot = QImage((uchar *)buffer, w, h, stride, 
QImage::Format_RGB32);
+       QFile file;
+       uint count = 0;
+@@ -1148,7 +1148,7 @@ void gui_save_screenshot(int w, int h, int stride, char 
*buffer, BYTE flip) {
+       }
+ 
+       for (count = 1; count < 999999; count++) {
+-              QString final = basename + QString("_%1.png").arg(count, 6, 
'd', 0, '0');
++              QString final = basename + QString("_%1.png").arg(count, 6, 10, 
QChar(u'0'));
+ 
+               if (!QFileInfo::exists(final)) {
+                       file.setFileName(final);
+@@ -1157,7 +1157,11 @@ void gui_save_screenshot(int w, int h, int stride, char 
*buffer, BYTE flip) {
+       }
+ 
+       if (flip) {
++#if QT_VERSION < QT_VERSION_CHECK(6, 9, 0)
+               screenshot = screenshot.mirrored(false, true);
++#else
++              screenshot = screenshot.flipped(Qt::Vertical);
++#endif
+       }
+ 
+       file.open(QIODevice::WriteOnly);
+--- a/src/gui/wdgStatusBar.cpp
++++ b/src/gui/wdgStatusBar.cpp
+@@ -137,7 +137,7 @@ void alignmentStatusBar::update_label(void) {
+       if (cfg->ppu_alignment == PPU_ALIGMENT_DEFAULT) {
+               hide();
+       } else {
+-              label->setText(QString("c%0p%1").arg(ppu_alignment.cpu, 2, 'd', 
0, '0').arg(ppu_alignment.ppu));
++              label->setText(QString("c%0p%1").arg(ppu_alignment.cpu, 2, 10, 
QChar(u'0')).arg(ppu_alignment.ppu));
+               show();
+       }
+ }

diff --git a/app-emulation/punes/punes-0.111-r2.ebuild 
b/app-emulation/punes/punes-0.111-r2.ebuild
new file mode 100644
index 000000000000..2b912cba522a
--- /dev/null
+++ b/app-emulation/punes/punes-0.111-r2.ebuild
@@ -0,0 +1,57 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit cmake xdg
+
+DESCRIPTION="Nintendo Entertainment System (NES) emulator"
+HOMEPAGE="https://github.com/punesemu/puNES";
+SRC_URI="https://github.com/punesemu/puNES/archive/v${PV}.tar.gz -> 
${P}.tar.gz"
+S="${WORKDIR}/puNES-${PV}"
+
+LICENSE="GPL-2+"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="X cg ffmpeg"
+
+RDEPEND="
+       dev-qt/qtbase:6[gui,network,opengl,widgets]
+       dev-qt/qtsvg:6
+       media-libs/alsa-lib
+       media-libs/libglvnd[X?]
+       virtual/glu
+       virtual/udev
+       X? (
+               x11-libs/libX11
+               x11-libs/libXrandr
+       )
+       cg? ( media-gfx/nvidia-cg-toolkit )
+       ffmpeg? ( media-video/ffmpeg:= )
+"
+
+DEPEND="
+       ${RDEPEND}
+       X? ( x11-base/xorg-proto )"
+BDEPEND="
+       virtual/pkgconfig
+       dev-qt/qttools[linguist]
+"
+
+PATCHES=(
+       "${FILESDIR}/punes-0.111-FULLSCREEN_RESFREQ-fix.patch"
+       "${FILESDIR}/punes-0.111-qt6.7_Q_OBJECT.patch"
+       "${FILESDIR}/punes-0.111-qt6.9-compatibility.patch"
+)
+
+src_configure() {
+       local mycmakeargs=(
+               -DENABLE_GIT_INFO=OFF
+               -DENABLE_QT6_LIBS=ON
+               -DDISABLE_PORTABLE_MODE=OFF
+               -DENABLE_FFMPEG=$(usex ffmpeg)
+               -DENABLE_FULLSCREEN_RESFREQ=$(usex X)
+               -DENABLE_OPENGL_CG=$(usex cg)
+       )
+       cmake_src_configure
+}

Reply via email to