forked from pchote/Eluant
-
Notifications
You must be signed in to change notification settings - Fork 0
168 lines (145 loc) · 6.07 KB
/
Copy pathbuild-natives.yml
File metadata and controls
168 lines (145 loc) · 6.07 KB
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
name: Build native dependencies (Lua)
env:
LUA_VERSION: 5.1.5 # Make sure this matches the version mentioned in the description in the .nuspec file.
on:
pull_request:
workflow_call:
workflow_dispatch:
permissions:
contents: read
jobs:
windows:
name: Windows (x64)
runs-on: windows-2022
steps:
- name: Setup Dependencies
run: |
New-Item -ItemType Directory -Force artifacts/x64 | Out-Null
- name: Download sources
shell: pwsh
run: |
$version = ${env:LUA_VERSION}
$archive = "lua-${env:LUA_VERSION}.tar.gz"
$url = "https://www.lua.org/ftp/$archive"
Invoke-WebRequest -Uri $url -OutFile $archive
tar xf $archive
- name: Compile natives
shell: pwsh
run: |
$VsInstallPath = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise"
Import-Module "$VsInstallPath\Common7\Tools\Microsoft.VisualStudio.DevShell.dll" -Scope Local
Enter-VsDevShell -VsInstallPath $VsInstallPath -Arch amd64 >$null
cd lua-${env:LUA_VERSION}/src/
cl -MD -O2 -c -DLUA_BUILD_AS_DLL *.c
link -DLL -IMPLIB:lua51.lib -OUT:lua51.dll (Get-ChildItem -Path *.obj -Exclude lua.obj,luac.obj)
cp lua51.dll ../../artifacts/x64/
- name: Upload Artifacts
uses: actions/upload-artifact@v7
with:
name: Natives-Windows
path: ./artifacts
windows-arm64:
name: Windows (arm64)
runs-on: windows-11-arm
steps:
- name: Clone repository
uses: actions/checkout@v7
- name: Setup Dependencies
run: |
New-Item -ItemType Directory -Force artifacts/arm64 | Out-Null
- name: Download sources
shell: pwsh
run: |
$version = ${env:LUA_VERSION}
$archive = "lua-${env:LUA_VERSION}.tar.gz"
$url = "https://www.lua.org/ftp/$archive"
Invoke-WebRequest -Uri $url -OutFile $archive
tar xf $archive
- name: Compile natives
shell: pwsh
run: |
$VsInstallPath = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise"
Import-Module "$VsInstallPath\Common7\Tools\Microsoft.VisualStudio.DevShell.dll" -Scope Local
Enter-VsDevShell -VsInstallPath $VsInstallPath -Arch arm64 >$null
cd lua-${env:LUA_VERSION}/src/
cl -MD -O2 -c -DLUA_BUILD_AS_DLL *.c
link -DLL -IMPLIB:lua51.lib -OUT:lua51.dll (Get-ChildItem -Path *.obj -Exclude lua.obj,luac.obj)
cp lua51.dll ../../artifacts/arm64/
- name: Upload Artifacts
uses: actions/upload-artifact@v7
with:
name: Natives-Windows(arm64)
path: ./artifacts
macos:
name: macOS (x64 + arm64)
runs-on: macos-14
steps:
- name: Clone Repository
uses: actions/checkout@v7
- name: Setup Dependencies
run: |
mkdir -p artifacts/x86_64
mkdir artifacts/arm64
- name: Compile natives
run: |
curl -s -L -O https://www.lua.org/ftp/lua-${LUA_VERSION}.tar.gz
tar xf lua-${LUA_VERSION}.tar.gz
cd lua-${LUA_VERSION}/src/
patch < ../../liblua.macos.patch
make liblua.5.1.dylib CC="clang -target x86_64-apple-macos10.11" LD="clang -target x86_64-apple-macos10.11"
cp liblua.${LUA_VERSION}.dylib ../../artifacts/x86_64/lua51.dylib
make clean
make liblua.5.1.dylib CC="clang -target arm64-apple-macos10.15" LD="clang -target arm64-apple-macos10.15"
cp liblua.${LUA_VERSION}.dylib ../../artifacts/arm64/lua51.dylib
- name: Upload Artifacts
uses: actions/upload-artifact@v7
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: Clone repository
uses: actions/checkout@v7
- name: Setup Dependencies
run: |
mkdir -p artifacts/x64
dnf -y upgrade
dnf install -y gcc make patch
- name: Compile natives
run: |
curl -s -L -O https://www.lua.org/ftp/lua-${LUA_VERSION}.tar.gz
tar xf lua-${LUA_VERSION}.tar.gz
cd lua-${LUA_VERSION}/src/
patch < ../../liblua.linux.patch
make liblua.so
cp liblua.so ../../artifacts/x64/lua51.so
- name: Upload Artifacts
uses: actions/upload-artifact@v7
with:
name: Natives-Linux(x64)
path: ./artifacts
linux-arm64:
name: Linux (arm64)
runs-on: ubuntu-22.04-arm
steps:
- name: Clone Repository
uses: actions/checkout@v7
- name: Setup dependencies and compile natives
run: |
mkdir -p artifacts/arm64
curl -s -L -O https://www.lua.org/ftp/lua-${LUA_VERSION}.tar.gz
tar xf lua-${LUA_VERSION}.tar.gz
cd lua-${LUA_VERSION}/src/
patch < ../../liblua.linux.patch
make liblua.so
cp liblua.so ../../artifacts/arm64/lua51.so
- name: Upload Artifacts
uses: actions/upload-artifact@v7
with:
name: Natives-Linux(arm64)
path: ./artifacts