commit:     026008f0e8394406119a2491ccdce9c03f8e7542
Author:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
AuthorDate: Sun Sep 24 10:55:07 2023 +0000
Commit:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
CommitDate: Sun Sep 24 17:18:43 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=026008f0

games-emulation/fceux: add 2.6.6

Changes:
* add IUSE=archive for 7z support
* rearrange pkg_check_modules in a loop to avoid repeating
  this a fourth time for libarchive and maybe more later
* pass -DGLVND=yes to avoid legacy mode

Changes adapted from PR#32020 (changed to patches):
* delete lua dlls in src_prepare rather than src_install
* allow luajit
* handle linking with libOpenGL without GLX
(ideally proper luajit/GL changes should be upstreamed though)

Technically avoiding libglvnd[-X] was not possible either way
due to qtbase[opengl,-gles2-only,-X] failing with it (and then
fceux fails to build with gles2-only), but this was recently
fixed in Qt6.9999 and is now backported to 6.5+6.6 downstream
(libglvnd[X] is still required if using Qt5).

Closes: https://github.com/gentoo/gentoo/pull/32020
Thanks-to: Haelwenn (lanodan) Monnier <contact <AT> hacktivis.me>
Signed-off-by: Ionen Wolkens <ionen <AT> gentoo.org>

 games-emulation/fceux/Manifest                     |  1 +
 games-emulation/fceux/fceux-2.6.6.ebuild           | 76 ++++++++++++++++++++++
 .../fceux/files/fceux-2.6.6-luajit.patch           | 23 +++++++
 .../fceux/files/fceux-2.6.6-no-glx.patch           |  9 +++
 games-emulation/fceux/metadata.xml                 |  1 +
 5 files changed, 110 insertions(+)

diff --git a/games-emulation/fceux/Manifest b/games-emulation/fceux/Manifest
index ad1c6decc0a1..9a97745ee2a1 100644
--- a/games-emulation/fceux/Manifest
+++ b/games-emulation/fceux/Manifest
@@ -1 +1,2 @@
 DIST fceux-2.6.5.tar.gz 23299626 BLAKE2B 
167fbe401635b96ad0c1c07826b1e7b032fa66806a2c395aebcae9d2b4295a327d2abad960a883751da43baf49f91276dd6521692406ce610df7c1ce167006ca
 SHA512 
3d37583d1917783513f05bd215437401aacda3bd1930238212cbbdd6ba105236028066d7198bfd8182e6d55ded7ce293f1e5d23295d2b730ec800dc5e5652598
+DIST fceux-2.6.6.tar.gz 23330274 BLAKE2B 
4d7779af0afc5fa12d3734d282f92b105757d204c69091b4e3574e4ced6179c5e202b752225f412d68331c9866c63b626703b014835d398ca1262deeb0d32654
 SHA512 
0a6cff4c6b900569978003675812d92d893281c2bdf3b0b58c07e257251648ee325f9bb29b01253ab1a5e9354631d91a6e67a1e6bb36ebe89d5067509cabfa64

diff --git a/games-emulation/fceux/fceux-2.6.6.ebuild 
b/games-emulation/fceux/fceux-2.6.6.ebuild
new file mode 100644
index 000000000000..429084169f18
--- /dev/null
+++ b/games-emulation/fceux/fceux-2.6.6.ebuild
@@ -0,0 +1,76 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+LUA_COMPAT=( lua5-1 luajit )
+inherit cmake lua-single xdg
+
+DESCRIPTION="Portable Famicom/NES emulator, an evolution of the original FCE 
Ultra"
+HOMEPAGE="https://fceux.com/";
+SRC_URI="
+       https://github.com/TASEmulators/fceux/archive/refs/tags/v${PV}.tar.gz
+               -> ${P}.tar.gz
+"
+
+LICENSE="GPL-2+"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="archive ffmpeg qt6 x264 x265"
+REQUIRED_USE="${LUA_REQUIRED_USE}"
+
+RDEPEND="
+       ${LUA_DEPS}
+       media-libs/libglvnd
+       media-libs/libsdl2[joystick,sound,threads,video]
+       sys-libs/zlib:=[minizip]
+       archive? ( app-arch/libarchive:= )
+       qt6? ( dev-qt/qtbase:6[gui,opengl,widgets,-gles2-only] )
+       !qt6? (
+               dev-qt/qtcore:5
+               dev-qt/qtgui:5
+               dev-qt/qtopengl:5[-gles2-only]
+               dev-qt/qtwidgets:5
+       )
+       ffmpeg? ( media-video/ffmpeg:= )
+       x264? ( media-libs/x264:= )
+       x265? ( media-libs/x265:= )
+"
+DEPEND="${RDEPEND}"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-2.4.0-desktop.patch
+       "${FILESDIR}"/${PN}-2.4.0-no-git.patch
+       "${FILESDIR}"/${PN}-2.6.6-luajit.patch
+       "${FILESDIR}"/${PN}-2.6.6-no-glx.patch
+)
+
+src_prepare() {
+       cmake_src_prepare
+
+       local use
+       for use in archive:libarchive ffmpeg:libav x264 x265; do
+               use ${use%:*} ||
+                       sed -i "/check_modules( ${use#*:} /Id" 
src/CMakeLists.txt || die
+       done
+
+       rm output/*.{chm,dll} || die # windows-only
+}
+
+src_configure() {
+       local mycmakeargs=(
+               -DGLVND=yes
+               -DPUBLIC_RELEASE=yes
+               -DQT6=$(usex qt6)
+       )
+
+       cmake_src_configure
+}
+
+src_install() {
+       local DOCS=( README TODO-SDL changelog.txt documentation/. readme.md )
+       cmake_src_install
+
+       rm "${ED}"/usr/share/doc/${PF}/fceux{,-net-server}.6 || die # duplicate
+       rm "${ED}"/usr/share/man/man6/fceux-net-server.6 || die # not used
+}

diff --git a/games-emulation/fceux/files/fceux-2.6.6-luajit.patch 
b/games-emulation/fceux/files/fceux-2.6.6-luajit.patch
new file mode 100644
index 000000000000..7d9720bd5277
--- /dev/null
+++ b/games-emulation/fceux/files/fceux-2.6.6-luajit.patch
@@ -0,0 +1,23 @@
+LuaJIT is 5.1-compatible and is maintained unlike lua5.1 itself, so
+try to allow it.
+
+Use the eclass' created unversioned lua.pc, and define the compat
+macro that is normally defined in 5.1's lauxlib.h but not luajit.
+
+TODO: an upstreamable fix involve find_package for lua (can manipulate
+preferences with cmake args), and no longer using luaL_reg at all.
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -186,3 +186,3 @@
+   # Check for LUA
+-  pkg_search_module( LUA lua5.1 lua-5.1 )
++  pkg_search_module( LUA lua )
+ 
+--- a/src/lua-engine.cpp
++++ b/src/lua-engine.cpp
+@@ -124,2 +124,5 @@
+ #include <lauxlib.h>
++#ifndef luaL_reg
++#define luaL_reg luaL_Reg
++#endif
+ #include <lualib.h>

diff --git a/games-emulation/fceux/files/fceux-2.6.6-no-glx.patch 
b/games-emulation/fceux/files/fceux-2.6.6-no-glx.patch
new file mode 100644
index 000000000000..6f2ae359c80c
--- /dev/null
+++ b/games-emulation/fceux/files/fceux-2.6.6-no-glx.patch
@@ -0,0 +1,9 @@
+Allow linking on a GLX-less system.
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -87 +87 @@
+-  find_package(OpenGL REQUIRED)
++  find_package(OpenGL REQUIRED COMPONENTS OpenGL )
+@@ -195 +195 @@
+-      set( OPENGL_LDFLAGS  ${OPENGL_LIBRARIES} )
++      set( OPENGL_LDFLAGS  OpenGL::OpenGL )

diff --git a/games-emulation/fceux/metadata.xml 
b/games-emulation/fceux/metadata.xml
index 140a0d631683..65c0533d2709 100644
--- a/games-emulation/fceux/metadata.xml
+++ b/games-emulation/fceux/metadata.xml
@@ -6,6 +6,7 @@
                <name>Gentoo Games Project</name>
        </maintainer>
        <use>
+               <flag name="archive">Use <pkg>app-arch/libarchive</pkg> for 
7zip support</flag>
                <flag name="ffmpeg">Use <pkg>media-video/ffmpeg</pkg> for video 
recording</flag>
                <flag name="x265">Use <pkg>media-libs/x265</pkg> for video 
recording (HEVC)</flag>
        </use>

Reply via email to