@@ -7,8 +7,8 @@ TAG ?= latest
7
7
CRD_OPTIONS ?= crd:crdVersions=v1
8
8
9
9
# Base image used to build the Go binary
10
- LIBGIT2_IMG ?= ghcr.io/fluxcd /golang-with-libgit2-all
11
- LIBGIT2_TAG ?= v0.1.2
10
+ LIBGIT2_IMG ?= ghcr.io/pjbgf /golang-with-libgit2-only
11
+ LIBGIT2_TAG ?= v0.0.9
12
12
13
13
# Allows for defining additional Docker buildx arguments,
14
14
# e.g. '--push'.
@@ -42,37 +42,20 @@ LIBGIT2_PATH := $(BUILD_DIR)/libgit2/$(LIBGIT2_TAG)
42
42
LIBGIT2_LIB_PATH := $(LIBGIT2_PATH ) /lib
43
43
LIBGIT2_LIB64_PATH := $(LIBGIT2_PATH ) /lib64
44
44
LIBGIT2 := $(LIBGIT2_LIB_PATH ) /libgit2.a
45
- MUSL-CC =
46
45
47
46
export CGO_ENABLED =1
48
47
export PKG_CONFIG_PATH =$(LIBGIT2_LIB_PATH ) /pkgconfig
49
48
export LIBRARY_PATH =$(LIBGIT2_LIB_PATH )
50
49
export CGO_CFLAGS =-I$(LIBGIT2_PATH ) /include -I$(LIBGIT2_PATH ) /include/openssl
51
-
50
+ export CGO_LDFLAGS = $( shell PKG_CONFIG_PATH= $( PKG_CONFIG_PATH ) pkg-config --libs --static --cflags libgit2 2>/dev/null)
52
51
53
52
# The pkg-config command will yield warning messages until libgit2 is downloaded.
54
53
ifeq ($(shell uname -s) ,Darwin)
55
- export CGO_LDFLAGS =$(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH ) pkg-config --libs --static --cflags libssh2 openssl libgit2 2>/dev/null)
56
54
GO_STATIC_FLAGS =-ldflags "-s -w" -tags 'netgo,osusergo,static_build'
57
- else
58
- export PKG_CONFIG_PATH: =$(PKG_CONFIG_PATH ) :$(LIBGIT2_LIB64_PATH ) /pkgconfig
59
- export LIBRARY_PATH: =$(LIBRARY_PATH ) :$(LIBGIT2_LIB64_PATH )
60
- export CGO_LDFLAGS =$(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH ) pkg-config --libs --static --cflags libssh2 openssl libgit2 2>/dev/null)
61
55
endif
62
56
63
57
ifeq ($(shell uname -s) ,Linux)
64
- ifeq ($(shell uname -m) ,x86_64)
65
- # Linux x86_64 seem to be able to cope with the static libraries
66
- # by having only musl-dev installed, without the need of using musl toolchain.
67
58
GO_STATIC_FLAGS=-ldflags "-s -w" -tags 'netgo,osusergo,static_build'
68
- else
69
- MUSL-PREFIX=$(BUILD_DIR)/musl/$(shell uname -m)-linux-musl-native/bin/$(shell uname -m)-linux-musl
70
- MUSL-CC=$(MUSL-PREFIX)-gcc
71
- export CC=$(MUSL-PREFIX)-gcc
72
- export CXX=$(MUSL-PREFIX)-g++
73
- export AR=$(MUSL-PREFIX)-ar
74
- GO_STATIC_FLAGS=-ldflags "-s -w -extldflags \"-static\"" -tags 'netgo,osusergo,static_build'
75
- endif
76
59
endif
77
60
78
61
# API (doc) generation utilities
@@ -213,16 +196,11 @@ controller-gen: ## Download controller-gen locally if necessary.
213
196
libgit2 : $(LIBGIT2 ) # # Detect or download libgit2 library
214
197
215
198
COSIGN = $(GOBIN ) /cosign
216
- $(LIBGIT2 ) : $( MUSL-CC )
199
+ $(LIBGIT2 ) :
217
200
$(call go-install-tool,$(COSIGN ) ,github.com/sigstore/cosign/cmd/cosign@latest)
218
201
219
202
IMG=$(LIBGIT2_IMG) TAG=$(LIBGIT2_TAG) PATH=$(PATH):$(GOBIN) ./hack/install-libraries.sh
220
203
221
- $(MUSL-CC ) :
222
- ifneq ($(shell uname -s) ,Darwin)
223
- ./hack/download-musl.sh
224
- endif
225
-
226
204
# Find or download gen-crd-api-reference-docs
227
205
GEN_CRD_API_REFERENCE_DOCS = $(GOBIN ) /gen-crd-api-reference-docs
228
206
.PHONY : gen-crd-api-reference-docs
0 commit comments