Skip to content

Commit 68e3d04

Browse files
committed
fix: add mac build
1 parent 2937229 commit 68e3d04

File tree

3 files changed

+69
-16
lines changed

3 files changed

+69
-16
lines changed

.github/workflows/cmake-multiple-platform.yml

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ jobs:
6464
arch: x86_64
6565
container: registry.gitlab.steamos.cloud/steamrt/sniper/sdk:latest
6666
setup_env: gcc14
67+
- os: macos-latest
68+
platform: osx-arm64
69+
arch: arm64
70+
container: null
71+
setup_env: clang
6772
runs-on: ${{ matrix.os }}
6873
container: ${{ matrix.container }}
6974
steps:
@@ -88,8 +93,16 @@ jobs:
8893
ln -sf /usr/bin/gcc-14 /usr/bin/gcc && ln -sf /usr/bin/g++-14 /usr/bin/g++
8994
# for ACT add nodejs
9095

96+
# macOS-specific setup
97+
- name: Setup macOS build environment
98+
if: matrix.setup_env == 'clang'
99+
shell: bash -el {0}
100+
run: |
101+
# Install ninja via homebrew if not present
102+
brew list ninja &>/dev/null || brew install ninja
103+
91104
- name: Setup CMake
92-
if: matrix.setup_env == 'msvc'
105+
if: matrix.setup_env == 'msvc' || matrix.setup_env == 'clang'
93106
uses: lukka/get-cmake@latest
94107

95108
- name: Cache build dependencies
@@ -185,6 +198,8 @@ jobs:
185198
platform: win-64
186199
- os: ubuntu-latest
187200
platform: linux-64
201+
- os: macos-latest
202+
platform: osx-arm64
188203
runs-on: ${{ matrix.os }}
189204
outputs:
190205
url: ${{ steps.release.outputs.url }}
@@ -255,8 +270,8 @@ jobs:
255270
version="${version#v}" # Remove leading 'v'
256271
sed "s/REPLACE_VERSION/$version/g" "conda/meta.yaml.example" > "conda/meta.yaml"
257272
258-
# Ensure build.sh is executable on Linux
259-
if [[ "$RUNNER_OS" == "Linux" ]]; then
273+
# Ensure build.sh is executable on Unix systems
274+
if [[ "$RUNNER_OS" == "Linux" ]] || [[ "$RUNNER_OS" == "macOS" ]]; then
260275
chmod +x "conda/build.sh"
261276
fi
262277
@@ -336,18 +351,20 @@ jobs:
336351
env:
337352
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
338353
run: |
339-
mkdir -p build/repo/{linux-64,win-64,noarch}
354+
mkdir -p build/repo/{linux-64,win-64,osx-arm64,noarch}
340355
gh api /repos/${{ github.repository }}/releases?per_page=10 \
341356
| jq -r '.[] | .assets[] | .browser_download_url' \
342357
| grep -E "(\.tar\.bz2|\.conda)$" > urls.txt
343358
344359
# separate by platform
345360
grep linux-64 urls.txt > linux.txt || true
346361
grep win-64 urls.txt > win.txt || true
362+
grep osx-arm64 urls.txt > osx.txt || true
347363
grep -v -E "(linux-64|win-64)" urls.txt > noarch.txt || true
348364

349365
[ -s linux.txt ] && aria2c -x4 -s4 -j4 -i linux.txt -d build/repo/linux-64/ --continue
350366
[ -s win.txt ] && aria2c -x4 -s4 -j4 -i win.txt -d build/repo/win-64/ --continue
367+
[ -s osx.txt ] && aria2c -x4 -s4 -j4 -i osx.txt -d build/repo/osx-arm64/ --continue
351368
[ -s noarch.txt ]&& aria2c -x4 -s4 -j4 -i noarch.txt -d build/repo/noarch/ --continue
352369

353370
- name: Download conda packages
@@ -424,6 +441,7 @@ jobs:
424441
<div class="platforms">
425442
<a href="linux-64/" class="platform-link">🐧 Linux (64-bit)</a>
426443
<a href="win-64/" class="platform-link">🪟 Windows (64-bit)</a>
444+
<a href="osx-arm64/" class="platform-link">🍎 macOS (ARM64)</a>
427445
<a href="noarch/" class="platform-link">📦 NoArch</a>
428446
</div>
429447
</div>

conda/build.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,30 @@
33

44
set -ex
55

6+
# Detect the platform and set the appropriate library extension
7+
if [[ "$OSTYPE" == "darwin"* ]]; then
8+
LIB_EXT="dylib"
9+
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
10+
LIB_EXT="so"
11+
else
12+
echo "Unsupported platform: $OSTYPE"
13+
exit 1
14+
fi
15+
616
# Create the target directories
717
mkdir -p $PREFIX/bin
818
mkdir -p $PREFIX/api
919
mkdir -p $PREFIX/dotnet
1020
mkdir -p $PREFIX
1121

1222
# Copy the shared library and module file
13-
cp bin/libplugify-module-dotnet.so $PREFIX/bin/
23+
cp bin/libplugify-module-dotnet.$LIB_EXT $PREFIX/bin/
1424
cp -r api/* $PREFIX/api/
1525
cp -r dotnet/* $PREFIX/dotnet/
1626
cp plugify-module-dotnet.pmodule $PREFIX/
1727

1828
# Set proper permissions
19-
chmod 755 $PREFIX/bin/libplugify-module-dotnet.so
29+
chmod 755 $PREFIX/bin/libplugify-module-dotnet.$LIB_EXT
2030
chmod -R 755 $PREFIX/api
2131
chmod -R 755 $PREFIX/dotnet
2232
chmod 644 $PREFIX/plugify-module-dotnet.pmodule

conda/meta.yaml.example

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,52 @@ build:
1212
number: 0
1313
string: "{{ target_platform | replace('-', '_') }}"
1414
missing_dso_whitelist:
15-
- "*/ld-linux*.so.*" # [linux]
16-
- "*/libc.so.*" # [linux]
17-
- "*/libm.so.*" # [linux]
18-
- "*/libdl.so.*" # [linux]
19-
- "*/libpthread.so.*" # [linux]
20-
- "*/librt.so.*" # [linux]
21-
- "*/libplugify.so*" # [linux]
22-
- "*/libhostfxr.so*" # [linux]
23-
- "*/plugify.dll" # [win]
24-
- "*/hostfxr.dll" # [win]
15+
# Linux system libraries
16+
- "*/ld-linux*.so.*" # [linux]
17+
- "*/libc.so.*" # [linux]
18+
- "*/libm.so.*" # [linux]
19+
- "*/libdl.so.*" # [linux]
20+
- "*/libpthread.so.*" # [linux]
21+
- "*/librt.so.*" # [linux]
22+
- "*/libplugify.so*" # [linux]
23+
- "*/libhostfxr.so*" # [linux]
24+
# macOS system libraries and frameworks
25+
- "/usr/lib/libc++.1.dylib" # [osx]
26+
- "/usr/lib/libSystem.B.dylib" # [osx]
27+
- "/usr/lib/libc++abi.dylib" # [osx]
28+
- "/usr/lib/libutil.dylib" # [osx]
29+
- "/System/Library/Frameworks/*" # [osx]
30+
- "*/libplugify.dylib" # [osx]
31+
- "*/libplugify.*.dylib" # [osx]
32+
- "@rpath/libplugify.dylib" # [osx]
33+
- "@loader_path/libplugify.dylib" # [osx]
34+
- "*/libhostfxr.dylib" # [osx]
35+
- "*/libhostfxr.*.dylib" # [osx]
36+
- "@rpath/libhostfxr.dylib" # [osx]
37+
- "@loader_path/libhostfxr.dylib" # [osx]
38+
# Windows libraries
39+
- "*/plugify.dll" # [win]
40+
- "*/hostfxr.dll" # [win]
2541

2642
requirements:
2743
run:
2844
- __glibc >=2.17 # [linux64]
45+
- __osx >=11.0 # [osx and arm64]
2946

3047
test:
3148
commands:
49+
# Linux tests
3250
- test -f $PREFIX/bin/libplugify-module-dotnet.so # [linux]
3351
- test -d $PREFIX/api # [linux]
3452
- test -d $PREFIX/dotnet # [linux]
3553
- test -f $PREFIX/plugify-module-dotnet.pmodule # [linux]
54+
# macOS tests
55+
- test -f $PREFIX/bin/libplugify-module-dotnet.dylib # [osx]
56+
- test -d $PREFIX/api # [osx]
57+
- test -d $PREFIX/dotnet # [osx]
58+
- test -f $PREFIX/plugify-module-dotnet.pmodule # [osx]
59+
- otool -L $PREFIX/bin/libplugify-module-dotnet.dylib # [osx]
60+
# Windows tests
3661
- if not exist %PREFIX%\\bin\\plugify-module-dotnet.dll exit 1 # [win]
3762
- if not exist %PREFIX%\\api exit 1 # [win]
3863
- if not exist %PREFIX%\\dotnet exit 1 # [win]

0 commit comments

Comments
 (0)