From 98a7f6fa3f4ab23ad2fe89b96866fdc05b09d779 Mon Sep 17 00:00:00 2001 From: fgsfds Date: Tue, 7 Feb 2023 18:34:58 +0100 Subject: [PATCH] ci: add nswitch build scripts --- scripts/gha/build_nswitch.sh | 50 ++++++++++++++++++++++++++++++++++++ scripts/gha/deps_nswitch.sh | 30 ++++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 scripts/gha/build_nswitch.sh create mode 100644 scripts/gha/deps_nswitch.sh diff --git a/scripts/gha/build_nswitch.sh b/scripts/gha/build_nswitch.sh new file mode 100644 index 00000000..1c29f73a --- /dev/null +++ b/scripts/gha/build_nswitch.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +. scripts/lib.sh + +# args: branch name, gamedir name +build_hlsdk() +{ + echo "Building HLSDK: $1 branch..." + git checkout switch-$1 + ./waf configure -T release --nswitch || die_configure + ./waf build || die + cp build/dlls/$1_nswitch_aarch64.so ../../pkgtemp/xash3d/$2/dlls/ + cp build/cl_dll/client_nswitch_aarch64.so ../../pkgtemp/xash3d/$2/cl_dlls/ + ./waf clean +} + +export DEVKITPRO=/opt/devkitpro +source $DEVKITPRO/switchvars.sh || die +cd "$BUILDDIR" || die + +rm -rf artifacts build pkgtemp hlsdktemp + +mkdir -p pkgtemp/xash3d/{valve,gearbox,bshift}/{dlls,cl_dlls} || die + +echo "Building engine..." + +./waf configure -T release --nswitch || die_configure +./waf build || die + +echo "Building HLSDK..." + +mkdir -p hlsdktemp || die +cd hlsdktemp || die + +# TODO: replace with FWGS/hlsdk-portable.git when PRs are merged +git clone --recursive https://github.com/fgsfdsfgs/hlsdk-xash3d.git +cd hlsdk-xash3d || die +build_hlsdk hl valve +build_hlsdk opfor gearbox +build_hlsdk bshift bshift + +echo "Packaging artifacts..." + +cp build/engine/xash.nro pkgtemp/xash3d/xash3d.nro +cp build/ref/gl/libref_gl.so pkgtemp/xash3d/ +cp build/ref/soft/libref_soft.so pkgtemp/xash3d/ +cp build/3rdparty/mainui/libmenu.so pkgtemp/xash3d/ +cp build/3rdparty/extras/extras.pk3 pkgtemp/xash3d/valve/ + +mkdir -p artifacts/ || die diff --git a/scripts/gha/deps_nswitch.sh b/scripts/gha/deps_nswitch.sh new file mode 100644 index 00000000..394308c4 --- /dev/null +++ b/scripts/gha/deps_nswitch.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +cd $GITHUB_WORKSPACE + +echo "Downloading and installing dkp-pacman..." + +wget https://apt.devkitpro.org/install-devkitpro-pacman +chmod +x ./install-devkitpro-pacman +sudo ./install-devkitpro-pacman +sudo dkp-pacman --noconfirm -Sy + +echo "Downloading and installing devkitA64..." + +export DEVKITPRO=/opt/devkitpro +export DEVKITA64=$DEVKITPRO/devkitA64 +export PORTLIBS=$DEVKITPRO/portlibs + +sudo dkp-pacman --noconfirm -S devkitA64 dkp-toolchain-vars switch-cmake switch-pkg-config + +echo "Downloading and installing packaged dependencies..." + +sudo dkp-pacman --noconfirm -S libnx switch-mesa switch-libdrm_nouveau switch-sdl2 + +echo "Downloading and installing libsolder..." + +git clone https://github.com/fgsfdsfgs/libsolder.git + +pushd ./libsolder +make && make install +popd