Browse Source

Ports: Add Half-Life: Opposing Force port :^)

Jesse Buhagiar 3 năm trước cách đây
mục cha
commit
43ddefec9c
2 tập tin đã thay đổi với 55 bổ sung0 xóa
  1. 1 0
      Ports/AvailablePorts.md
  2. 54 0
      Ports/opfor/package.sh

+ 1 - 0
Ports/AvailablePorts.md

@@ -141,6 +141,7 @@ Please make sure to keep this list up to date when adding and updating ports. :^
 | [`openttd-opensfx`](openttd-opensfx/)  | OpenSFX audio files for OpenTTD                                 | 1.0.1                    | https://www.openttd.org/                                                       |
 | [`opentyrian`](opentyrian/)            | OpenTyrian                                                      | 84b820f                  | https://github.com/opentyrian/opentyrian                                       |
 | [`opentyrian-data`](opentyrian-data/)  | OpenTyrian graphics and audio                                   | 1.0.0                    | https://camanis.net/tyrian/tyrian21.zip                                        |
+| [`opfor`](opfor/)                      | Half-Life: Opposing Force                                       | 1.0.0                    | https://github.com/SerenityPorts/xash3d-fwgs                                   |
 | [`oksh`](oksh/)                        | oksh                                                            | 7.0                      | https://github.com/ibara/oksh                                                  |
 | [`p7zip`](p7zip/)                      | p7zip                                                           | 17.04                    | https://github.com/jinfeihan57/p7zip                                           |
 | [`patch`](patch/)                      | patch (GNU)                                                     | 2.7.6                    | https://savannah.gnu.org/projects/patch/                                       |

+ 54 - 0
Ports/opfor/package.sh

@@ -0,0 +1,54 @@
+#!/usr/bin/env -S bash ../.port_include.sh
+port="opfor"
+version="1.0.0"
+useconfigure="true"
+depends=("SDL2" "halflife")
+workdir="hlsdk-xash3d-opfor"
+files="https://github.com/SerenityPorts/hlsdk-xash3d/archive/opfor.tar.gz xash3d_gearbox.tar.gz"
+launcher_name="Half-Life: Opposing Force"
+launcher_category="Games"
+
+# This one is a bit tricky to build, so I'm going a little bit off the script....
+configure() {
+    # Configure the shared object projects (client and game)
+    run ./waf configure -T release
+}
+
+build() {
+    # Build game shared object
+    run ./waf build
+}
+
+install() {
+    run ./waf install --destdir=${SERENITY_INSTALL_ROOT}/home/anon/Games/halflife
+}
+
+post_install() {
+    # On arch-linux systems, rename is installed as perl-rename
+    if command -v perl-rename &> /dev/null
+    then
+        rename_command=perl-rename
+    else
+        rename_command=rename
+    fi
+    # Strip the output libraries of their "lib" prefix
+    pushd ${SERENITY_INSTALL_ROOT}/home/anon/Games/halflife/gearbox/cl_dlls/
+    "$rename_command" 's/^...//' lib*
+    popd
+    pushd ${SERENITY_INSTALL_ROOT}/home/anon/Games/halflife/gearbox/dlls/
+    "$rename_command" 's/^...//' lib*
+    popd
+
+    # Create a launch script
+    cat <<- 'EOF' > ${SERENITY_INSTALL_ROOT}/home/anon/Games/halflife/opfor.sh
+#!/bin/sh
+export LD_LIBRARY_PATH=/home/anon/Games/halflife/
+scriptdir=$(dirname "$0")
+cd $scriptdir
+./xash3d -console -game gearbox
+EOF
+    chmod +x ${SERENITY_INSTALL_ROOT}/home/anon/Games/halflife/opfor.sh
+
+    echo "Please remember to copy the 'gearbox/' folder from your own Half-Life installation"
+    echo "into ${SERENITY_INSTALL_ROOT}/home/anon/Games/halflife/"
+}