1
1
#! /bin/bash
2
2
3
- pushd " $( dirname " $0 " ) " > /dev/null
3
+ set -e
4
+
5
+ pushd " $( dirname " $0 " ) "
4
6
5
7
# Check if environment variables are defined
6
8
if [[ -z $NAME || -z $RUNNER_OS || -z $FLAGS ]]; then
7
9
echo " One or more required environment variables are not defined."
8
10
exit 1
9
11
fi
10
12
11
- SUDO=$( which sudo)
13
+ SUDO=$( which sudo || exit 0 )
12
14
13
15
if [[ $RUNNER_OS == ' Linux' ]]; then
14
16
# Setup Linux dependencies
@@ -34,22 +36,22 @@ if [[ $RUNNER_OS == 'Linux' ]]; then
34
36
$SUDO apt-get install -y \
35
37
$GCC \
36
38
$GPP \
37
- git \
39
+ git \
38
40
cmake \
39
41
ninja-build \
40
42
wayland-scanner++ \
41
43
wayland-protocols \
42
- meson \
44
+ meson \
43
45
pkg-config$TARGET_APT_ARCH \
44
46
libasound2-dev$TARGET_APT_ARCH \
45
47
libdbus-1-dev$TARGET_APT_ARCH \
46
48
libegl1-mesa-dev$TARGET_APT_ARCH \
47
49
libgl1-mesa-dev$TARGET_APT_ARCH \
48
50
libgles2-mesa-dev$TARGET_APT_ARCH \
49
51
libglu1-mesa-dev$TARGET_APT_ARCH \
50
- libgtk-3-dev$TARGET_APT_ARCH \
52
+ libgtk-3-dev$TARGET_APT_ARCH \
51
53
libibus-1.0-dev$TARGET_APT_ARCH \
52
- libpango1.0-dev$TARGET_APT_ARCH \
54
+ libpango1.0-dev$TARGET_APT_ARCH \
53
55
libpulse-dev$TARGET_APT_ARCH \
54
56
libsndio-dev$TARGET_APT_ARCH \
55
57
libudev-dev$TARGET_APT_ARCH \
@@ -72,9 +74,9 @@ if [[ $RUNNER_OS == 'Linux' ]]; then
72
74
if [[ $TARGET_APT_ARCH != :i386 ]]; then
73
75
# Build libdecor.
74
76
# This is required so that window decorations can work on wayland.
75
- # The support will only be enabled in SDL, but we're not shipping the libdecor binaries
76
- # because making them work from a c# app as everything else does (via runtimes) is too difficult.
77
- # Also skip i386 because attempting to support this for i386 is a pain.
77
+ # The support will only be enabled in SDL, but we're not shipping the libdecor binaries
78
+ # because making them work from a c# app as everything else does (via runtimes) is too difficult.
79
+ # Also skip i386 because attempting to support this for i386 is a pain.
78
80
# Special shoutouts to gnome for refusing to support server-side decorations.
79
81
git clone https://gitlab.freedesktop.org/libdecor/libdecor.git
80
82
cd libdecor
@@ -86,12 +88,18 @@ if [[ $RUNNER_OS == 'Linux' ]]; then
86
88
fi
87
89
88
90
# Build SDL
89
- pushd SDL > /dev/null
90
- git reset --hard HEAD
91
+ pushd SDL
92
+ git reset --hard HEAD || echo " Failed to clean up the repository"
93
+
94
+ if [[ $RUNNER_OS == ' Windows' ]]; then
95
+ echo " Patching SDL to not include gameinput.h"
96
+ sed -i ' s/#include <gameinput.h>/#_include <gameinput.h>/g' CMakeLists.txt
97
+ fi
98
+
91
99
cmake -B build $FLAGS -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSDL_SHARED_ENABLED_BY_DEFAULT=ON -DSDL_STATIC_ENABLED_BY_DEFAULT=ON
92
100
cmake --build build/ --config Release
93
101
$SUDO cmake --install build/ --prefix install_output --config Release
94
- popd > /dev/null
102
+ popd
95
103
96
104
# Move build lib into correct folders
97
105
if [[ $RUNNER_OS == ' Windows' ]]; then
@@ -102,4 +110,4 @@ elif [[ $RUNNER_OS == 'macOS' ]]; then
102
110
cp SDL/install_output/lib/libSDL3.dylib ../native/$NAME /libSDL3.dylib
103
111
fi
104
112
105
- popd > /dev/null
113
+ popd
0 commit comments