summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <[email protected]>2014-06-07 02:58:28 +0200
committerCarlos Martín Nieto <[email protected]>2014-06-07 03:03:04 +0200
commitc734fc2a6b015f5b38f30da106736877cfbe02c7 (patch)
tree3b1609277c8f355005c7fd5642d9e2102f1caee4
parent064629428296914c4a5875f8da6b557d55f82930 (diff)
Use a submodule for libgit2
This makes building the static version easier as we know where the repo is and that it's has a known-good version.
-rw-r--r--.gitmodules6
-rw-r--r--Makefile5
-rw-r--r--README.md7
-rwxr-xr-xscript/build-libgit2-static.sh5
m---------vendor/libgit20
5 files changed, 12 insertions, 11 deletions
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..c28b485
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,6 @@
+[submodule "libgit2"]
+ path = libgit2
+ url = ./vendor/libgit2
+[submodule "vendor/libgit2"]
+ path = vendor/libgit2
+ url = https://github.com/libgit2/libgit2
diff --git a/Makefile b/Makefile
index 7d7475c..4ecc8a4 100644
--- a/Makefile
+++ b/Makefile
@@ -3,11 +3,6 @@ default: test
build-libgit2:
./script/build-libgit2-static.sh
-update-libgit2:
- cd vendor/libgit2 && \
- git fetch origin development && \
- git checkout -qf FETCH_HEAD
-
test: build-libgit2
./script/with-static.sh go test ./...
diff --git a/README.md b/README.md
index 15e906c..9a48709 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,12 @@ Go bindings for [libgit2](http://libgit2.github.com/). These bindings are for to
Installing
----------
-Just `go get github.com/libgit2/git2go`. You'll need to have top-of-the-branch libgit2 from development installed in your system and available via `pkg-config`. These bindings are in sync with the top of `development`.
+This project needs libgit2, which is written in C so we need to take an extra step. Run `go get github.com/libgit2/git2go` and go to your `$GOROOT/src/github.com/libgt2/git2go` dir. From there, we need to build the C code and put it into the resulting go binary.
+
+ git submodule update --init
+ make install
+
+will compile libgit2, build it statically into git2go and install the resulting object file where your Go project can use it.
License
-------
diff --git a/script/build-libgit2-static.sh b/script/build-libgit2-static.sh
index 04c649d..e486d1d 100755
--- a/script/build-libgit2-static.sh
+++ b/script/build-libgit2-static.sh
@@ -4,11 +4,6 @@ set -ex
VENDORED_PATH=vendor/libgit2
-# Make sure we have the latest libgit2
-if [ ! -d $VENDORED_PATH ]; then
- git clone --depth 1 --single-branch git://github.com/libgit2/libgit2 $VENDORED_PATH
-fi
-
cd $VENDORED_PATH
cmake -DTHREADSAFE=ON \
diff --git a/vendor/libgit2 b/vendor/libgit2
new file mode 160000
+Subproject 716e20b47eb82ebd94588fe6c950e661b6fe4f1