Skip to content
This repository was archived by the owner on Dec 16, 2022. It is now read-only.

Commit 8ff53fc

Browse files
committed
libgit2: determine download URL for revision
This ensures `LIBGIT2_REVISION` can be unpinned, and a library based on just the `LIBGIT2_VERSION` can be downloaded and compiled. Overwriting the URL is possible as well using `LIBGI2_DOWNLOAD_URL`. Signed-off-by: Hidde Beydals <hello@hidde.co>
1 parent 2c9b4b3 commit 8ff53fc

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

hack/Makefile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
11
BUILD_TYPE ?= "RelWithDebInfo"
22
FLAGS ?=
3+
34
INSTALL_PREFIX ?= /usr
45
INSTALL_LIBDIR ?= $(INSTALL_PREFIX)/lib
6+
57
LIBGIT2_VERSION ?= 1.2.0
8+
# Overwritten to a specific version by default for git2go support
9+
# Ref: https://github.com/libgit2/git2go/issues/834
610
LIBGIT2_REVISION ?= 109b4c887ffb63962c7017a66fc4a1f48becb48e
711

12+
ifeq ($(LIBGIT2_REVISION),)
13+
LIBGIT2_DOWNLOAD_URL ?= https://github.com/libgit2/libgit2/archive/refs/tags/v$(LIBGIT2_VERSION).tar.gz
14+
else
15+
LIBGIT2_DOWNLOAD_URL ?= https://github.com/libgit2/libgit2/archive/$(LIBGIT2_REVISION).tar.gz
16+
endif
17+
818
$(INSTALL_LIBDIR)/libgit2.so.$(LIBGIT2_VERSION):
919
set -e; \
1020
SETUP_LIBGIT2_TMP_DIR=$$(mktemp -d) \
11-
&& curl -L https://github.com/libgit2/libgit2/archive/$(LIBGIT2_REVISION).tar.gz -o $$SETUP_LIBGIT2_TMP_DIR/archive.tar.gz \
21+
&& curl -L $(LIBGIT2_DOWNLOAD_URL) -o $$SETUP_LIBGIT2_TMP_DIR/archive.tar.gz \
1222
&& mkdir -p $$SETUP_LIBGIT2_TMP_DIR/src \
1323
&& tar xzf $$SETUP_LIBGIT2_TMP_DIR/archive.tar.gz --strip 1 -C $$SETUP_LIBGIT2_TMP_DIR/src \
1424
&& cmake -S $$SETUP_LIBGIT2_TMP_DIR/src -B $$SETUP_LIBGIT2_TMP_DIR/build \

0 commit comments

Comments
 (0)