forked from flibitijibibo/SDL2-CS
-
Notifications
You must be signed in to change notification settings - Fork 6
144 lines (130 loc) · 6.81 KB
/
build-natives.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
name: Build native dependencies (SDL2)
# Change SDL2 version based on https://github.com/libsdl-org/SDL/releases, but remember to check what SDL2 version SDL2-CS targets.
# Change Chromium revision numbers based on https://chromium.woolyss.com/download/.
env:
SDL2_VERSION: 2.30.9 # Make sure this matches the version mentioned in the description in the .nuspec file.
CHROMIUM_BUILD_x86: 1136315
CHROMIUM_BUILD_x64: 1136314
on:
pull_request:
workflow_call:
workflow_dispatch:
permissions:
contents: read
jobs:
windows:
name: Windows (x86 + x64)
runs-on: ubuntu-22.04
steps:
- name: Setup Dependencies
run: |
mkdir -p artifacts/x86
mkdir artifacts/x64
# Download an official precompiled release version of SDL because compiling for Windows on Linux is hard.
# Download also a precompiled version of Chromium in order to extract libEGL.dll and libGLESv2.dll, which the Windows SDL DLL depends on.
- name: Download natives
run: |
curl -s -L -O https://www.libsdl.org/release/SDL2-${SDL2_VERSION}-win32-x86.zip
unzip SDL2-${SDL2_VERSION}-win32-x86.zip SDL2.dll -d artifacts/x86
curl -s -L -O https://storage.googleapis.com/chromium-browser-snapshots/Win/${CHROMIUM_BUILD_x86}/chrome-win.zip
unzip -j chrome-win.zip chrome-win/libEGL.dll -d artifacts/x86
unzip -j chrome-win.zip chrome-win/libGLESv2.dll -d artifacts/x86
curl -s -L -O https://www.libsdl.org/release/SDL2-${SDL2_VERSION}-win32-x64.zip
unzip SDL2-${SDL2_VERSION}-win32-x64.zip SDL2.dll -d artifacts/x64
curl -s -L -O https://storage.googleapis.com/chromium-browser-snapshots/Win_x64/${CHROMIUM_BUILD_x64}/chrome-win.zip
unzip -j chrome-win.zip chrome-win/libEGL.dll -d artifacts/x64
unzip -j chrome-win.zip chrome-win/libGLESv2.dll -d artifacts/x64
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: Natives-Windows
path: ./artifacts
macos:
name: macOS (x64 + arm64)
runs-on: macos-12
steps:
- name: Setup Dependencies
run: |
mkdir -p artifacts/x86_64
mkdir artifacts/arm64
- name: Compile natives
run: |
curl -s -L -O https://www.libsdl.org/release/SDL2-${SDL2_VERSION}.tar.gz
tar xf SDL2-${SDL2_VERSION}.tar.gz
mkdir SDL2-${SDL2_VERSION}/build
cd SDL2-${SDL2_VERSION}/build
CC=../build-scripts/clang-fat.sh ../configure --without-x --disable-jack --disable-static --prefix "${PWD}"
make
make install
lipo -thin x86_64 lib/libSDL2-2.0.0.dylib -output ../../artifacts/x86_64/SDL2.dylib
lipo -thin arm64 lib/libSDL2-2.0.0.dylib -output ../../artifacts/arm64/SDL2.dylib
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: Natives-MacOS
path: ./artifacts
# Note: Running inside a RockyLinux container because we want to compile using a version of glibc
# that is as old as reasonably possible to ensure backwards compatibility of the compiled binaries.
linux-x64:
name: Linux (x64)
runs-on: ubuntu-22.04
container: rockylinux:8
steps:
- name: Setup Dependencies
run: |
mkdir -p artifacts/x64
dnf -y upgrade
dnf install -y "dnf-command(config-manager)"
dnf config-manager --set-enabled powertools
dnf install -y epel-release
dnf groupinstall -y "Development Tools"
dnf -y update
dnf install -y libXext-devel libX11-devel mesa-libGL-devel mesa-libGLU-devel libXrender-devel libXrandr-devel libXcursor-devel libXinerama-devel libXi-devel wayland-devel wayland-protocols-devel libxkbcommon-x11-devel
- name: Compile natives
run: |
curl -s -L -O https://www.libsdl.org/release/SDL2-${SDL2_VERSION}.tar.gz
tar xf SDL2-${SDL2_VERSION}.tar.gz
cd SDL2-${SDL2_VERSION}
./configure --disable-rpath --enable-loadso --disable-audio --disable-sensor --enable-x11-shared --enable-video-wayland --enable-wayland-shared --disable-video-directfb --disable-video-vulkan --disable-video-dummy --disable-power --disable-joystick --disable-haptic --disable-filesystem --disable-file --disable-cpuinfo --prefix "${PWD}"
make
make install
cp lib/libSDL2.so ../artifacts/x64/SDL2.so
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: Natives-Linux(x64)
path: ./artifacts
# Note: Using the run-on-arch action is *very* slow, but is the only way to simulate arm64 architecture.
linux-arm64:
name: Linux (arm64)
runs-on: ubuntu-22.04
steps:
- name: Setup dependencies and compile natives
uses: uraimo/run-on-arch-action@v2
with:
arch: aarch64
distro: ubuntu22.04
shell: /bin/sh
githubToken: ${{ github.token }}
setup: |
mkdir -p "${PWD}/artifacts/arm64"
dockerRunArgs: |
--volume "${PWD}/artifacts:/artifacts"
env: |
SDL2_VERSION: ${{ env.SDL2_VERSION }}
install: |
apt-get update -q -y
apt-get install -y build-essential pkgconf curl libxext-dev libx11-dev libwayland-dev libgl1-mesa-dev libglu1-mesa-dev libxrender-dev libxrandr-dev libxcursor-dev libxinerama-dev libxi-dev libxkbcommon-dev
run: |
curl -s -L -O https://www.libsdl.org/release/SDL2-${SDL2_VERSION}.tar.gz
tar xf SDL2-${SDL2_VERSION}.tar.gz
cd SDL2-${SDL2_VERSION}
./configure --disable-rpath --enable-loadso --disable-audio --disable-sensor --enable-x11-shared --enable-video-wayland --enable-wayland-shared --disable-video-directfb --disable-video-vulkan --disable-video-dummy --disable-power --disable-joystick --disable-haptic --disable-filesystem --disable-file --disable-cpuinfo --prefix "${PWD}"
make
make install
cp lib/libSDL2.so /artifacts/arm64/SDL2.so
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: Natives-Linux(arm64)
path: ./artifacts