forked from libgit2/libgit2sharp.nativebinaries
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.libgit2.sh
executable file
·63 lines (50 loc) · 1.21 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
56
57
58
59
60
61
62
63
#!/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"
if [[ $OS == "Darwin" ]]; then
USEHTTPS="ON"
else
USEHTTPS="OFF"
fi
rm -rf libgit2/build
mkdir libgit2/build
pushd libgit2/build
export _BINPATH=`pwd`
if [[ $RID == *arm ]]; then
export TOOLCHAIN_FILE=/nativebinaries/CMakeLists.arm.txt
fi
if [[ $RID == *arm64 ]]; then
export TOOLCHAIN_FILE=/nativebinaries/CMakeLists.arm64.txt
fi
cmake -DCMAKE_BUILD_TYPE:STRING=Release \
-DBUILD_CLAR:BOOL=OFF \
-DUSE_SSH=OFF \
-DENABLE_TRACE=ON \
-DLIBGIT2_FILENAME=git2-$SHORTSHA \
-DCMAKE_OSX_ARCHITECTURES="i386;x86_64" \
-DUSE_HTTPS=$USEHTTPS \
-DUSE_BUNDLED_ZLIB=ON \
-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} \
..
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)"
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