Ports: Return halflife to upstream

This commit is contained in:
Tim Schumacher 2022-03-24 13:33:25 +01:00 committed by Linus Groh
parent 9736a088fb
commit c9c59602a4
6 changed files with 164 additions and 18 deletions

View file

@ -74,7 +74,7 @@ Please make sure to keep this list up to date when adding and updating ports. :^
| [`grep`](grep/) | GNU Grep | 3.7 | https://www.gnu.org/software/grep/ |
| [`griffon`](griffon/) | The Griffon Legend | 1.0 | https://www.scummvm.org/games/#games-griffon |
| [`gsl`](gsl/) | GNU Scientific Library | 2.7.1 | https://www.gnu.org/software/gsl/ |
| [`halflife`](halflife/) | Half-Life | 1.0.0 | https://github.com/SerenityPorts/xash3d-fwgs |
| [`halflife`](halflife/) | Half-Life | 2022.05.01 | https://github.com/FWGS/xash3d-fwgs |
| [`harfbuzz`](harfbuzz/) | HarfBuzz | 2.8.1 | https://github.com/harfbuzz/harfbuzz |
| [`hatari`](hatari/) | Atari ST/STE/TT/Falcon emulator | 2.4.0-devel | https://hatari.tuxfamily.org/ |
| [`imagemagick`](imagemagick/) | ImageMagick | 7.1.0-29 | https://imagemagick.org |

View file

@ -1,14 +1,20 @@
#!/usr/bin/env -S bash ../.port_include.sh
port="halflife"
version="1.0.0"
version="2022.05.01" # Bogus version, this was the last time the commit hashes were updated.
_fwgs_commit=5402e1a2597c40c603bd0f2b1a9cd6a16506ec84
_hlsdk_commit=808be9442f60b4388f68fcef8b2659d0cd6db17b
_vgui_commit=93573075afe885618ea15831e72d44bdacd65bfb
_mainui_commit=01e964fdc26f5dce1512c030d0dfd68e17be2858
_miniutl_commit=67c8c226c451f32ee3c98b94e04f8966092b70d3
useconfigure="true"
depends=("SDL2" "fontconfig" "freetype")
workdir="."
files="https://github.com/SerenityPorts/xash3d-fwgs/archive/master.tar.gz xash3d_engine.tar.gz
https://github.com/SerenityPorts/hlsdk-xash3d/archive/master.tar.gz xash3d_hldll.tar.gz
https://github.com/FWGS/vgui-dev/archive/master.tar.gz vgui-dev.tar.gz
https://github.com/FWGS/mainui_cpp/archive/master.tar.gz mainui.tar.gz
https://github.com/FWGS/miniutl/archive/master.tar.gz miniutl.tar.gz"
files="https://github.com/FWGS/xash3d-fwgs/archive/${_fwgs_commit}.tar.gz xash3d-fwgs-${_fwgs_commit}.tar.gz 1401f6c0cf619c48a8a40938b2acdffd327725ca0ab59804c518bddf821637f9
https://github.com/FWGS/hlsdk-xash3d/archive/${_hlsdk_commit}.tar.gz hlsdk-xash3d-${_hlsdk_commit}.tar.gz fd17436571341bd5e50739f22d84f9857f492637479144d01b1ffc1ead9d776b
https://github.com/FWGS/vgui-dev/archive/${_vgui_commit}.tar.gz vgui-dev-${_vgui_commit}.tar.gz eb9315fba8ae444fdae240c10afebaf7f3b157233bf1589f0af557b2286928fa
https://github.com/FWGS/mainui_cpp/archive/${_mainui_commit}.tar.gz mainui_cpp-${_mainui_commit}.tar.gz c8f6ce81596d5690044542074ac9bc69bbd43b5e5766f71363a8b5d4d382ad71
https://github.com/FWGS/MiniUTL/archive/${_miniutl_commit}.tar.gz MiniUTL-${_miniutl_commit}.tar.gz 7b7b26377854b3fc741c8d652d8b3c9c540512644943ca6efb63df941b2861e3"
auth_type=sha256
launcher_name="Half-Life"
launcher_category="Games"
launcher_command="sh /home/anon/Games/halflife/hl.sh"
@ -18,40 +24,40 @@ export PKG_CONFIG_PATH="${SERENITY_INSTALL_ROOT}/usr/local/lib/pkgconfig"
# This one is a bit tricky to build, so I'm going a little bit off the script....
configure() {
# Initialize submodules from tarballs
[ -e ./xash3d-fwgs-master/mainui ] && rm -r ./xash3d-fwgs-master/mainui
cp -r mainui_cpp-master/ ./xash3d-fwgs-master/mainui
rmdir ./xash3d-fwgs-master/mainui/miniutl
cp -r MiniUTL-master/ ./xash3d-fwgs-master/mainui/miniutl
[ -e ./xash3d-fwgs-${_fwgs_commit}/mainui ] && rm -r ./xash3d-fwgs-${_fwgs_commit}/mainui
cp -r mainui_cpp-${_mainui_commit}/ ./xash3d-fwgs-${_fwgs_commit}/mainui
rmdir ./xash3d-fwgs-${_fwgs_commit}/mainui/miniutl
cp -r MiniUTL-${_miniutl_commit}/ ./xash3d-fwgs-${_fwgs_commit}/mainui/miniutl
# Configure the shared object projects (client and game)
cd ./hlsdk-xash3d-master
cd ./hlsdk-xash3d-${_hlsdk_commit}
./waf configure -T release
cd ../
# Configure the engine itself...
cd ./xash3d-fwgs-master
./waf configure --sdl2="${SERENITY_INSTALL_ROOT}/usr/local" --vgui=../vgui-dev-master/ -T release
cd ./xash3d-fwgs-${_fwgs_commit}
./waf configure --sdl2="${SERENITY_INSTALL_ROOT}/usr/local" --vgui=../vgui-dev-${_vgui_commit}/ -T release
cd ../
}
build() {
# Build the game and client
cd ./hlsdk-xash3d-master
cd ./hlsdk-xash3d-${_hlsdk_commit}
./waf build
cd ../
# Build the engine
cd ./xash3d-fwgs-master
cd ./xash3d-fwgs-${_fwgs_commit}
./waf build
cd ../
}
install() {
cd ./hlsdk-xash3d-master
cd ./hlsdk-xash3d-${_hlsdk_commit}
./waf install --destdir=${SERENITY_INSTALL_ROOT}/home/anon/Games/halflife
cd ../
cd ./xash3d-fwgs-master
cd ./xash3d-fwgs-${_fwgs_commit}
./waf install --destdir=${SERENITY_INSTALL_ROOT}/home/anon/Games/halflife/
cd ../
}

View file

@ -0,0 +1,14 @@
# Patches for halflife
## `fwgs-add-serenity.patch`
Add SerenityOS to the supported architectures of FWGS.
## `hlsdk-add-serenity.patch`
Add SerenityOS to the supported architectures of hlsdk.
## `hlsdk-strings-compat.patch`
This bypasses a bunch of `str[n]cmpcase` errors that occur due to weird LibC compatibility problems.

View file

@ -0,0 +1,47 @@
From 9b3a3057e154062384b46082d423285f21da28a2 Mon Sep 17 00:00:00 2001
From: Jesse Buhagiar <jooster669@gmail.com>
Date: Sun, 2 Jan 2022 00:39:02 +1100
Subject: [PATCH] Build: Add SerenityOS to list of compatible systems
This is required by the build system to spit out a library with
the correct name/platform.
---
xash3d-fwgs-5402e1a2597c40c603bd0f2b1a9cd6a16506ec84/engine/common/build.c | 2 ++
xash3d-fwgs-5402e1a2597c40c603bd0f2b1a9cd6a16506ec84/public/build.h | 4 ++++
2 files changed, 6 insertions(+)
diff --git a/xash3d-fwgs-5402e1a2597c40c603bd0f2b1a9cd6a16506ec84/engine/common/build.c b/xash3d-fwgs-5402e1a2597c40c603bd0f2b1a9cd6a16506ec84/engine/common/build.c
index c4ddaeeb2..42ba572c4 100644
--- a/xash3d-fwgs-5402e1a2597c40c603bd0f2b1a9cd6a16506ec84/engine/common/build.c
+++ b/xash3d-fwgs-5402e1a2597c40c603bd0f2b1a9cd6a16506ec84/engine/common/build.c
@@ -95,6 +95,8 @@ const char *Q_buildos( void )
osname = "DOS4GW";
#elif XASH_HAIKU
osname = "haiku";
+#elif XASH_SERENITY
+ osname = "serenityos";
#else
#error "Place your operating system name here! If this is a mistake, try to fix conditions above and report a bug"
#endif
diff --git a/xash3d-fwgs-5402e1a2597c40c603bd0f2b1a9cd6a16506ec84/public/build.h b/xash3d-fwgs-5402e1a2597c40c603bd0f2b1a9cd6a16506ec84/public/build.h
index 6e1f326d6..57a7735f4 100644
--- a/xash3d-fwgs-5402e1a2597c40c603bd0f2b1a9cd6a16506ec84/public/build.h
+++ b/xash3d-fwgs-5402e1a2597c40c603bd0f2b1a9cd6a16506ec84/public/build.h
@@ -74,6 +74,7 @@ For more information, please refer to <http://unlicense.org/>
#undef XASH_RISCV_DOUBLEFP
#undef XASH_RISCV_SINGLEFP
#undef XASH_RISCV_SOFTFP
+#undef XASH_SERENITY
#undef XASH_WIN32
#undef XASH_WIN64
#undef XASH_X86
@@ -125,6 +126,9 @@ For more information, please refer to <http://unlicense.org/>
#elif defined __HAIKU__
#define XASH_HAIKU 1
#define XASH_POSIX 1
+#elif defined __serenity__
+ #define XASH_SERENITY 1
+ #define XASH_POSIX 1
#else
#error "Place your operating system name here! If this is a mistake, try to fix conditions above and report a bug"
#endif

View file

@ -0,0 +1,55 @@
From cfeb76389a3f6ad2691a4838c95365f49305f16d Mon Sep 17 00:00:00 2001
From: Jesse Buhagiar <jooster669@gmail.com>
Date: Sun, 2 Jan 2022 00:10:53 +1100
Subject: [PATCH] Build: Add SerenityOS to list of compatible systems
This is required by the build system to spit out a library with
the correct name/platform.
---
hlsdk-xash3d-808be9442f60b4388f68fcef8b2659d0cd6db17b/public/build.h | 4 ++++
hlsdk-xash3d-808be9442f60b4388f68fcef8b2659d0cd6db17b/scripts/waifulib/library_naming.py | 3 +++
2 files changed, 7 insertions(+)
diff --git a/hlsdk-xash3d-808be9442f60b4388f68fcef8b2659d0cd6db17b/public/build.h b/hlsdk-xash3d-808be9442f60b4388f68fcef8b2659d0cd6db17b/public/build.h
index 3692cf175..5b6bcc362 100644
--- a/hlsdk-xash3d-808be9442f60b4388f68fcef8b2659d0cd6db17b/public/build.h
+++ b/hlsdk-xash3d-808be9442f60b4388f68fcef8b2659d0cd6db17b/public/build.h
@@ -75,6 +75,7 @@ For more information, please refer to <http://unlicense.org/>
#undef XASH_RISCV_DOUBLEFP
#undef XASH_RISCV_SINGLEFP
#undef XASH_RISCV_SOFTFP
+#undef XASH_SERENITY
#undef XASH_WIN32
#undef XASH_WIN64
#undef XASH_X86
@@ -126,6 +127,9 @@ For more information, please refer to <http://unlicense.org/>
#elif defined __HAIKU__
#define XASH_HAIKU 1
#define XASH_POSIX 1
+#elif defined __serenity__
+ #define XASH_SERENITY 1
+ #define XASH_POSIX 1
#else
#error "Place your operating system name here! If this is a mistake, try to fix conditions above and report a bug"
#endif
diff --git a/hlsdk-xash3d-808be9442f60b4388f68fcef8b2659d0cd6db17b/scripts/waifulib/library_naming.py b/hlsdk-xash3d-808be9442f60b4388f68fcef8b2659d0cd6db17b/scripts/waifulib/library_naming.py
index a3929067f..44ade2fd2 100644
--- a/hlsdk-xash3d-808be9442f60b4388f68fcef8b2659d0cd6db17b/scripts/waifulib/library_naming.py
+++ b/hlsdk-xash3d-808be9442f60b4388f68fcef8b2659d0cd6db17b/scripts/waifulib/library_naming.py
@@ -57,6 +57,7 @@
'XASH_RISCV_DOUBLEFP',
'XASH_RISCV_SINGLEFP',
'XASH_RISCV_SOFTFP',
+'XASH_SERENITY',
'XASH_WIN32',
'XASH_WIN64',
'XASH_X86',
@@ -89,6 +90,8 @@ def configure(conf):
buildos = "dos4gw" # unused, just in case
elif conf.env.XASH_HAIKU:
buildos = "haiku"
+ elif conf.env.XASH_SERENITY:
+ buildos = "serenityos"
else:
conf.fatal("Place your operating system name in build.h and library_naming.py!\n"
"If this is a mistake, try to fix conditions above and report a bug")

View file

@ -0,0 +1,24 @@
From 673aea20b5917dd7e295f795eb0dd730598c9b0a Mon Sep 17 00:00:00 2001
From: Jesse Buhagiar <jooster669@gmail.com>
Date: Sun, 2 Jan 2022 00:27:17 +1100
Subject: [PATCH] Build: Add `__STRINGS_H_COMPAT_HACK` macro
This bypasses a bunch of `str[n]cmpcase` errors that occur due to weird
LibC compatibility problems.
---
hlsdk-xash3d-808be9442f60b4388f68fcef8b2659d0cd6db17b/wscript | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hlsdk-xash3d-808be9442f60b4388f68fcef8b2659d0cd6db17b/wscript b/hlsdk-xash3d-808be9442f60b4388f68fcef8b2659d0cd6db17b/wscript
index 336e8d34f..684c575a5 100644
--- a/hlsdk-xash3d-808be9442f60b4388f68fcef8b2659d0cd6db17b/wscript
+++ b/hlsdk-xash3d-808be9442f60b4388f68fcef8b2659d0cd6db17b/wscript
@@ -171,7 +171,7 @@ def configure(conf):
elif conf.env.COMPILER_CC == 'owcc':
pass
else:
- conf.env.append_unique('DEFINES', ['stricmp=strcasecmp', 'strnicmp=strncasecmp', '_snprintf=snprintf', '_vsnprintf=vsnprintf', '_LINUX', 'LINUX'])
+ conf.env.append_unique('DEFINES', ['stricmp=strcasecmp', 'strnicmp=strncasecmp', '_snprintf=snprintf', '_vsnprintf=vsnprintf', '_LINUX', 'LINUX', '__STRINGS_H_COMPAT_HACK'])
conf.env.append_unique('CXXFLAGS', ['-Wno-invalid-offsetof', '-fno-rtti', '-fno-exceptions'])
# strip lib from pattern