Skip to content

Commit 7db1fac

Browse files
authored
Merge pull request #25 from gitx/M1
Apple Silicon support (it builds local too)
2 parents 972f9aa + d5795c6 commit 7db1fac

File tree

4 files changed

+21
-14
lines changed

4 files changed

+21
-14
lines changed

.github/workflows/BuildPR.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,7 @@ jobs:
1818
submodules: true
1919
- name: Set XCode Version
2020
run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app
21+
- name: pre build
22+
run: script/bootstrap && script/update_libgit2
2123
- name: Build project
2224
run: xcodebuild -workspace ObjectiveGitFramework.xcworkspace -scheme "ObjectiveGit Mac" archive ARCHS="x86_64 arm64"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ build-iPhoneOS/*
99
objective-git.bridgesupport
1010
ObjectiveGitFramework/build/*
1111
ObjectiveGit-iOS.framework/*
12+
External/libssh2.a
1213
External/libgit2*.a
1314
External/libgit2-ios
1415

ObjectiveGitFramework.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1695,7 +1695,7 @@
16951695
"-lgit2",
16961696
"-force_load",
16971697
External/libgit2.a,
1698-
/usr/local/lib/libssh2.a,
1698+
External/libssh2.a,
16991699
"-lcrypto",
17001700
"-lssl",
17011701
"-lcurl",
@@ -1724,7 +1724,7 @@
17241724
"-lgit2",
17251725
"-force_load",
17261726
External/libgit2.a,
1727-
/usr/local/lib/libssh2.a,
1727+
External/libssh2.a,
17281728
"-lcrypto",
17291729
"-lssl",
17301730
"-lcurl",
@@ -1964,7 +1964,7 @@
19641964
"-lgit2",
19651965
"-force_load",
19661966
External/libgit2.a,
1967-
/usr/local/lib/libssh2.a,
1967+
External/libssh2.a,
19681968
"-lcrypto",
19691969
"-lssl",
19701970
"-lcurl",
@@ -2184,7 +2184,7 @@
21842184
"-lgit2",
21852185
"-force_load",
21862186
External/libgit2.a,
2187-
/usr/local/lib/libssh2.a,
2187+
External/libssh2.a,
21882188
"-lcrypto",
21892189
"-lssl",
21902190
"-lcurl",

script/bootstrap

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ main ()
2626

2727
if [ -n "$REQUIRED_TOOLS" ]
2828
then
29-
echo "*** Checking dependencies..."
29+
echo "** Checking dependencies in Homebrew ..."
3030
check_deps
3131
fi
3232
}
@@ -48,6 +48,15 @@ check_deps ()
4848
exit $result
4949
fi
5050

51+
brew_prefix=`brew --prefix`
52+
if [[ `uname -m` == 'arm64' ]]; then
53+
echo "** Running on a Apple Silicon M1"
54+
export expected_prefix=/opt/homebrew
55+
else
56+
echo "** Running on a Apple x86"
57+
export expected_prefix=/usr/local
58+
fi
59+
5160
# Ensure that we have libgit2's dependencies installed.
5261
installed=`brew list`
5362

@@ -58,7 +67,7 @@ check_deps ()
5867

5968
if [ "$code" -eq "0" ]
6069
then
61-
echo "*** $tool is available"
70+
echo "*** $tool is available in 👍"
6271
continue
6372
elif [ "$code" -ne "1" ]
6473
then
@@ -69,14 +78,9 @@ check_deps ()
6978
brew install "$tool"
7079
done
7180

72-
brew_prefix=`brew --prefix`
73-
if [[ `uname -m` == 'arm64' ]]; then
74-
echo "Running on a Apple Silicon M1"
75-
export expected_prefix=/opt/homebrew
76-
else
77-
echo "Running on a Apple x86"
78-
export expected_prefix=/usr/local
79-
fi
81+
install_path="./External"
82+
echo "*** copy "$brew_prefix"/lib/libssh2.a to $install_path"
83+
cp "$brew_prefix"/lib/libssh2.a $install_path
8084

8185
if [ "$brew_prefix" != "$expected_prefix" ]
8286
then

0 commit comments

Comments
 (0)