-
Notifications
You must be signed in to change notification settings - Fork 280
/
update_libgit2_ios.sh
executable file
·60 lines (42 loc) · 1.58 KB
/
update_libgit2_ios.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
set -e
if [ "libgit2-ios.a" -nt "libgit2" ]
then
echo "No update needed."
exit 0
fi
ios_version="6.0";
cd "libgit2"
# armv7 build
if [ -d "build" ]; then
rm -rf "build"
fi
mkdir build
cd build
cmake -DCMAKE_C_COMPILER_WORKS:BOOL=ON -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_C_COMPILER=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2 -DCMAKE_OSX_ARCHITECTURES:STRING=armv7 -DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${ios_version}.sdk/ ..
cmake --build .
product="libgit2.a"
install_path="../../libgit2-ios-armv7.a"
if [ "${product}" -nt "${install_path}" ]; then
cp -v "${product}" "${install_path}"
fi
cd ../
# i386 build
if [ -d "build" ]; then
rm -rf "build"
fi
mkdir build
cd build
cmake -DCMAKE_C_COMPILER_WORKS:BOOL=ON -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_C_COMPILER=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2 -DCMAKE_OSX_ARCHITECTURES:STRING=i386 -DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator${ios_version}.sdk/ ..
cmake --build .
product="libgit2.a"
install_path="../../libgit2-ios-i386.a"
if [ "${product}" -nt "${install_path}" ]; then
cp -v "${product}" "${install_path}"
fi
cd ../../
# link static libraries
libtool -static libgit2-ios-armv7.a libgit2-ios-i386.a -o libgit2-ios.a
# cleanup
rm libgit2-ios-armv7.a
rm libgit2-ios-i386.a
echo "libgit2-ios has been updated."