git2go/Makefile

71 lines
2.0 KiB
Makefile

TEST_ARGS ?= --count=1
PKG_CONFIG_PATH=/opt/libgit2/
default: goimports test
goimports:
goimports -w *.go
generate: static-build/install/lib/libgit2.a
go generate --tags "static" ./...
# System library
# ==============
# This uses whatever version of libgit2 can be found in the system.
test:
-go-mod-clean # go install go.wit.com/apps/go-mod-clean@latest
go run script/check-MakeGitError-thread-lock.go
PKG_CONFIG_PATH=/opt/libgit2/ go test -v -x $(TEST_ARGS) ./...
add-remote:
git remote add git2go https://github.com/libgit2/git2go.git
install:
go install ./...
clean:
rm go.*
# Bundled dynamic library
# =======================
# In order to avoid having to manipulate `git_dynamic.go`, which would prevent
# the system-wide libgit2.so from being used in a sort of ergonomic way, this
# instead moves the complexity of overriding the paths so that the built
# libraries can be found by the build and tests.
.PHONY: build-libgit2-dynamic
build-libgit2-dynamic:
./script/build-libgit2-dynamic.sh
dynamic-build/install/lib/libgit2.so:
./script/build-libgit2-dynamic.sh
test-dynamic: dynamic-build/install/lib/libgit2.so
PKG_CONFIG_PATH=dynamic-build/install/lib/pkgconfig \
go run script/check-MakeGitError-thread-lock.go
PKG_CONFIG_PATH=dynamic-build/install/lib/pkgconfig \
LD_LIBRARY_PATH=dynamic-build/install/lib \
go test $(TEST_ARGS) ./...
install-dynamic: dynamic-build/install/lib/libgit2.so
PKG_CONFIG_PATH=dynamic-build/install/lib/pkgconfig \
go install ./...
# Bundled static library
# ======================
# This is mostly used in tests, but can also be used to provide a
# statically-linked library with the bundled version of libgit2.
.PHONY: build-libgit2-static
build-libgit2-static:
./script/build-libgit2-static.sh
static-build/install/lib/libgit2.a:
./script/build-libgit2-static.sh
test-static: static-build/install/lib/libgit2.a
go run script/check-MakeGitError-thread-lock.go
go test --tags "static" $(TEST_ARGS) ./...
install-static: static-build/install/lib/libgit2.a
go install --tags "static" ./...