commit:     0d7f30b49137598c7abc5bab3469a75733274fe3
Author:     Alexander Tsoy <alexander <AT> tsoy <DOT> me>
AuthorDate: Mon Jun 23 00:17:51 2025 +0000
Commit:     Lucio Sauer <watermanpaint <AT> posteo <DOT> net>
CommitDate: Mon Jun 23 00:37:16 2025 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=0d7f30b4

games-fps/quakespasm: add 0.96.3

Signed-off-by: Alexander Tsoy <alexander <AT> tsoy.me>

 games-fps/quakespasm/Manifest                      |  1 +
 .../files/quakespasm-0.96.3-cflags.patch           | 10 +++
 .../quakespasm-0.96.3-mkpak-portable-shell.patch   | 62 +++++++++++++++
 games-fps/quakespasm/quakespasm-0.96.3.ebuild      | 91 ++++++++++++++++++++++
 games-fps/quakespasm/quakespasm-9999.ebuild        | 83 +++++++++++++++-----
 5 files changed, 229 insertions(+), 18 deletions(-)

diff --git a/games-fps/quakespasm/Manifest b/games-fps/quakespasm/Manifest
index 851f94c754..e4cf96e888 100644
--- a/games-fps/quakespasm/Manifest
+++ b/games-fps/quakespasm/Manifest
@@ -1 +1,2 @@
 DIST quakespasm-0.94.1.tar.gz 9900452 BLAKE2B 
21fc363d09e1fbf8f8217d54ad18e38e51e715dc4fe92d591d605b24bae52f9554159c4cc4c97842e6e3e34efb8d422c5a5fe5edc91ae354f97935ae23051047
 SHA512 
17b7fc74a5e3932b6341c36d957f86ffc01e88013971be2eb4252b57fceecaebeb5cd9a67619ebd38422dfe0fbdbe06a5e5486dcf82ff17fb7d1b0ba664b1cf0
+DIST quakespasm-0.96.3.tar.gz 11552047 BLAKE2B 
70412a86b549995011bf3e68f20f2b997ed22dcc2db49c2c107326f0db58205f14efcfcacb6c29f7c198051b8e4d8fbea42dd489d1b4b368fb7bcc530a70b8f5
 SHA512 
e8500d566a6cc6532c81823aa7775a48d9edcecc053528477d3c360ba17b8895b5fbda20b2679f571c9996da58d411eed1f975ef9435beb63a3261c14082f18e

diff --git a/games-fps/quakespasm/files/quakespasm-0.96.3-cflags.patch 
b/games-fps/quakespasm/files/quakespasm-0.96.3-cflags.patch
new file mode 100644
index 0000000000..7b402d8d08
--- /dev/null
+++ b/games-fps/quakespasm/files/quakespasm-0.96.3-cflags.patch
@@ -0,0 +1,10 @@
+--- a/Quake/Makefile   2022-06-28 03:02:56.000000000 +0300
++++ b/Quake/Makefile   2022-09-30 19:05:39.392041782 +0300
+@@ -61,7 +61,6 @@ CFLAGS += -g
+ do_strip=
+ else
+ DFLAGS += -DNDEBUG
+-CFLAGS += -O2
+ #CFLAGS += -fno-asynchronous-unwind-tables
+ CFLAGS += $(call check_gcc,-fweb,)
+ CFLAGS += $(call check_gcc,-frename-registers,)

diff --git 
a/games-fps/quakespasm/files/quakespasm-0.96.3-mkpak-portable-shell.patch 
b/games-fps/quakespasm/files/quakespasm-0.96.3-mkpak-portable-shell.patch
new file mode 100644
index 0000000000..891267e4b8
--- /dev/null
+++ b/games-fps/quakespasm/files/quakespasm-0.96.3-mkpak-portable-shell.patch
@@ -0,0 +1,62 @@
+From dd8a42d142a638de08cb6ea7483e33b27fe221b5 Mon Sep 17 00:00:00 2001
+From: Alexander Tsoy <[email protected]>
+Date: Thu, 19 Jun 2025 18:10:04 +0300
+Subject: [PATCH] mkpak.sh: use more portable shell
+
+At least it now works in dash
+---
+ Misc/qs_pak/mkpak.sh | 16 ++++++----------
+ 1 file changed, 6 insertions(+), 10 deletions(-)
+
+diff --git a/Misc/qs_pak/mkpak.sh b/Misc/qs_pak/mkpak.sh
+index e6562bf9..dbfd9eb5 100755
+--- a/Misc/qs_pak/mkpak.sh
++++ b/Misc/qs_pak/mkpak.sh
+@@ -39,7 +39,7 @@ assert_valid_file() {
+       then
+               error "$1: Permission denied"
+       fi
+-      if test $(echo -n "$1" | wc -c) -gt 55
++      if test $(printf '%s' "$1" | wc -c) -gt 55
+       then
+               error "$1: Name too long"
+       fi
+@@ -53,15 +53,11 @@ assert_valid_int32() {
+ }
+ 
+ octal() {
+-      if test $1 -gt 7
+-      then
+-              octal $(expr $1 / 8)
+-      fi
+-      echo -n $(expr $1 % 8) 
++      printf '%o' $1
+ }
+ 
+ byte() {
+-      echo -en \\0$(octal $1)
++      printf '%b' "\\0$(octal $1)"
+ }
+ 
+ little_endian_uint32() {
+@@ -90,14 +86,14 @@ zero_padding() {
+ }
+ 
+ header() {
+-      echo -n PACK
++      printf '%s' PACK
+       little_endian_int32 $1
+       little_endian_int32 $2
+ }
+ 
+ directory_entry() {
+-      echo -n "$1"
+-      zero_padding $(expr 56 - $(echo -n "$1" | wc -c))
++      printf '%s' "$1"
++      zero_padding $(expr 56 - $(printf '%s' "$1" | wc -c))
+       little_endian_int32 $2
+       little_endian_int32 $3
+ }
+-- 
+2.49.0
+

diff --git a/games-fps/quakespasm/quakespasm-0.96.3.ebuild 
b/games-fps/quakespasm/quakespasm-0.96.3.ebuild
new file mode 100644
index 0000000000..b35953f345
--- /dev/null
+++ b/games-fps/quakespasm/quakespasm-0.96.3.ebuild
@@ -0,0 +1,91 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+if [[ "${PV}" == "9999" ]]; then
+       inherit git-r3
+       EGIT_REPO_URI="https://git.code.sf.net/p/quakespasm/quakespasm";
+else
+       SRC_URI="https://download.sourceforge.net/quakespasm/Source/${P}.tar.gz";
+       KEYWORDS="~amd64"
+fi
+
+inherit desktop eapi9-ver
+
+DESCRIPTION="A modern, cross-platform Quake game engine based on FitzQuake"
+HOMEPAGE="https://quakespasm.sourceforge.net/";
+
+LICENSE="GPL-2+"
+SLOT="0"
+IUSE="flac mikmod modplug mp3 opus vorbis"
+
+DEPEND="
+       media-libs/libsdl2[opengl]
+       media-libs/libglvnd
+       flac? ( media-libs/flac:= )
+       mikmod? ( media-libs/libmikmod )
+       modplug? ( media-libs/libmodplug )
+       mp3? ( media-sound/mpg123 )
+       opus? ( media-libs/opusfile )
+       vorbis? ( media-libs/libvorbis )
+"
+RDEPEND="${DEPEND}"
+BDEPEND="virtual/pkgconfig"
+
+DOCS=( Quakespasm.html Quakespasm.txt Quakespasm-Music.txt )
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-0.96.3-cflags.patch
+       "${FILESDIR}"/${P}-mkpak-portable-shell.patch # 
https://github.com/sezero/quakespasm/pull/127
+)
+
+src_compile() {
+       local emakeargs=(
+               COMMON_LIBS="-lOpenGL -lm"
+               LDFLAGS="${LDFLAGS}"
+               DO_USERDIRS=1
+               MP3LIB=mpg123
+               STRIP="$(type -P true)"
+               USE_SDL2=1
+               USE_CODEC_FLAC=$(usex flac 1 0)
+               USE_CODEC_MIKMOD=$(usex mikmod 1 0)
+               USE_CODEC_MODPLUG=$(usex modplug 1 0)
+               USE_CODEC_MP3=$(usex mp3 1 0)
+               USE_CODEC_VORBIS=$(usex vorbis 1 0)
+               USE_CODEC_OPUS=$(usex opus 1 0)
+       )
+
+       emake -C Quake "${emakeargs[@]}"
+       emake -C Misc/qs_pak
+}
+
+src_install() {
+       dobin Quake/quakespasm
+
+       insinto /usr/share/quakespasm
+       doins Misc/qs_pak/quakespasm.pak
+
+       insinto /usr/share/metainfo
+       doins Linux/net.sourceforge.quakespasm.Quakespasm.appdata.xml
+
+       domenu Linux/net.sourceforge.quakespasm.Quakespasm.desktop
+
+       newicon Misc/QuakeSpasm_512.png 
net.sourceforge.quakespasm.Quakespasm.png
+
+       einstalldocs
+}
+
+pkg_postinst() {
+       if [[ -z ${REPLACING_VERSIONS} ]] || ver_replacing -lt 0.96.3; then
+               elog
+               elog "Please note that quakespasm doesn't support system-wide 
game data."
+               elog "In order to play, you must copy game data files into"
+               elog "\"~/.quakespasm/\" directory."
+               elog
+               elog "It is also recommended to copy quakespasm.pak as it 
contains default"
+               elog "config, custom console background and other minor 
features:"
+               elog "cp \"${EROOT}/usr/share/quakespasm/quakespasm.pak\" 
~/.quakespasm/"
+               elog
+       fi
+}

diff --git a/games-fps/quakespasm/quakespasm-9999.ebuild 
b/games-fps/quakespasm/quakespasm-9999.ebuild
index 06e9ceb72e..2481b28dd8 100644
--- a/games-fps/quakespasm/quakespasm-9999.ebuild
+++ b/games-fps/quakespasm/quakespasm-9999.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Gentoo Authors
+# Copyright 1999-2025 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -7,37 +7,84 @@ if [[ "${PV}" == "9999" ]]; then
        inherit git-r3
        EGIT_REPO_URI="https://git.code.sf.net/p/quakespasm/quakespasm";
 else
-       
SRC_URI="https://downloads.sourceforge.net/project/${PN}/Source/${P}.tar.gz";
+       SRC_URI="https://download.sourceforge.net/quakespasm/Source/${P}.tar.gz";
        KEYWORDS="~amd64"
 fi
 
-DESCRIPTION="Modern, cross-platform Quake 1 engine based on FitzQuake"
-HOMEPAGE="https://quakespasm.sourceforge.net";
-LICENSE="GPL-2"
+inherit desktop eapi9-ver
+
+DESCRIPTION="A modern, cross-platform Quake game engine based on FitzQuake"
+HOMEPAGE="https://quakespasm.sourceforge.net/";
+
+LICENSE="GPL-2+"
 SLOT="0"
-IUSE="sdl2"
+IUSE="flac mikmod modplug mp3 opus vorbis"
 
 DEPEND="
+       media-libs/libsdl2[opengl]
        media-libs/libglvnd
-       media-libs/libmad
-       media-libs/libvorbis
-       sdl2? ( media-libs/libsdl2[opengl] )
-       !sdl2? ( media-libs/libsdl[opengl] )
+       flac? ( media-libs/flac:= )
+       mikmod? ( media-libs/libmikmod )
+       modplug? ( media-libs/libmodplug )
+       mp3? ( media-sound/mpg123 )
+       opus? ( media-libs/opusfile )
+       vorbis? ( media-libs/libvorbis )
 "
 RDEPEND="${DEPEND}"
-DOCS=( Quakespasm.html  Quakespasm-Music.txt  Quakespasm.txt )
+BDEPEND="virtual/pkgconfig"
 
-src_prepare() {
-       sed -i '/^CFLAGS += -O2$/d' Quake/Makefile || die
-       default
-}
+DOCS=( Quakespasm.html Quakespasm.txt Quakespasm-Music.txt )
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-0.96.3-cflags.patch
+)
 
 src_compile() {
-       cd Quake || die
-       emake COMMON_LIBS="-lm -lOpenGL" USE_SDL2=$(usex sdl2 1 0) 
STRIP="/bin/true"
+       local emakeargs=(
+               COMMON_LIBS="-lOpenGL -lm"
+               LDFLAGS="${LDFLAGS}"
+               DO_USERDIRS=1
+               MP3LIB=mpg123
+               STRIP="$(type -P true)"
+               USE_SDL2=1
+               USE_CODEC_FLAC=$(usex flac 1 0)
+               USE_CODEC_MIKMOD=$(usex mikmod 1 0)
+               USE_CODEC_MODPLUG=$(usex modplug 1 0)
+               USE_CODEC_MP3=$(usex mp3 1 0)
+               USE_CODEC_VORBIS=$(usex vorbis 1 0)
+               USE_CODEC_OPUS=$(usex opus 1 0)
+       )
+
+       emake -C Quake "${emakeargs[@]}"
+       emake -C Misc/qs_pak
 }
 
 src_install() {
-       einstalldocs
        dobin Quake/quakespasm
+
+       insinto /usr/share/quakespasm
+       doins Misc/qs_pak/quakespasm.pak
+
+       insinto /usr/share/metainfo
+       doins Linux/net.sourceforge.quakespasm.Quakespasm.appdata.xml
+
+       domenu Linux/net.sourceforge.quakespasm.Quakespasm.desktop
+
+       newicon Misc/QuakeSpasm_512.png 
net.sourceforge.quakespasm.Quakespasm.png
+
+       einstalldocs
+}
+
+pkg_postinst() {
+       if [[ -z ${REPLACING_VERSIONS} ]] || ver_replacing -lt 0.96.3; then
+               elog
+               elog "Please note that quakespasm doesn't support system-wide 
game data."
+               elog "In order to play, you must copy game data files into"
+               elog "\"~/.quakespasm/\" directory."
+               elog
+               elog "It is also recommended to copy quakespasm.pak as it 
contains default"
+               elog "config, custom console background and other minor 
features:"
+               elog "cp \"${EROOT}/usr/share/quakespasm/quakespasm.pak\" 
~/.quakespasm/"
+               elog
+       fi
 }

Reply via email to