summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <[email protected]>2014-06-03 12:03:00 +0200
committerCarlos Martín Nieto <[email protected]>2014-06-03 12:03:00 +0200
commitde4f42f476e9d635a2452fa9562b60ba5ef39842 (patch)
treebeb8f69264112eb17b7be0d6db63a14422f685cb
parent3ca566e105e8156a2583f36e9dd9e06ed3b3564c (diff)
Add scripts to build and use a static libgit2
-rwxr-xr-xscript/build-libgit2-static.sh22
-rwxr-xr-xscript/with-static.sh10
2 files changed, 32 insertions, 0 deletions
diff --git a/script/build-libgit2-static.sh b/script/build-libgit2-static.sh
new file mode 100755
index 0000000..c896de8
--- /dev/null
+++ b/script/build-libgit2-static.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+set -ex
+
+# Make sure we have the latest libgit2
+if [ -d libgit2 ]; then
+ cd libgit2
+ git fetch origin development
+ git checkout FETCH_HEAD
+ cd ..
+else
+ git clone --depth 1 --single-branch git://github.com/libgit2/libgit2 libgit2
+fi
+
+cd libgit2
+cmake -DTHREADSAFE=ON \
+ -DBUILD_CLAR=OFF \
+ -DBUILD_SHARED_LIBS=OFF \
+ -DCMAKE_INSTALL_PREFIX=$PWD/install \
+ .
+
+make install
diff --git a/script/with-static.sh b/script/with-static.sh
new file mode 100755
index 0000000..fe91334
--- /dev/null
+++ b/script/with-static.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+set -ex
+
+export LIBGIT2_LOCATION=$PWD/libgit2/install
+export PKG_CONFIG_PATH=$LIBGIT2_LOCATION/lib/pkgconfig
+export LIBGIT2_A=$LIBGIT2_LOCATION/lib/libgit2.a
+export CGO_LDFLAGS="$LIBGIT2_A $(pkg-config --static --libs libgit2)"
+
+$@