Skip to content

Commit

Permalink
QS
Browse files Browse the repository at this point in the history
  • Loading branch information
Begasus committed Jun 8, 2023
1 parent 7f3697f commit 19ec928
Show file tree
Hide file tree
Showing 2 changed files with 266 additions and 0 deletions.
160 changes: 160 additions & 0 deletions games-fps/quakespasm/patches/quakespasm-0.96.0~git.patchset
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
From 1ec01d6f9fadb5a0683b77591fafe2b804874bda Mon Sep 17 00:00:00 2001
From: Jaycie Ewald <jaycie.ewald@outlook.com>
Date: Sat, 3 Jun 2023 10:43:28 -0500
Subject: Haiku support.

Changes already submitted upstream.

diff --git a/Quake/Makefile b/Quake/Makefile
index beea5e1..f28e48d 100644
--- a/Quake/Makefile
+++ b/Quake/Makefile
@@ -13,6 +13,9 @@ USE_SDL2=0
### Do we need to link the math library?
LINK_M=1

+### Install location for the binary
+QS_APP_DIR=/usr/local/games
+
### Enable/Disable codecs for streaming music support
USE_CODEC_WAVE=1
USE_CODEC_FLAC=0
@@ -38,7 +41,7 @@ check_gcc = $(shell if echo | $(CC) $(1) -Werror -S -o /dev/null -xc - > /dev/nu

# ---------------------------

-HOST_OS := $(shell uname|sed -e s/_.*//|tr '[:upper:]' '[:lower:]')
+HOST_OS ?= $(shell uname|sed -e s/_.*//|tr '[:upper:]' '[:lower:]')

DEBUG ?= 0

@@ -112,7 +115,7 @@ SDL_LIBS := $(shell $(SDL_CONFIG) --libs)

ifeq ($(HOST_OS),sunos)
NET_LIBS :=-lsocket -lnsl -lresolv
-else ifdef HAIKU_OS
+else ifeq ($(HOST_OS),haiku)
NET_LIBS :=-lnetwork
else
NET_LIBS :=
@@ -306,6 +309,7 @@ clean:
$(RM) *.o *.d $(DEFAULT_TARGET)

install: quakespasm
- cp quakespasm /usr/local/games/quake
+ mkdir -p $(QS_APP_DIR)
+ cp quakespasm $(QS_APP_DIR)/quake

sinclude $(OBJS:.o=.d)
diff --git a/Quake/build_cross_haiku32-sdl2.sh b/Quake/build_cross_haiku32-sdl2.sh
index b180335..d6c5e55 100755
--- a/Quake/build_cross_haiku32-sdl2.sh
+++ b/Quake/build_cross_haiku32-sdl2.sh
@@ -14,4 +14,4 @@ STRIP="$TARGET-strip"
LDFLAGS=-L/usr/lib32 # hack
export CC AS AR RANLIB STRIP LDFLAGS

-exec $MAKE_CMD HAIKU_OS=1 LINK_M=0 USE_SDL2=1 LDFLAGS=$LDFLAGS CC=$CC AS=$AS RANLIB=$RANLIB AR=$AR STRIP=$STRIP -f Makefile $*
+exec $MAKE_CMD HOST_OS=haiku USE_SDL2=1 LDFLAGS=$LDFLAGS CC=$CC AS=$AS RANLIB=$RANLIB AR=$AR STRIP=$STRIP -f Makefile $*
diff --git a/Quake/build_cross_haiku64-sdl2.sh b/Quake/build_cross_haiku64-sdl2.sh
index 0b43404..8090528 100755
--- a/Quake/build_cross_haiku64-sdl2.sh
+++ b/Quake/build_cross_haiku64-sdl2.sh
@@ -13,4 +13,4 @@ AR="$TARGET-ar"
STRIP="$TARGET-strip"
export CC AS AR RANLIB STRIP

-exec $MAKE_CMD HAIKU_OS=1 LINK_M=0 USE_SDL2=1 CC=$CC AS=$AS RANLIB=$RANLIB AR=$AR STRIP=$STRIP -f Makefile $*
+exec $MAKE_CMD HOST_OS=haiku USE_SDL2=1 CC=$CC AS=$AS RANLIB=$RANLIB AR=$AR STRIP=$STRIP -f Makefile $*
diff --git a/Quake/common.c b/Quake/common.c
index c604a0a..931f971 100644
--- a/Quake/common.c
+++ b/Quake/common.c
@@ -28,6 +28,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

#include "miniz.h"

+#include "arch_def.h"
+#ifdef PLATFORM_HAIKU
+#include <FindDirectory.h>
+#include <fs_info.h>
+#endif
+
static char *largv[MAX_NUM_ARGVS + 1];
static char argvdummy[] = " ";

@@ -2052,11 +2058,28 @@ _add_path:
if (i != 0 || path_id != 1 || fitzmode)
qspak = NULL;
else {
+ #ifdef PLATFORM_HAIKU
+ qboolean old = com_modified;
+ dev_t volume = dev_for_path("/boot");
+ char buffer[B_PATH_NAME_LENGTH];
+ status_t result;
+
+ result = find_directory(B_SYSTEM_DATA_DIRECTORY, volume, false, buffer, sizeof(buffer));
+ if (result != B_OK)
+ Sys_Error ("Couldn't determine userspace directory");
+
+ q_snprintf (pakfile, sizeof(pakfile), "%s/QuakeSpasm/quakespasm.pak", buffer);
+
+ qspak = COM_LoadPackFile (pakfile);
+
+ com_modified = old;
+ #else
qboolean old = com_modified;
if (been_here) base = host_parms->userdir;
q_snprintf (pakfile, sizeof(pakfile), "%s/quakespasm.pak", base);
qspak = COM_LoadPackFile (pakfile);
com_modified = old;
+ #endif
}
if (pak) {
search = (searchpath_t *) Z_Malloc(sizeof(searchpath_t));
diff --git a/Quake/sys_sdl_unix.c b/Quake/sys_sdl_unix.c
index 71c8595..ab683ca 100644
--- a/Quake/sys_sdl_unix.c
+++ b/Quake/sys_sdl_unix.c
@@ -244,10 +244,30 @@ static char cwd[MAX_OSPATH];
static char userdir[MAX_OSPATH];
#ifdef PLATFORM_OSX
#define SYS_USERDIR "Library/Application Support/QuakeSpasm"
+#elif defined(PLATFORM_HAIKU)
+#define SYS_USERDIR "QuakeSpasm"
#else
#define SYS_USERDIR ".quakespasm"
#endif

+#ifdef PLATFORM_HAIKU
+
+#include <FindDirectory.h>
+#include <fs_info.h>
+
+static void Sys_GetUserdir (char *dst, size_t dstsize)
+{
+ dev_t volume = dev_for_path("/boot");
+ char buffer[B_PATH_NAME_LENGTH];
+ status_t result;
+
+ result = find_directory(B_USER_NONPACKAGED_DATA_DIRECTORY, volume, false, buffer, sizeof(buffer));
+ if (result != B_OK)
+ Sys_Error ("Couldn't determine userspace directory");
+
+ q_snprintf (dst, dstsize, "%s/%s", buffer, SYS_USERDIR);
+}
+#else
static void Sys_GetUserdir (char *dst, size_t dstsize)
{
size_t n;
@@ -274,6 +294,7 @@ static void Sys_GetUserdir (char *dst, size_t dstsize)

q_snprintf (dst, dstsize, "%s/%s", home_dir, SYS_USERDIR);
}
+#endif /* PLATFORM_HAIKU */
#endif /* DO_USERDIRS */

#ifdef PLATFORM_OSX
--
2.37.3

106 changes: 106 additions & 0 deletions games-fps/quakespasm/quakespasm-0.96.0~git.recipe
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
SUMMARY="An engine for id software's Quake"
DESCRIPTION="QuakeSpasm is a Haiku friendly Quake Engine based on the SDL port of the popular \
FitzQuake.
It includes some new features, important fixes, and aims for portability and 64 bit correctness.
Installation:
To install the game data under Haiku, copy the "id1" folder from a normal Quake installation \
to the following directory: ~/config/non-packaged/data/QuakeSpasm/. Mods should be installed \
to the same directory.
Features:
- Supports Windows, Mac OS X, Haiku, Linux, and other unices.
- Well tested on both 32 bit and 64 bit platforms. Well tested on both little endian and big \
endian platforms.
- OpenGL improvements. In-game resolution changing.
- Widescreen FOV (field of view) support and automatic Hor+ FOV scaling.
- Improved sound support. Support for OGG, MP3, Opus and WAV external music files.
- Improved game controller support using SDL2.
- Countless bug fixes, security fixes and other improvements.
- Support for playing the 'Quake 2021 re-release' content."
HOMEPAGE="https://quakespasm.sourceforge.net/"
COPYRIGHT="1996-2001 Id Software, Inc.
2002-2009 John Fitzgibbons and others
2010-2014 QuakeSpasm developers"
LICENSE="GNU GPL v2"
REVISION="1"
srcGitRev="70df2b661e9c632d04825b259e63ad58c29c01ac"
SOURCE_URI="https://github.com/sezero/quakespasm/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="b89ba914d061376945b1fbe2cd0631e162f4f0d835e004eba87a0a9cce107ad4"
SOURCE_DIR="quakespasm-$srcGitRev"
ADDITIONAL_FILES="
QuakeSpasm.rdef.in
haiku_readme.txt
"
PATCHES="quakespasm-$portVersion.patchset"

ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
quakespasm$secondaryArchSuffix = $portVersion
app:QuakeSpasm
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libGL$secondaryArchSuffix
lib:libogg$secondaryArchSuffix
lib:libmad$secondaryArchSuffix
lib:libSDL2_2.0$secondaryArchSuffix
lib:libvorbis$secondaryArchSuffix
"

BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libGL$secondaryArchSuffix
devel:libogg$secondaryArchSuffix
devel:libmad$secondaryArchSuffix
devel:libSDL2_2.0$secondaryArchSuffix
devel:libvorbis$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:gcc$secondaryArchSuffix
cmd:ld$secondaryArchSuffix
cmd:make
"

BUILD()
{
make -C Quake $jobArgs DO_USERDIRS=1 USE_SDL2=1 -f Makefile
}

INSTALL()
{
make -C Quake DO_USERDIRS=1 USE_SDL2=1 \
QS_APP_DIR=$appsDir \
install

local APP_SIGNATURE="application/x-vnd.QuakeSpasm"
local MAJOR="`echo "$portVersion" | cut -d. -f1`"
local MIDDLE="`echo "$portVersion" | cut -d. -f2`"
local MINOR="`echo "${portVersion//~git}" | cut -d. -f3`"
local LONG_INFO="$SUMMARY"
sed \
-e "s|@APP_SIGNATURE@|$APP_SIGNATURE|" \
-e "s|@MAJOR@|$MAJOR|" \
-e "s|@MIDDLE@|$MIDDLE|" \
-e "s|@MINOR@|$MINOR|" \
-e "s|@LONG_INFO@|$LONG_INFO|" \
$portDir/additional-files/QuakeSpasm.rdef.in > QuakeSpasm.rdef

addResourcesToBinaries QuakeSpasm.rdef $sourceDir/Quake/quakespasm
mimeset -f $sourceDir/Quake/quakespasm

mv $appsDir/quake $appsDir/QuakeSpasm

mkdir -p $docDir
cp $sourceDir/Quakespasm.html $docDir/Quakespasm.html
cp $portDir/additional-files/haiku_readme.txt $docDir/haiku_readme.txt

mkdir -p $dataDir/QuakeSpasm
cp Quake/quakespasm.pak $dataDir/QuakeSpasm/quakespasm.pak

addAppDeskbarSymlink $appsDir/QuakeSpasm
}

0 comments on commit 19ec928

Please sign in to comment.