Skip to content

Commit a2b14b5

Browse files
committed
Tighten up the build
Build as release, and there is no need to install the library, we know where the files are.
1 parent 12a3a1e commit a2b14b5

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

script/build-libgit2-static.sh

+6-4
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ set -ex
44

55
VENDORED_PATH=vendor/libgit2
66

7-
cd $VENDORED_PATH
8-
7+
cd $VENDORED_PATH &&
8+
mkdir -p build &&
9+
cd build &&
910
cmake -DTHREADSAFE=ON \
1011
-DBUILD_CLAR=OFF \
1112
-DBUILD_SHARED_LIBS=OFF \
1213
-DCMAKE_C_FLAGS=-fPIC \
14+
-DCMAKE_BUILD_TYPE="RelWithDebInfo" \
1315
-DCMAKE_INSTALL_PREFIX=../install \
14-
.
16+
.. &&
1517

16-
make install
18+
cmake --build .

script/with-static.sh

+4-6
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22

33
set -ex
44

5-
export INSTALL_LOCATION=$PWD/vendor/install
6-
export PKG_CONFIG_PATH=$INSTALL_LOCATION/lib/pkgconfig
5+
export BUILD="$PWD/vendor/libgit2/build"
6+
export PCFILE="$BUILD/libgit2.pc"
77

8-
export PCFILE="$PWD/vendor/libgit2/libgit2.pc"
9-
10-
export CGO_LDFLAGS="$PWD/vendor/libgit2/libgit2.a $(pkg-config --static --libs $PCFILE)"
11-
export CGO_CFLAGS="$(pkg-config --static --cflags $PCFILE)"
8+
export CGO_LDFLAGS="$BUILD/libgit2.a -L$BUILD $(pkg-config --static --libs $PCFILE)"
9+
export CGO_CFLAGS="-I$PWD/vendor/libgit2/include"
1210

1311
$@

0 commit comments

Comments
 (0)