From 1b11e11a90651d41c4e1c69b24df3c2d18c8ca23 Mon Sep 17 00:00:00 2001 From: Hidde Beydals Date: Mon, 4 Oct 2021 13:51:04 +0200 Subject: [PATCH] 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 --- Makefile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index c8769a6f..bdfa840f 100644 --- a/Makefile +++ b/Makefile @@ -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); \