From facbbc8846b0a44c952a76af771d53ddda8fd8b1 Mon Sep 17 00:00:00 2001 From: Josh Megnauth <jo.sh@tutanota.com> Date: Sun, 13 Oct 2024 03:06:45 -0400 Subject: [PATCH] package(games): QuakeSpasm, a Quake 1 source port QuakeSpasm is a simple source port that primarily focuses on bug fixes and backwards compatibility. Its build system is a small Makefile which required a few patches in order to compile on Redox. Currently, it compiles with both SDL1 and SDL2. MP3 support is hard disabled since neither `libmad` nor `mpg123` would compile. However, the default OGG container and Vorbis decoder compiles fine. Like Doom, Quake requires commercial assets or free replications in order to run. I'm currently trying to write a small recipe for the shareware files, but ironically that has more blockers than the source port itself. Beyond the lack of content, I think this port is good to go. --- recipes/games/quakespasm/manifest | 4 + recipes/games/quakespasm/recipe.toml | 48 ++++++++ recipes/games/quakespasm/redox.patch | 110 ++++++++++++++++++ .../wip/games/fps/quake1-shareware/manifest | 3 + .../games/fps/quake1-shareware/pak0.pak.sha | 1 + .../fps/quake1-shareware/quake106.zip.sha | 1 + .../games/fps/quake1-shareware/recipe.toml | 24 ++++ 7 files changed, 191 insertions(+) create mode 100644 recipes/games/quakespasm/manifest create mode 100644 recipes/games/quakespasm/recipe.toml create mode 100644 recipes/games/quakespasm/redox.patch create mode 100644 recipes/wip/games/fps/quake1-shareware/manifest create mode 100644 recipes/wip/games/fps/quake1-shareware/pak0.pak.sha create mode 100644 recipes/wip/games/fps/quake1-shareware/quake106.zip.sha create mode 100644 recipes/wip/games/fps/quake1-shareware/recipe.toml diff --git a/recipes/games/quakespasm/manifest b/recipes/games/quakespasm/manifest new file mode 100644 index 000000000..814d6b06e --- /dev/null +++ b/recipes/games/quakespasm/manifest @@ -0,0 +1,4 @@ +name=QuakeSpasm +category=Games +binary=/usr/games/quakespasm +icon=/ui/icons/apps/quakespasm.png diff --git a/recipes/games/quakespasm/recipe.toml b/recipes/games/quakespasm/recipe.toml new file mode 100644 index 000000000..1d5d069e6 --- /dev/null +++ b/recipes/games/quakespasm/recipe.toml @@ -0,0 +1,48 @@ +# TODO: Promote + +# Version: 0.96.3 +# Version date: 31-July-2024 + +[source] +git = "https://github.com/sezero/quakespasm" +rev = "cc32abe09ed417ce3be10af300d2dc2f686349ba" +patches = ["redox.patch"] + +[build] +template = "custom" +dependencies = [ + "llvm18", + "libiconv", + "libogg", + "liborbital", + "libvorbis", + "mesa", + # "sdl1", + "sdl2", + "zlib", +] +script = """ +# Skip configuring because QuakeSpasm uses a custom build system +COOKBOOK_CONFIGURE="true" +COOKBOOK_CONFIGURE_FLAGS="" + +# Ensure the build system is aware of Redox +# The build system uses sdl-config for Unix, but SDL recommends using pkg-config +export HOST_OS="redox" +export PKG_CONFIG="${TARGET}-pkg-config" + +# Config options for the Makefile. Set as necessary (see Makefile). +# MP3 is disabled because libmad doesn't compile at the moment +# Other options weren't tested, but SDL and SDL2 both compile fine +export USE_SDL2=1 +export USE_CODEC_MP3=0 +export DO_USERDIRS=1 + +# Source is in Quake/ and icons are in Misc/ +rsync -av --delete "${COOKBOOK_SOURCE}/Quake/" "${COOKBOOK_SOURCE}/Misc" ./ + +# According to frantic grepping, the Redox build system doesn't apply patches to git +git apply "${COOKBOOK_RECIPE}/redox.patch" + +cookbook_configure +""" diff --git a/recipes/games/quakespasm/redox.patch b/recipes/games/quakespasm/redox.patch new file mode 100644 index 000000000..c3ff6a46e --- /dev/null +++ b/recipes/games/quakespasm/redox.patch @@ -0,0 +1,110 @@ +diff '--color=auto' -rupwN source/Makefile source-new/Makefile +--- source/Makefile 2024-10-15 21:21:14.824589882 -0400 ++++ source-new/Makefile 2024-10-16 00:42:27.651948743 -0400 +@@ -4,28 +4,34 @@ + # "make SDL_CONFIG=/path/to/sdl-config" for unusual SDL installations. + # "make DO_USERDIRS=1" to enable user directories support + ++# Base install directory ++DESTDIR ?= "/" ++INSTALLDIR = "${DESTDIR}/usr/games/" ++DATADIR = "${DESTDIR}/usr/share/games/quake1/id1/" ++ICODIR = "${DESTDIR}/ui/icons/apps/" ++ + # Enable/Disable user directories support +-DO_USERDIRS=0 ++DO_USERDIRS ?= 0 + + ### Enable/Disable SDL2 +-USE_SDL2=0 ++USE_SDL2 ?= 0 + + ### Enable/Disable codecs for streaming music support +-USE_CODEC_WAVE=1 +-USE_CODEC_FLAC=0 +-USE_CODEC_MP3=1 +-USE_CODEC_VORBIS=1 +-USE_CODEC_OPUS=0 ++USE_CODEC_WAVE ?= 1 ++USE_CODEC_FLAC ?= 0 ++USE_CODEC_MP3 ?= 1 ++USE_CODEC_VORBIS ?= 1 ++USE_CODEC_OPUS ?= 0 + # either xmp or mikmod (or modplug) +-USE_CODEC_MIKMOD=0 +-USE_CODEC_XMP=0 +-USE_CODEC_MODPLUG=0 +-USE_CODEC_UMX=0 ++USE_CODEC_MIKMOD ?= 0 ++USE_CODEC_XMP ?= 0 ++USE_CODEC_MODPLUG ?= 0 ++USE_CODEC_UMX ?= 0 + + # which library to use for mp3 decoding: mad or mpg123 +-MP3LIB=mad ++MP3LIB ?= mad + # which library to use for ogg decoding: vorbis or tremor +-VORBISLIB=vorbis ++VORBISLIB ?= vorbis + + # --------------------------- + # Helper functions +@@ -35,7 +41,7 @@ check_gcc = $(shell if echo | $(CC) $(1) + + # --------------------------- + +-HOST_OS = $(shell uname|sed -e s/_.*//|tr '[:upper:]' '[:lower:]') ++HOST_OS ?= $(shell uname|sed -e s/_.*//|tr '[:upper:]' '[:lower:]') + + DEBUG ?= 0 + +@@ -49,7 +55,7 @@ LINKER = $(CC) + STRIP ?= strip + PKG_CONFIG ?= pkg-config + +-CPUFLAGS= ++CPUFLAGS ?= + LDFLAGS?= + DFLAGS ?= + CFLAGS ?= -Wall -Wno-trigraphs -MMD +@@ -81,11 +87,19 @@ endif + + ifeq ($(USE_SDL2),1) + SDL_CONFIG ?= sdl2-config ++SDL_VERSION = sdl2 + else + SDL_CONFIG ?= sdl-config ++SDL_VERSION = sdl + endif ++ ++ifeq ($(HOST_OS),redox) ++SDL_CFLAGS = $(shell $(PKG_CONFIG) --cflags $(SDL_VERSION)) ++SDL_LIBS = $(shell $(PKG_CONFIG) --libs $(SDL_VERSION)) ++else + SDL_CFLAGS = $(shell $(SDL_CONFIG) --cflags) + SDL_LIBS = $(shell $(SDL_CONFIG) --libs) ++endif + + NET_LIBS = + ifeq ($(HOST_OS),sunos) +@@ -164,6 +178,8 @@ endif + + ifeq ($(HOST_OS),haiku) + COMMON_LIBS= -lGL ++else ifeq ($(HOST_OS),redox) ++COMMON_LIBS= -lorbital $(shell $(PKG_CONFIG) --libs osmesa zlib) + else + COMMON_LIBS= -lGL -lm + endif +@@ -290,7 +306,10 @@ install: quakespasm + cp quakespasm.pak $(QS_APP_DIR) + else + install: quakespasm +- cp quakespasm /usr/local/games/quake ++ mkdir -p "${INSTALLDIR}" "${DATADIR}" "${ICODIR}" ++ cp quakespasm "${INSTALLDIR}/quakespasm" ++ # xxx Probably requires resizing ++ cp Misc/QuakeSpasm_512.png "${ICODIR}/quakespasm.png" + endif + + sinclude $(OBJS:.o=.d) diff --git a/recipes/wip/games/fps/quake1-shareware/manifest b/recipes/wip/games/fps/quake1-shareware/manifest new file mode 100644 index 000000000..008df9c03 --- /dev/null +++ b/recipes/wip/games/fps/quake1-shareware/manifest @@ -0,0 +1,3 @@ +name=Quake shareware +category=Games +binary=/usr/games/quakespasm -basedir /use/share/games/quake/ diff --git a/recipes/wip/games/fps/quake1-shareware/pak0.pak.sha b/recipes/wip/games/fps/quake1-shareware/pak0.pak.sha new file mode 100644 index 000000000..036550110 --- /dev/null +++ b/recipes/wip/games/fps/quake1-shareware/pak0.pak.sha @@ -0,0 +1 @@ +35a9c55e5e5a284a159ad2a62e0e8def23d829561fe2f54eb402dbc0a9a946af /mnt/games1/home/steam_games/steamapps/common/Quake/id1/PAK0.PAK diff --git a/recipes/wip/games/fps/quake1-shareware/quake106.zip.sha b/recipes/wip/games/fps/quake1-shareware/quake106.zip.sha new file mode 100644 index 000000000..e7df387ba --- /dev/null +++ b/recipes/wip/games/fps/quake1-shareware/quake106.zip.sha @@ -0,0 +1 @@ +ec6c9d34b1ae0252ac0066045b6611a7919c2a0d78a3a66d9387a8f597553239 quake106.zip diff --git a/recipes/wip/games/fps/quake1-shareware/recipe.toml b/recipes/wip/games/fps/quake1-shareware/recipe.toml new file mode 100644 index 000000000..f721529c1 --- /dev/null +++ b/recipes/wip/games/fps/quake1-shareware/recipe.toml @@ -0,0 +1,24 @@ +# TODO: +# * Requires unarchivers + +[build] +template = "custom" +dependencies = ["lhasa", "unzrip"] +script = """ +curl -O "https://github.com/Jason2Brownlee/QuakeOfficialArchive/raw/refs/heads/main/bin/quake106.zip" +sha256sum -c quake106.zip.sha + +# The zip file contains a DOS installer which we don't need +# The actual demo content is within another archive +7z x quake106.zip + +# Actual game contents +lha xv resource.1 +sha256sum -c pak0.pak.sha + +# Now, the ID1 folder contains PAK0, the demo file +# Non-Windows/non-DOS systems expect the directory and file to be lowercased +OUT_DIR = "${COOKBOOK_STAGE}/usr/share/games/quake/id1/" +mkdir -p "${OUT_DIR}" +cp -v ID1/PAK0.PAK "${OUT_DIR}/pak0.pak" +""" -- GitLab