Allow libgit2 build to be enforced

This can be useful on machines where libgit2 is installed due to other
applications depending on it, but where the composition of this
installation does not properly work with the controller.

Reason the system version is still preferred, is because this lowers the
barrier for drive-by contributors, as a working set of (Git) dependencies
should only really be required if you are going to perform work in that
domain.

Signed-off-by: Hidde Beydals <hello@hidde.co>
This commit is contained in:
Hidde Beydals 2021-10-04 13:51:04 +02:00 committed by pa250194
parent 500d0aeda0
commit 1b11e11a90
1 changed files with 8 additions and 3 deletions

View File

@ -18,8 +18,10 @@ CRD_OPTIONS ?= crd:crdVersions=v1
# Repository root based on Git metadata
REPOSITORY_ROOT := $(shell git rev-parse --show-toplevel)
# Dependency versions
# Libgit2 version
LIBGIT2_VERSION ?= 1.1.1
# Other dependency versions
ENVTEST_BIN_VERSION ?= 1.19.2
KUBEBUILDER_ASSETS ?= $(shell $(SETUP_ENVTEST) use -i $(ENVTEST_BIN_VERSION) -p path)
@ -31,6 +33,10 @@ LIBGIT2_PATH := $(REPOSITORY_ROOT)/hack/libgit2
LIBGIT2_LIB_PATH := $(LIBGIT2_PATH)/lib
LIBGIT2 := $(LIBGIT2_LIB_PATH)/libgit2.so.$(LIBGIT2_VERSION)
ifneq ($(LIBGIT2_VERSION),$(SYSTEM_LIBGIT2_VERSION))
LIBGIT2_FORCE ?= 1
endif
# API (doc) generation utilities
CONTROLLER_GEN_VERSION ?= v0.5.0
GEN_API_REF_DOCS_VERSION ?= 0.3.0
@ -164,8 +170,7 @@ endif
libgit2: $(LIBGIT2) ## Detect or download libgit2 library
$(LIBGIT2):
ifeq ($(LIBGIT2_VERSION),$(SYSTEM_LIBGIT2_VERSION))
else
ifeq (1, $(LIBGIT2_FORCE))
@{ \
set -e; \
mkdir -p $(LIBGIT2_PATH); \