diff options
| author | Carlos MartÃn Nieto <[email protected]> | 2017-01-20 22:55:25 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2017-01-20 22:55:25 +0000 |
| commit | 4a14260153072e1e0d8e32d9270b30e3acca7c80 (patch) | |
| tree | 112c3a1f75c2fcc8d3e88f1d0c6687de179e3ac3 /git.go | |
| parent | b8a9efd21f5ea094976ff2c53c4aec1cf6014876 (diff) | |
| parent | b020c1140a2cb8be18141498a6cab5440409dc24 (diff) | |
Merge pull request #362 from libgit2/cmn/master-tip-static
Update master to latest libgit2 and build statically
Diffstat (limited to 'git.go')
| -rw-r--r-- | git.go | 18 |
1 files changed, 15 insertions, 3 deletions
@@ -1,12 +1,15 @@ package git /* +#cgo CFLAGS: -I${SRCDIR}/vendor/libgit2/include +#cgo LDFLAGS: -L${SRCDIR}/vendor/libgit2/build/ -lgit2 +#cgo windows LDFLAGS: -lwinhttp +#cgo !windows pkg-config: --static ${SRCDIR}/vendor/libgit2/build/libgit2.pc #include <git2.h> #include <git2/sys/openssl.h> -#cgo pkg-config: libgit2 -#if LIBGIT2_VER_MAJOR != 0 || LIBGIT2_VER_MINOR != 24 -# error "Invalid libgit2 version; this git2go supports libgit2 v0.24" +#if LIBGIT2_VER_MAJOR != 0 || LIBGIT2_VER_MINOR != 25 +# error "Invalid libgit2 version; this git2go supports libgit2 v0.25" #endif */ @@ -125,6 +128,15 @@ func init() { C.git_libgit2_init() + // Due to the multithreaded nature of Go and its interaction with + // calling C functions, we cannot work with a library that was not built + // with multi-threading support. The most likely outcome is a segfault + // or panic at an incomprehensible time, so let's make it easy by + // panicking right here. + if Features()&FeatureThreads == 0 { + panic("libgit2 was not built with threading support") + } + // This is not something we should be doing, as we may be // stomping all over someone else's setup. The user should do // this themselves or use some binding/wrapper which does it |
