Skip to content

Commit 0646294

Browse files
committed
Move some logic into the Makefile
This should provide a nice compromise between the scripts and comon commands.
1 parent 29a983b commit 0646294

File tree

4 files changed

+24
-26
lines changed

4 files changed

+24
-26
lines changed

Makefile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
default: test
2+
3+
build-libgit2:
4+
./script/build-libgit2-static.sh
5+
6+
update-libgit2:
7+
cd vendor/libgit2 && \
8+
git fetch origin development && \
9+
git checkout -qf FETCH_HEAD
10+
11+
test: build-libgit2
12+
./script/with-static.sh go test ./...
13+
14+
install: build-libgit2
15+
./script/with-static.sh go install ./...

script/build-libgit2-static.sh

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,19 @@
22

33
set -ex
44

5+
VENDORED_PATH=vendor/libgit2
6+
57
# Make sure we have the latest libgit2
6-
if [ -d libgit2 ]; then
7-
cd libgit2
8-
git fetch origin development
9-
git checkout FETCH_HEAD
10-
cd ..
11-
else
12-
git clone --depth 1 --single-branch git://github.com/libgit2/libgit2 libgit2
8+
if [ ! -d $VENDORED_PATH ]; then
9+
git clone --depth 1 --single-branch git://github.com/libgit2/libgit2 $VENDORED_PATH
1310
fi
1411

15-
cd libgit2
12+
cd $VENDORED_PATH
13+
1614
cmake -DTHREADSAFE=ON \
1715
-DBUILD_CLAR=OFF \
1816
-DBUILD_SHARED_LIBS=OFF \
19-
-DCMAKE_INSTALL_PREFIX=$PWD/install \
17+
-DCMAKE_INSTALL_PREFIX=../install \
2018
.
2119

2220
make install

script/build-libgit2.sh

Lines changed: 0 additions & 13 deletions
This file was deleted.

script/with-static.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22

33
set -ex
44

5-
export LIBGIT2_LOCATION=$PWD/libgit2/install
6-
export PKG_CONFIG_PATH=$LIBGIT2_LOCATION/lib/pkgconfig
7-
export LIBGIT2_A=$LIBGIT2_LOCATION/lib/libgit2.a
8-
export CGO_LDFLAGS="$LIBGIT2_A $(pkg-config --static --libs libgit2)"
5+
export INSTALL_LOCATION=$PWD/vendor/install
6+
export PKG_CONFIG_PATH=$INSTALL_LOCATION/lib/pkgconfig
97

108
$@

0 commit comments

Comments
 (0)