View | Details | Raw Unified | Return to bug 251147 | Differences between
and this patch

Collapse All | Expand All

(-)devel/Makefile (+1 lines)
Lines 1134-1139 Link Here
1134
    SUBDIR += libdwarf
1134
    SUBDIR += libdwarf
1135
    SUBDIR += libe
1135
    SUBDIR += libe
1136
    SUBDIR += libedit
1136
    SUBDIR += libedit
1137
    SUBDIR += libegit2
1137
    SUBDIR += libeio
1138
    SUBDIR += libeio
1138
    SUBDIR += libelf
1139
    SUBDIR += libelf
1139
    SUBDIR += libepoll-shim
1140
    SUBDIR += libepoll-shim
(-)devel/libegit2/Makefile (+44 lines)
Line 0 Link Here
1
# $FreeBSD$
2
3
PORTNAME=	libegit2
4
DISTVERSION=	0.0.1.20200316
5
CATEGORIES=	devel elisp
6
PKGNAMESUFFIX=	${EMACS_PKGNAMESUFFIX}
7
8
MAINTAINER=	yasu@utahime.org
9
COMMENT=	Emacs bindings for libgit2
10
11
LICENSE=	GPLv3+
12
LICENSE_FILE=	${WRKSRC}/LICENSE
13
14
LIB_DEPENDS=	libgit2.so:devel/libgit2
15
16
USES=		cmake emacs pkgconfig
17
USE_LDCONFIG=	yes
18
19
USE_GITHUB=	yes
20
GH_ACCOUNT=	magit
21
GH_TAGNAME=	0ef8b13
22
23
CMAKE_ON=	USE_SYSTEM_LIBGIT2
24
25
OPTIONS_DEFINE=	DOCS
26
27
PORTDOCS=	README.md
28
29
post-build:
30
	(cd ${WRKSRC} \
31
	&& ${EMACS_CMD} -Q -batch -L . -f batch-byte-compile libgit.el)
32
33
do-install:
34
	@${MKDIR} ${STAGEDIR}${PREFIX}/${EMACS_VERSION_SITE_LISPDIR}
35
	${INSTALL_PROGRAM} ${WRKSRC}/../.build/libegit2.so \
36
		${STAGEDIR}${PREFIX}/lib
37
	${INSTALL_DATA} ${WRKSRC}/libgit.el* \
38
		${STAGEDIR}${PREFIX}/${EMACS_VERSION_SITE_LISPDIR}
39
40
do-install-DOCS-on:
41
	@${MKDIR} ${STAGEDIR}${DOCSDIR}
42
	${INSTALL_DATA} ${WRKSRC}/README.md ${STAGEDIR}${DOCSDIR}
43
44
.include <bsd.port.mk>
(-)devel/libegit2/distinfo (+3 lines)
Line 0 Link Here
1
TIMESTAMP = 1605386780
2
SHA256 (magit-libegit2-0.0.1.20200316-0ef8b13_GH0.tar.gz) = d746fd8120948ac1d2a3c12f25a65a2720ca8bdd7a794c9b2bc120ff95ed0ce9
3
SIZE (magit-libegit2-0.0.1.20200316-0ef8b13_GH0.tar.gz) = 131990
(-)devel/libegit2/files/patch-use-system-libgit2 (+85 lines)
Line 0 Link Here
1
From de3c48d72ec7064e7f0522877fe759c729df0c50 Mon Sep 17 00:00:00 2001
2
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
3
Date: Wed, 25 Mar 2020 11:32:18 -0400
4
Subject: [PATCH] Allow using a system provided libgit2 library
5
6
Setting the USE_SYSTEM_LIBGIT2 Make or CMake variable (through the
7
BUILD_OPTIONS variable) to any value enables using the system library.
8
The default behavior of using a bundled copy of libgit2 is unchanged.
9
---
10
 CMakeLists.txt     |  9 +++++++--
11
 Makefile           | 11 +++++++++++
12
 src/CMakeLists.txt |  9 +++++++--
13
 3 files changed, 25 insertions(+), 4 deletions(-)
14
15
diff --git CMakeLists.txt CMakeLists.txt
16
index a393d7c..75d6ca6 100644
17
--- CMakeLists.txt
18
+++ CMakeLists.txt
19
@@ -7,9 +7,14 @@ set(BUILD_SHARED_LIBS OFF CACHE BOOL "shared" FORCE)
20
 set(BUILD_CLAR OFF CACHE BOOL "clar" FORCE)
21
 set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DEGIT_DEBUG")
22
 
23
-add_subdirectory(libgit2)
24
+if(USE_SYSTEM_LIBGIT2)
25
+  find_package(PkgConfig REQUIRED)
26
+  pkg_check_modules(git2 REQUIRED IMPORTED_TARGET libgit2)
27
+else()
28
+  add_subdirectory(libgit2)
29
+  find_library(git2 libgit2.a)
30
+endif()
31
 
32
-find_library(git2 libgit2.a)
33
 add_subdirectory(src)
34
 
35
 enable_testing()
36
diff --git Makefile Makefile
37
index 8199532..6a6a4e1 100644
38
--- Makefile
39
+++ Makefile
40
@@ -13,6 +13,13 @@ ifeq ($(UNAME),MSYS)
41
 	BUILD_OPTIONS+= -G "MSYS Makefiles"
42
 endif
43
 
44
+# If the variable USE_SYSTEM_LIBGIT2 is set to *any* value, use the
45
+# system provided libgit2 library.
46
+USE_SYSTEM_LIBGIT2? := \
47
+	$(if $(or $(USE_SYSTEM_LIBGIT2),\
48
+	 	  $(findstring USE_SYSTEM_LIBGIT2,$(BUILD_OPTIONS))),\
49
+		true)
50
+
51
 ifeq "$(TRAVIS)" "true"
52
 ## Makefile for Travis ###################################################
53
 #
54
@@ -87,7 +94,11 @@ submodule-update:
55
 	@git submodule update
56
 
57
 libgit2:
58
+ifeq ($(USE_SYSTEM_LIBGIT2?),)
59
 	@git submodule update --init
60
+else
61
+	@echo "Using the system provided libgit2 library"
62
+endif
63
 
64
 CLEAN  = $(ELCS) $(PKG)-autoloads.el build
65
 
66
diff --git src/CMakeLists.txt src/CMakeLists.txt
67
index cfb5777..0dbad8a 100644
68
--- src/CMakeLists.txt
69
+++ src/CMakeLists.txt
70
@@ -13,8 +13,13 @@ if(WIN32)
71
   set_target_properties(egit2 PROPERTIES PREFIX lib)
72
 endif(WIN32)
73
 
74
-target_link_libraries(egit2 git2)
75
-target_include_directories(egit2 SYSTEM PRIVATE "${libgit2_SOURCE_DIR}/include")
76
+if(USE_SYSTEM_LIBGIT2)
77
+  target_link_libraries(egit2 PRIVATE PkgConfig::git2)
78
+else()
79
+  target_link_libraries(egit2 git2)
80
+  target_include_directories(
81
+    egit2 SYSTEM PRIVATE "${libgit2_SOURCE_DIR}/include")
82
+endif()
83
 
84
 if(CMAKE_COMPILER_IS_GNUCC)
85
   target_compile_options(egit2 PRIVATE -Wall -Wextra)
(-)devel/libegit2/pkg-descr (+4 lines)
Line 0 Link Here
1
This is an experimental module for libgit2 bindings to Emacs, intended
2
to boost the performance of Magit (https://magit.vc/).
3
4
WWW: https://github.com/magit/libegit2
(-)devel/libegit2/pkg-plist (+3 lines)
Line 0 Link Here
1
lib/libegit2.so
2
%%EMACS_VERSION_SITE_LISPDIR%%/libgit.el
3
%%EMACS_VERSION_SITE_LISPDIR%%/libgit.elc

Return to bug 251147