Skip to content

Add MacOS Arm64 support (Take 2) #132

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Nov 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ jobs:
name: linux-arm
- os: macos-10.15
name: osx-x64
- os: macos-11
name: osx-arm64
fail-fast: false
steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This package contains the compiled versions of the libgit2 native library for
the following platforms:

- Windows (x86, x64, arm64)
- macOS (x64)
- macOS (x64, arm64)
- Linux (arm, arm64, x64)

[lg2s-nb]: https://www.nuget.org/packages/LibGit2Sharp.NativeBinaries
Expand Down
1 change: 1 addition & 0 deletions UpdateLibgit2ToSha.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ Push-Location $libgit2Directory
<dllmap os="linux" cpu="arm" wordsize="32" dll="$binaryFilename" target="lib/linux-arm/lib$binaryFilename.so" />
<dllmap os="linux" cpu="armv8" wordsize="64" dll="$binaryFilename" target="lib/linux-arm64/lib$binaryFilename.so" />
<dllmap os="osx" cpu="x86-64" wordsize="64" dll="$binaryFilename" target="lib/osx-x64/lib$binaryFilename.dylib" />
<dllmap os="osx" cpu="armv8" wordsize="64" dll="$binaryFilename" target="lib/osx-arm64/lib$binaryFilename.dylib" />
</configuration>
"@

Expand Down
10 changes: 8 additions & 2 deletions build.libgit2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@ SHORTSHA=${LIBGIT2SHA:0:7}
OS=`uname`
ARCH=`uname -m`
PACKAGEPATH="nuget.package/runtimes"
OSXARCHITECTURE="x86_64"

if [[ $OS == "Darwin" ]]; then
USEHTTPS="ON"
if [[ $ARCH == "arm64" ]]; then
OSXARCHITECTURE="arm64"
fi
else
USEHTTPS="OpenSSL-Dynamic"
fi
Expand All @@ -25,15 +29,17 @@ if [[ $RID == *arm ]]; then
fi

if [[ $RID == *arm64 ]]; then
export TOOLCHAIN_FILE=/nativebinaries/CMakeLists.arm64.txt
if [[ $OS != "Darwin" ]]; then
export TOOLCHAIN_FILE=/nativebinaries/CMakeLists.arm64.txt
fi
fi

cmake -DCMAKE_BUILD_TYPE:STRING=Release \
-DBUILD_CLAR:BOOL=OFF \
-DUSE_SSH=OFF \
-DENABLE_TRACE=ON \
-DLIBGIT2_FILENAME=git2-$SHORTSHA \
-DCMAKE_OSX_ARCHITECTURES="x86_64" \
-DCMAKE_OSX_ARCHITECTURES=$OSXARCHITECTURE \
-DUSE_HTTPS=$USEHTTPS \
-DUSE_BUNDLED_ZLIB=ON \
-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} \
Expand Down
1 change: 1 addition & 0 deletions nuget.package/libgit2/LibGit2Sharp.dll.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
<dllmap os="linux" cpu="arm" wordsize="32" dll="git2-b7bad55" target="lib/linux-arm/libgit2-b7bad55.so" />
<dllmap os="linux" cpu="armv8" wordsize="64" dll="git2-b7bad55" target="lib/linux-arm64/libgit2-b7bad55.so" />
<dllmap os="osx" cpu="x86-64" wordsize="64" dll="git2-b7bad55" target="lib/osx-x64/libgit2-b7bad55.dylib" />
<dllmap os="osx" cpu="armv8" wordsize="64" dll="git2-b7bad55" target="lib/osx-arm64/libgit2-b7bad55.dylib" />
</configuration>