-
Notifications
You must be signed in to change notification settings - Fork 63
/
build.libgit2.sh
executable file
·55 lines (44 loc) · 1.1 KB
/
build.libgit2.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
#!/bin/bash
set -e
LIBGIT2SHA=`cat ./nuget.package/libgit2/libgit2_hash.txt`
SHORTSHA=${LIBGIT2SHA:0:7}
OS=`uname`
ARCH=`uname -m`
PACKAGEPATH="nuget.package/runtimes"
OSXARCHITECTURE=$ARCH
if [[ $OS == "Darwin" ]]; then
USEHTTPS="ON"
if [[ $RID == "osx-arm64" ]]; then
OSXARCHITECTURE="arm64"
elif [[ $RID == "osx-x64" ]]; then
OSXARCHITECTURE="x86_64"
fi
else
USEHTTPS="OpenSSL-Dynamic"
fi
rm -rf libgit2/build
mkdir libgit2/build
pushd libgit2/build
export _BINPATH=`pwd`
cmake -DCMAKE_BUILD_TYPE:STRING=Release \
-DBUILD_TESTS:BOOL=OFF \
-DUSE_SSH=exec \
-DLIBGIT2_FILENAME=git2-$SHORTSHA \
-DCMAKE_OSX_ARCHITECTURES=$OSXARCHITECTURE \
-DUSE_HTTPS=$USEHTTPS \
-DUSE_BUNDLED_ZLIB=ON \
..
cmake --build .
popd
if [[ $RID == "" ]]; then
echo "$(tput setaf 3)RID not defined. Skipping copy to package path.$(tput sgr0)"
exit 0
fi
if [[ $OS == "Darwin" ]]; then
LIBEXT="dylib"
else
LIBEXT="so"
fi
rm -rf $PACKAGEPATH/$RID
mkdir -p $PACKAGEPATH/$RID/native
cp libgit2/build/libgit2-$SHORTSHA.$LIBEXT $PACKAGEPATH/$RID/native