Skip to content

Commit

Permalink
Merge pull request #134 from libgit2/fix-osx-arm64
Browse files Browse the repository at this point in the history
Fix macOS cross compilation
  • Loading branch information
bording committed Nov 11, 2021
2 parents 695ffa4 + a07d368 commit 2215fc4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
26 changes: 12 additions & 14 deletions build.libgit2.sh
Expand Up @@ -7,15 +7,17 @@ SHORTSHA=${LIBGIT2SHA:0:7}
OS=`uname`
ARCH=`uname -m`
PACKAGEPATH="nuget.package/runtimes"
OSXARCHITECTURE="x86_64"
OSXARCHITECTURE=$ARCH

if [[ $OS == "Darwin" ]]; then
USEHTTPS="ON"
if [[ $ARCH == "arm64" ]]; then
OSXARCHITECTURE="arm64"
fi
USEHTTPS="ON"
if [[ $RID == "osx-arm64" ]]; then
OSXARCHITECTURE="arm64"
elif [[ $RID == "osx-x64" ]]; then
OSXARCHITECTURE="x86_64"
fi
else
USEHTTPS="OpenSSL-Dynamic"
USEHTTPS="OpenSSL-Dynamic"
fi

rm -rf libgit2/build
Expand All @@ -38,18 +40,14 @@ cmake --build .
popd

if [[ $RID == "" ]]; then
if [[ $ARCH == "x86_64" ]]; then
RID="unix-x64"
else
RID="unix-x86"
fi
echo "$(tput setaf 3)RID not defined. Falling back to '$RID'.$(tput sgr0)"
echo "$(tput setaf 3)RID not defined. Skipping copy to package path.$(tput sgr0)"
exit 0
fi

if [[ $OS == "Darwin" ]]; then
LIBEXT="dylib"
LIBEXT="dylib"
else
LIBEXT="so"
LIBEXT="so"
fi

rm -rf $PACKAGEPATH/$RID
Expand Down
6 changes: 3 additions & 3 deletions dockerbuild.sh
Expand Up @@ -4,11 +4,11 @@ set -e
echo "building for $RID"

if [[ $RID =~ arm64 ]]; then
arch="arm64"
arch="arm64"
elif [[ $RID =~ arm ]]; then
arch="armhf"
arch="armhf"
else
arch="amd64"
arch="amd64"
fi

if [[ $RID == linux-musl* ]]; then
Expand Down

0 comments on commit 2215fc4

Please sign in to comment.