This change:
* Uses the installed version of both the library and the pkgconfig file,
which fixes path resolution on Ubuntu Xenial.
* Uses quoting liberally so that paths with spaces in them are correctly
handled.
* Moves the build+install directories to static-build/ in the git2go
repository to avoid having a dirty vendor/libgit2 checkout.
When using the static linking option on platforms that use pkg-config,
use ONLY pkg-config to get the CFLAGS and LDFLAGS. This prevents pulling
in dependencies and flags for any non-vendored version that may be
present on the host.
The main practical effect of this is that if someone doesn't need/want
any sort of remote access support at all they can completely disable
libcurl, libssh2, libssl, etc and produce a smaller/simpler binary and
greatly simplify their build-time dependencies. When done properly, the
generated pkg-config file will tell cgo everything it needs to know.
This also prevents confusion if there is a system copy of libgit2 that
is being given priority over the vendored build.
Signed-off-by: Ryan Graham <r.m.graham@gmail.com>
CGO can perform variable substitution in the directives, so we don't
need to use a script to set up the variables; we can let the go tool do
it for us.
We have our own libgit2 in a submodule, so this is unnecessary. While in
the area, update which version of libgit2 would be downloaded and remove
unnecessary CMake flags.
The cgo directives let us do a lot more than I previously thought, so we
can use this to make the building process of git2go go through the go
tool directly rather than via the script.
libgit2 still needs to be built manually, so we do still require make,
but only for building libgit2. Once that's built, any modifications to
git2go's own code can be built with
go build