From d2e30d2167daa3623076f9de642713816a825f8a Mon Sep 17 00:00:00 2001 From: hwsmm <9151706+hwsmm@users.noreply.github.com> Date: Thu, 2 Jan 2025 00:51:58 +0900 Subject: [PATCH 1/8] Patch SDL to not include gameinput.h --- External/build.sh | 6 ++++++ External/exclude-gameinput.patch | 10 ++++++++++ 2 files changed, 16 insertions(+) create mode 100644 External/exclude-gameinput.patch diff --git a/External/build.sh b/External/build.sh index 9a715ed..c1d5481 100755 --- a/External/build.sh +++ b/External/build.sh @@ -88,6 +88,12 @@ fi # Build SDL pushd SDL >/dev/null git reset --hard HEAD + +if [[ $RUNNER_OS == 'Windows' ]]; then + echo "Patching SDL to not include gameinput.h" + patch -Np1 -i ../exclude-gameinput.patch +fi + cmake -B build $FLAGS -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSDL_SHARED_ENABLED_BY_DEFAULT=ON -DSDL_STATIC_ENABLED_BY_DEFAULT=ON cmake --build build/ --config Release $SUDO cmake --install build/ --prefix install_output --config Release diff --git a/External/exclude-gameinput.patch b/External/exclude-gameinput.patch new file mode 100644 index 0000000..c85c42f --- /dev/null +++ b/External/exclude-gameinput.patch @@ -0,0 +1,10 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1953,6 +1953,7 @@ elseif(WINDOWS) + check_c_source_compiles(" + #include + #define COBJMACROS ++ #error SDL does not build on Github Actions with GameInput + #include + int main(int argc, char **argv) { return 0; }" HAVE_GAMEINPUT_H + ) From c3dee83d205f057d9c599f17027d59bd8d11e04e Mon Sep 17 00:00:00 2001 From: hwsmm <9151706+hwsmm@users.noreply.github.com> Date: Thu, 2 Jan 2025 00:52:41 +0900 Subject: [PATCH 2/8] Make bash quit on a command error --- External/build.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/External/build.sh b/External/build.sh index c1d5481..c689e6b 100755 --- a/External/build.sh +++ b/External/build.sh @@ -1,5 +1,7 @@ #!/bin/bash +set -e + pushd "$(dirname "$0")" >/dev/null # Check if environment variables are defined @@ -8,7 +10,7 @@ if [[ -z $NAME || -z $RUNNER_OS || -z $FLAGS ]]; then exit 1 fi -SUDO=$(which sudo) +SUDO=$(which sudo || exit 0) if [[ $RUNNER_OS == 'Linux' ]]; then # Setup Linux dependencies From d836630eabf5cd846ed0ec321d745c679160fe2f Mon Sep 17 00:00:00 2001 From: Susko3 Date: Wed, 1 Jan 2025 23:44:59 +0100 Subject: [PATCH 3/8] Clearly signal that sudo is not available on windows --- External/build.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/External/build.sh b/External/build.sh index c689e6b..7e049b1 100755 --- a/External/build.sh +++ b/External/build.sh @@ -10,7 +10,9 @@ if [[ -z $NAME || -z $RUNNER_OS || -z $FLAGS ]]; then exit 1 fi -SUDO=$(which sudo || exit 0) +if [[ $RUNNER_OS != 'Windows' ]]; then + SUDO=$(which sudo) +fi if [[ $RUNNER_OS == 'Linux' ]]; then # Setup Linux dependencies From c86db6c2fd1df830df7a6775224af65093ea1732 Mon Sep 17 00:00:00 2001 From: Susko3 Date: Thu, 2 Jan 2025 00:05:23 +0100 Subject: [PATCH 4/8] Revert "Clearly signal that sudo is not available on windows" Breaks linux-arm and linux-arm64 build for some reason. This reverts commit d836630eabf5cd846ed0ec321d745c679160fe2f. --- External/build.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/External/build.sh b/External/build.sh index 7e049b1..c689e6b 100755 --- a/External/build.sh +++ b/External/build.sh @@ -10,9 +10,7 @@ if [[ -z $NAME || -z $RUNNER_OS || -z $FLAGS ]]; then exit 1 fi -if [[ $RUNNER_OS != 'Windows' ]]; then - SUDO=$(which sudo) -fi +SUDO=$(which sudo || exit 0) if [[ $RUNNER_OS == 'Linux' ]]; then # Setup Linux dependencies From 3c244928911920a215d7d923e4c60d53d0b8d30c Mon Sep 17 00:00:00 2001 From: hwsmm Date: Thu, 2 Jan 2025 13:23:25 +0900 Subject: [PATCH 5/8] Use sed instead of a patch --- External/build.sh | 2 +- External/exclude-gameinput.patch | 10 ---------- 2 files changed, 1 insertion(+), 11 deletions(-) delete mode 100644 External/exclude-gameinput.patch diff --git a/External/build.sh b/External/build.sh index c689e6b..3dba7bf 100755 --- a/External/build.sh +++ b/External/build.sh @@ -93,7 +93,7 @@ git reset --hard HEAD if [[ $RUNNER_OS == 'Windows' ]]; then echo "Patching SDL to not include gameinput.h" - patch -Np1 -i ../exclude-gameinput.patch + sed -i 's/#include /#_include /g' CMakeLists.txt fi cmake -B build $FLAGS -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSDL_SHARED_ENABLED_BY_DEFAULT=ON -DSDL_STATIC_ENABLED_BY_DEFAULT=ON diff --git a/External/exclude-gameinput.patch b/External/exclude-gameinput.patch deleted file mode 100644 index c85c42f..0000000 --- a/External/exclude-gameinput.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -1953,6 +1953,7 @@ elseif(WINDOWS) - check_c_source_compiles(" - #include - #define COBJMACROS -+ #error SDL does not build on Github Actions with GameInput - #include - int main(int argc, char **argv) { return 0; }" HAVE_GAMEINPUT_H - ) From 9daf986190c06ceddf96450f7046bf643e07c460 Mon Sep 17 00:00:00 2001 From: hwsmm Date: Thu, 2 Jan 2025 13:31:31 +0900 Subject: [PATCH 6/8] Don't suppress pushd/popd output to make output clear --- External/build.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/External/build.sh b/External/build.sh index 3dba7bf..ab21f34 100755 --- a/External/build.sh +++ b/External/build.sh @@ -2,7 +2,7 @@ set -e -pushd "$(dirname "$0")" >/dev/null +pushd "$(dirname "$0")" # Check if environment variables are defined if [[ -z $NAME || -z $RUNNER_OS || -z $FLAGS ]]; then @@ -88,7 +88,7 @@ if [[ $RUNNER_OS == 'Linux' ]]; then fi # Build SDL -pushd SDL >/dev/null +pushd SDL git reset --hard HEAD if [[ $RUNNER_OS == 'Windows' ]]; then @@ -99,7 +99,7 @@ fi cmake -B build $FLAGS -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSDL_SHARED_ENABLED_BY_DEFAULT=ON -DSDL_STATIC_ENABLED_BY_DEFAULT=ON cmake --build build/ --config Release $SUDO cmake --install build/ --prefix install_output --config Release -popd >/dev/null +popd # Move build lib into correct folders if [[ $RUNNER_OS == 'Windows' ]]; then @@ -110,4 +110,4 @@ elif [[ $RUNNER_OS == 'macOS' ]]; then cp SDL/install_output/lib/libSDL3.dylib ../native/$NAME/libSDL3.dylib fi -popd >/dev/null +popd From 23a3b77bcd90fc4db5dc28e7fbb4d5b84ff949bf Mon Sep 17 00:00:00 2001 From: hwsmm Date: Thu, 2 Jan 2025 13:32:44 +0900 Subject: [PATCH 7/8] Fix build.sh formatting --- External/build.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/External/build.sh b/External/build.sh index ab21f34..f69288f 100755 --- a/External/build.sh +++ b/External/build.sh @@ -36,12 +36,12 @@ if [[ $RUNNER_OS == 'Linux' ]]; then $SUDO apt-get install -y \ $GCC \ $GPP \ - git \ + git \ cmake \ ninja-build \ wayland-scanner++ \ wayland-protocols \ - meson \ + meson \ pkg-config$TARGET_APT_ARCH \ libasound2-dev$TARGET_APT_ARCH \ libdbus-1-dev$TARGET_APT_ARCH \ @@ -49,9 +49,9 @@ if [[ $RUNNER_OS == 'Linux' ]]; then libgl1-mesa-dev$TARGET_APT_ARCH \ libgles2-mesa-dev$TARGET_APT_ARCH \ libglu1-mesa-dev$TARGET_APT_ARCH \ - libgtk-3-dev$TARGET_APT_ARCH \ + libgtk-3-dev$TARGET_APT_ARCH \ libibus-1.0-dev$TARGET_APT_ARCH \ - libpango1.0-dev$TARGET_APT_ARCH \ + libpango1.0-dev$TARGET_APT_ARCH \ libpulse-dev$TARGET_APT_ARCH \ libsndio-dev$TARGET_APT_ARCH \ libudev-dev$TARGET_APT_ARCH \ @@ -74,9 +74,9 @@ if [[ $RUNNER_OS == 'Linux' ]]; then if [[ $TARGET_APT_ARCH != :i386 ]]; then # Build libdecor. # This is required so that window decorations can work on wayland. - # The support will only be enabled in SDL, but we're not shipping the libdecor binaries - # because making them work from a c# app as everything else does (via runtimes) is too difficult. - # Also skip i386 because attempting to support this for i386 is a pain. + # The support will only be enabled in SDL, but we're not shipping the libdecor binaries + # because making them work from a c# app as everything else does (via runtimes) is too difficult. + # Also skip i386 because attempting to support this for i386 is a pain. # Special shoutouts to gnome for refusing to support server-side decorations. git clone https://gitlab.freedesktop.org/libdecor/libdecor.git cd libdecor From 2f7c96d5bd94596009212922fd8c6ffbe628343d Mon Sep 17 00:00:00 2001 From: hwsmm Date: Thu, 2 Jan 2025 14:08:46 +0900 Subject: [PATCH 8/8] Ignore git reset error --- External/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/External/build.sh b/External/build.sh index f69288f..babfb95 100755 --- a/External/build.sh +++ b/External/build.sh @@ -89,7 +89,7 @@ fi # Build SDL pushd SDL -git reset --hard HEAD +git reset --hard HEAD || echo "Failed to clean up the repository" if [[ $RUNNER_OS == 'Windows' ]]; then echo "Patching SDL to not include gameinput.h"