commit:     c0357ca680457591d7096eac442e001334edeb42
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Wed Dec 24 16:31:16 2025 +0000
Commit:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Wed Dec 24 17:09:30 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c0357ca6

games-engines/uzdoom: New package at 4.14.3 to replace games-fps/gzdoom

Unlike gzdoom, the nonfree USE flag has been reworked here to split out
the non-free content more precisely, allowing Freedoom and even the
commercial games to actually work, albeit suboptimally. This change is
close to being accepted upstream.

Closes: https://bugs.gentoo.org/952812
Closes: https://bugs.gentoo.org/967252
Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>

 games-engines/uzdoom/Manifest                      |   1 +
 .../uzdoom/files/uzdoom-4.14.3-build-nonfree.patch |  97 ++++++++++++++++++++
 games-engines/uzdoom/metadata.xml                  |  17 ++++
 games-engines/uzdoom/uzdoom-4.14.3.ebuild          | 101 +++++++++++++++++++++
 4 files changed, 216 insertions(+)

diff --git a/games-engines/uzdoom/Manifest b/games-engines/uzdoom/Manifest
new file mode 100644
index 000000000000..1dcc8c6d580b
--- /dev/null
+++ b/games-engines/uzdoom/Manifest
@@ -0,0 +1 @@
+DIST uzdoom-4.14.3.tar.gz 26435472 BLAKE2B 
b7d276686375222d910c1f2727d551c59c249b8ad9967c1d486b619af87d187436cc67dc020e4581de80b6d7efb53f03e96101b35b39d943f6e7673346217b4c
 SHA512 
452ee3dcb1338027886dd5555400a7e0477f1104f7edefe538af85d27565ab2506496376ebe877fea8cea6cc310b9ae2f1311fed8d62d2719f8943eb7273fd09

diff --git a/games-engines/uzdoom/files/uzdoom-4.14.3-build-nonfree.patch 
b/games-engines/uzdoom/files/uzdoom-4.14.3-build-nonfree.patch
new file mode 100644
index 000000000000..aedb46e294d4
--- /dev/null
+++ b/games-engines/uzdoom/files/uzdoom-4.14.3-build-nonfree.patch
@@ -0,0 +1,97 @@
+commit b192afc2fdbcd9e2417776a68724cad01326d4ee
+Author: James Le Cuirot <[email protected]>
+Date:   Sun Dec 21 22:28:33 2025 +0000
+
+    Add BUILD_NONFREE option so legally sensitive content can be omitted
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -63,9 +63,14 @@ if(CMAKE_CROSSCOMPILING)
+ endif()
+ 
+ # Recursive function to place PK3 archive source files into a hierarchy of 
source file in the IDE
+-function( assort_pk3_source_folder FOLDER_NAME PK3_DIR )
++function( assort_pk3_source_folder FOLDER_NAME )
+       # Assort source files into folders in the IDE
+-      file(GLOB PK3_SRCS ${PK3_DIR}/*) # Create list of all files in this 
folder
++      # Create wildcard patterns for all directories
++      set(PK3_PATTERNS)
++      foreach(PK3_DIR ${ARGN})
++              list(APPEND PK3_PATTERNS "${PK3_DIR}/*")
++      endforeach()
++      file(GLOB PK3_SRCS ${PK3_PATTERNS}) # Create list of all files in these 
folders
+       foreach(PK3_SRC ${PK3_SRCS})
+               # If there are subfolders, recurse into them
+               if(IS_DIRECTORY ${PK3_SRC})
+@@ -85,25 +90,30 @@ if( PK3_QUIET_ZIPDIR )
+       set( PK3_ZIPDIR_OPTIONS "-q" )
+ endif()
+ 
+-# Simplify pk3 building, add_pk3(filename srcdirectory)
+-function( add_pk3 PK3_NAME PK3_DIR )
++# Simplify pk3 building, add_pk3(filename srcdirectory [srcdirectory2 ...])
++function( add_pk3 PK3_NAME )
+       # Generate target name. Just use "pk3" for main pk3 target.
+       string( REPLACE "." "_" PK3_TARGET ${PK3_NAME} )
+ 
+       if( NOT ZDOOM_OUTPUT_OLDSTYLE )
+               add_custom_command( OUTPUT ${ZDOOM_OUTPUT_DIR}/${PK3_NAME}
+-                      COMMAND zipdir -udf ${PK3_ZIPDIR_OPTIONS} 
${ZDOOM_OUTPUT_DIR}/${PK3_NAME} ${PK3_DIR}
++                      COMMAND zipdir -udf ${PK3_ZIPDIR_OPTIONS} 
${ZDOOM_OUTPUT_DIR}/${PK3_NAME} ${ARGN}
+                       COMMAND ${CMAKE_COMMAND} -E copy_if_different 
${ZDOOM_OUTPUT_DIR}/${PK3_NAME} $<TARGET_FILE_DIR:zdoom>/${PK3_NAME}
+                       DEPENDS zipdir )
+       else()
+               add_custom_command( OUTPUT ${ZDOOM_OUTPUT_DIR}/${PK3_NAME}
+-                      COMMAND zipdir -udf ${PK3_ZIPDIR_OPTIONS} 
${ZDOOM_OUTPUT_DIR}/${PK3_NAME} ${PK3_DIR}
++                      COMMAND zipdir -udf ${PK3_ZIPDIR_OPTIONS} 
${ZDOOM_OUTPUT_DIR}/${PK3_NAME} ${ARGN}
+                       DEPENDS zipdir )
+       endif()
+       # Create a list of source files for this PK3, for use in the IDE
+       # Phase 1: Create a list of all source files for this PK3 archive, 
except
+       #  for a couple of strife image file names that confuse CMake.
+-      file(GLOB_RECURSE PK3_SRCS ${PK3_DIR}/*)
++      # Create wildcard patterns for all directories
++      set(PK3_PATTERNS)
++      foreach(PK3_DIR ${ARGN})
++              list(APPEND PK3_PATTERNS "${PK3_DIR}/*")
++      endforeach()
++      file(GLOB_RECURSE PK3_SRCS ${PK3_PATTERNS})
+       # Exclude from the source list some files with brackets in the
+       # file names here, because they confuse CMake.
+       # This only affects the list of source files shown in the IDE.
+@@ -126,7 +136,7 @@ function( add_pk3 PK3_NAME PK3_DIR )
+               DEPENDS ${ZDOOM_OUTPUT_DIR}/${PK3_NAME}
+               SOURCES ${PK3_SRCS})
+       # Phase 3: Assign source files to a nice folder structure in the IDE
+-      assort_pk3_source_folder("Source Files" ${PK3_DIR})
++      assort_pk3_source_folder("Source Files" ${ARGN})
+       # Phase 4: Add the resulting PK3 to the install target.
+       if( WIN32 )
+               set( INSTALL_PK3_PATH . CACHE STRING "Directory where zdoom.pk3 
will be placed during install." )
+@@ -404,6 +414,7 @@ install(DIRECTORY docs/
+               COMPONENT "Documentation")
+ 
+ option( DYN_OPENAL "Dynamically load OpenAL" ON )
++option( BUILD_NONFREE "Build non-free assets used by commercial games" ON )
+ 
+ add_subdirectory( libraries/lzma )
+ add_subdirectory( libraries/miniz )
+--- a/wadsrc_bm/CMakeLists.txt
++++ b/wadsrc_bm/CMakeLists.txt
+@@ -1 +1,3 @@
+-add_pk3(brightmaps.pk3 ${CMAKE_CURRENT_SOURCE_DIR}/static)
++if( BUILD_NONFREE )
++      add_pk3(brightmaps.pk3 ${CMAKE_CURRENT_SOURCE_DIR}/static)
++endif()
+--- a/wadsrc_extra/CMakeLists.txt
++++ b/wadsrc_extra/CMakeLists.txt
+@@ -1 +1 @@
+-add_pk3(game_support.pk3 ${CMAKE_CURRENT_SOURCE_DIR}/static)
++add_pk3(game_support.pk3 ${CMAKE_CURRENT_SOURCE_DIR}/static 
$<$<BOOL:${BUILD_NONFREE}>:${CMAKE_CURRENT_SOURCE_DIR}/nonfree>)
+--- a/wadsrc_widepix/CMakeLists.txt
++++ b/wadsrc_widepix/CMakeLists.txt
+@@ -1 +1,3 @@
+-add_pk3(game_widescreen_gfx.pk3 ${CMAKE_CURRENT_SOURCE_DIR}/static)
++if( BUILD_NONFREE )
++      add_pk3(game_widescreen_gfx.pk3 ${CMAKE_CURRENT_SOURCE_DIR}/static)
++endif()

diff --git a/games-engines/uzdoom/metadata.xml 
b/games-engines/uzdoom/metadata.xml
new file mode 100644
index 000000000000..7c0f59e04f2b
--- /dev/null
+++ b/games-engines/uzdoom/metadata.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+       <maintainer type="project">
+               <email>[email protected]</email>
+               <name>Gentoo Games Project</name>
+       </maintainer>
+       <use>
+               <flag name="non-free">Install non-free components for an 
optimal experience of commercial games</flag>
+               <flag name="swr">Enable the software renderer</flag>
+       </use>
+       <upstream>
+               <bugs-to>https://forum.zdoom.org/viewforum.php?f=2</bugs-to>
+               <doc lang="en">https://zdoom.org</doc>
+               <remote-id type="github">UZDoom/UZDoom</remote-id>
+       </upstream>
+</pkgmetadata>

diff --git a/games-engines/uzdoom/uzdoom-4.14.3.ebuild 
b/games-engines/uzdoom/uzdoom-4.14.3.ebuild
new file mode 100644
index 000000000000..826e555bd09e
--- /dev/null
+++ b/games-engines/uzdoom/uzdoom-4.14.3.ebuild
@@ -0,0 +1,101 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit cmake flag-o-matic xdg
+
+MY_PN="UZDoom"
+DESCRIPTION="Modder-friendly hardware-accelerated source port of the DOOM 
engine"
+HOMEPAGE="https://zdoom.org";
+SRC_URI="https://github.com/${MY_PN}/${MY_PN}/archive/refs/tags/${PV}.tar.gz 
-> ${P}.tar.gz"
+S="${WORKDIR}/${MY_PN}-${PV}"
+
+LICENSE="Apache-2.0 BSD BZIP2 GPL-3 LGPL-2.1+ LGPL-3 MIT
+       non-free? ( Activision ChexQuest3 DOOM-COLLECTORS-EDITION freedist 
WidePix )"
+SLOT="0"
+KEYWORDS="~amd64 ~arm64 ~ppc64"
+IUSE="debug gles2 gtk +non-free openmp +swr telemetry vulkan"
+
+DEPEND="
+       app-arch/bzip2:=
+       media-libs/libjpeg-turbo:0=
+       media-libs/libsdl2[gles2?,opengl,vulkan?]
+       media-libs/libvpx:=
+       media-libs/libwebp:=
+       media-libs/openal
+       >=media-libs/zmusic-1.1.14
+       virtual/zlib:=
+       gtk? ( x11-libs/gtk+:3 )
+"
+RDEPEND="
+       ${DEPEND}
+       !games-fps/gzdoom
+"
+BDEPEND="
+       virtual/pkgconfig
+"
+
+PATCHES=(
+       "${FILESDIR}"/${P}-build-nonfree.patch
+)
+
+src_prepare() {
+       rm -rf docs/licenses libraries/{bzip2,jpeg,zlib} || die
+       cmake_src_prepare
+
+       cat <<-EOF > "${S}/src/gitinfo.h" || die
+       // 0
+       // The above line prevents UpdateRevision.cmake from replacing this 
file.
+       // This file was generated by the Gentoo ebuild.
+
+       #define GIT_DESCRIPTION "${PV}"
+       #define GIT_HASH "0"
+       #define GIT_TIME ""
+       EOF
+
+       # Split assets into nonfree directory. This is currently being 
upstreamed.
+       # https://github.com/UZDoom/UZDoom/pull/813
+       cd wadsrc_extra || die
+       mkdir -p nonfree/sounds || die
+       mv ../wadsrc/static/sounds/dssecret.flac nonfree/sounds/ || die
+       cd static || die
+       find filter ! -path "filter/harmony/*" \( -name font.inf -o -name 
"*.lmp" -o -name "*.png" \) |
+               gtar --verbatim-files-from --remove-files -cT - | gtar -xC 
../nonfree || die
+}
+
+src_configure() {
+       # https://bugs.gentoo.org/858749
+       filter-lto
+       append-flags -fno-strict-aliasing
+
+       local mycmakeargs=(
+               -DBUILD_NONFREE=$(usex non-free)
+               -DBUILD_SHARED_LIBS=OFF
+               -DINSTALL_DOCS_PATH="${EPREFIX}/usr/share/doc/${PF}"
+               -DINSTALL_PK3_PATH="${EPREFIX}/usr/share/doom"
+               -DINSTALL_SOUNDFONT_PATH="${EPREFIX}/usr/share/doom"
+               -DDYN_OPENAL=OFF
+               -DNO_GTK=$(usex !gtk)
+               -DNO_OPENAL=OFF
+               -DHAVE_VULKAN=$(usex vulkan)
+               -DHAVE_GLES2=$(usex gles2)
+               -DNO_OPENMP=$(usex !openmp)
+               -DZDOOM_ENABLE_SWR=$(usex swr)
+               -DSEND_ANON_STATS=$(usex telemetry)
+       )
+
+       use debug || append-cppflags -DNDEBUG
+       cmake_src_configure
+}
+
+pkg_postinst() {
+       xdg_pkg_postinst
+
+       if ! use non-free ; then
+               ewarn
+               ewarn "${MY_PN} has been installed without non-free components. 
Commercial"
+               ewarn "games should still run, but the experience may be 
suboptimal."
+               ewarn
+       fi
+}

Reply via email to