@@ -15,14 +15,16 @@ INSTALL_LIBDIR ?= $(INSTALL_PREFIX)/lib/$(shell xx-info triple)
15
15
endif
16
16
BUILD_TYPE ?= "RelWithDebInfo"
17
17
FLAGS ?=
18
- USE_HTTPS ?= OpenSSL
19
- USE_SSH ?= ON
18
+ USE_HTTPS ?= OFF
19
+ USE_SSH ?= OFF
20
+ USE_BUNDLED_ZLIB ?= OFF
21
+ BUILD_SHARED_LIBS ?= ON
20
22
21
23
# Cmake version to be installed.
22
24
CMAKE_VERSION ?= 3.21.3
23
25
24
26
# Libgit2 version to be compiled and installed.
25
- LIBGIT2_VERSION ?= 1.1.1
27
+ LIBGIT2_VERSION ?= 1.3.0
26
28
# In some scenarios libgit2 needs to be checked out to a specific commit.
27
29
# This takes presidence over LIBGIT_VERSION if defined.
28
30
# Ref: https://github.com/libgit2/git2go/issues/834
@@ -65,19 +67,32 @@ ifeq (debian,$(XX_VENDOR))
65
67
# certain key formats).
66
68
# Ref: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=668271
67
69
# Ref: https://github.com/ARMmbed/mbedtls/issues/2452#issuecomment-802683144
70
+ DEPENDENCIES =
71
+ ifneq ("OFF",$(USE_BUNDLED_ZLIB ) )
72
+ DEPENDENCIES += zlib1g-dev
73
+ endif
74
+ ifneq ("OFF",$(USE_HTTPS ) )
75
+ DEPENDENCIES += libssl-dev
76
+ endif
77
+ ifneq ("OFF",$(USE_SSH ) )
78
+ DEPENDENCIES += libssh2-1-dev
79
+ endif
68
80
dependencies :
81
+ ifneq ("",$(DEPENDENCIES ) )
69
82
set -e; \
70
83
echo "deb http://deb.debian.org/debian sid main" > /etc/apt/sources.list.d/sid.list \
71
84
&& echo "deb-src http://deb.debian.org/debian sid main" /etc/apt/sources.list.d/sid.list \
72
85
&& xx-apt update \
73
- && xx-apt -t sid install --no-install-recommends -y zlib1g-dev libssl-dev libssh2-1-dev
86
+ && xx-apt -t sid install --no-install-recommends -y $(DEPENDENCIES)
87
+ endif
74
88
endif
75
89
.PHONY : dependencies
76
90
77
91
libgit2 : $(LIBGIT2 )
78
92
.PHONY : libgit2
79
93
80
94
ifdef HAS_BREW
95
+ ifneq ("OFF",$(USE_HTTPS ) )
81
96
HAS_OPENSSL :=
$(shell brew --prefix [email protected] )
82
97
# NB: the OPENSSL_LDFLAGS ensures the path is included in the libgit2.pc
83
98
# file. As a standard brew installation doesn't appear to be system wide
@@ -87,11 +102,14 @@ ifdef HAS_OPENSSL
87
102
PKG_CONFIG_PATH := $(PKG_CONFIG_PATH):$(HAS_OPENSSL)/lib/pkgconfig
88
103
FLAGS += -DOPENSSL_LDFLAGS:STRING='-L $(HAS_OPENSSL)/lib'
89
104
endif
105
+ endif
106
+ ifneq ("OFF",$(USE_SSH ) )
90
107
HAS_LIBSSH2 := $(shell brew --prefix libssh2)
91
108
ifdef HAS_LIBSSH2
92
109
PKG_CONFIG_PATH := $(PKG_CONFIG_PATH):$(HAS_LIBSSH2)/lib/pkgconfig
93
110
endif
94
111
endif
112
+ endif
95
113
96
114
$(LIBGIT2 ) :
97
115
set -e; \
@@ -108,7 +126,7 @@ $(LIBGIT2):
108
126
-DCMAKE_INSTALL_LIBDIR:PATH=$(INSTALL_LIBDIR ) \
109
127
-DBUILD_CLAR:BOOL:BOOL=OFF \
110
128
-DTHREADSAFE:BOOL=ON \
111
- -DBUILD_SHARED_LIBS=ON \
129
+ -DBUILD_SHARED_LIBS:BOOL= $( BUILD_SHARED_LIBS ) \
112
130
-DUSE_BUNDLED_ZLIB:BOOL=OFF \
113
131
-DUSE_HTTP_PARSER:STRING=builtin \
114
132
-DREGEX_BACKEND:STRING=builtin \
0 commit comments