Skip to content

Commit 8250287

Browse files
Add macOS arm64 support (#132)
1 parent d873109 commit 8250287

File tree

5 files changed

+13
-3
lines changed

5 files changed

+13
-3
lines changed

.github/workflows/ci.yml

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ jobs:
3535
name: linux-arm
3636
- os: macos-10.15
3737
name: osx-x64
38+
- os: macos-11
39+
name: osx-arm64
3840
fail-fast: false
3941
steps:
4042
- name: Checkout

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This package contains the compiled versions of the libgit2 native library for
1010
the following platforms:
1111

1212
- Windows (x86, x64, arm64)
13-
- macOS (x64)
13+
- macOS (x64, arm64)
1414
- Linux (arm, arm64, x64)
1515

1616
[lg2s-nb]: https://www.nuget.org/packages/LibGit2Sharp.NativeBinaries

UpdateLibgit2ToSha.ps1

+1
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ Push-Location $libgit2Directory
124124
<dllmap os="linux" cpu="arm" wordsize="32" dll="$binaryFilename" target="lib/linux-arm/lib$binaryFilename.so" />
125125
<dllmap os="linux" cpu="armv8" wordsize="64" dll="$binaryFilename" target="lib/linux-arm64/lib$binaryFilename.so" />
126126
<dllmap os="osx" cpu="x86-64" wordsize="64" dll="$binaryFilename" target="lib/osx-x64/lib$binaryFilename.dylib" />
127+
<dllmap os="osx" cpu="armv8" wordsize="64" dll="$binaryFilename" target="lib/osx-arm64/lib$binaryFilename.dylib" />
127128
</configuration>
128129
"@
129130

build.libgit2.sh

+8-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,13 @@ SHORTSHA=${LIBGIT2SHA:0:7}
77
OS=`uname`
88
ARCH=`uname -m`
99
PACKAGEPATH="nuget.package/runtimes"
10+
OSXARCHITECTURE="x86_64"
1011

1112
if [[ $OS == "Darwin" ]]; then
1213
USEHTTPS="ON"
14+
if [[ $ARCH == "arm64" ]]; then
15+
OSXARCHITECTURE="arm64"
16+
fi
1317
else
1418
USEHTTPS="OpenSSL-Dynamic"
1519
fi
@@ -25,15 +29,17 @@ if [[ $RID == *arm ]]; then
2529
fi
2630

2731
if [[ $RID == *arm64 ]]; then
28-
export TOOLCHAIN_FILE=/nativebinaries/CMakeLists.arm64.txt
32+
if [[ $OS != "Darwin" ]]; then
33+
export TOOLCHAIN_FILE=/nativebinaries/CMakeLists.arm64.txt
34+
fi
2935
fi
3036

3137
cmake -DCMAKE_BUILD_TYPE:STRING=Release \
3238
-DBUILD_CLAR:BOOL=OFF \
3339
-DUSE_SSH=OFF \
3440
-DENABLE_TRACE=ON \
3541
-DLIBGIT2_FILENAME=git2-$SHORTSHA \
36-
-DCMAKE_OSX_ARCHITECTURES="x86_64" \
42+
-DCMAKE_OSX_ARCHITECTURES=$OSXARCHITECTURE \
3743
-DUSE_HTTPS=$USEHTTPS \
3844
-DUSE_BUNDLED_ZLIB=ON \
3945
-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} \

nuget.package/libgit2/LibGit2Sharp.dll.config

+1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
<dllmap os="linux" cpu="arm" wordsize="32" dll="git2-b7bad55" target="lib/linux-arm/libgit2-b7bad55.so" />
44
<dllmap os="linux" cpu="armv8" wordsize="64" dll="git2-b7bad55" target="lib/linux-arm64/libgit2-b7bad55.so" />
55
<dllmap os="osx" cpu="x86-64" wordsize="64" dll="git2-b7bad55" target="lib/osx-x64/libgit2-b7bad55.dylib" />
6+
<dllmap os="osx" cpu="armv8" wordsize="64" dll="git2-b7bad55" target="lib/osx-arm64/libgit2-b7bad55.dylib" />
67
</configuration>

0 commit comments

Comments
 (0)