~dricottone/huttese-apk

ref: 1222dfd38584e30ae92b0f0903d19f74e3defcb4 huttese-apk/sr.ht/libgit2/build-both-static-dynamic.patch -rw-r--r-- 1.8 KiB
1222dfd3 — Drew DeVault Add py3-yaml to man.sr.ht dependencies 5 years ago
                                                                                
907d9d4e Drew DeVault
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
From: Jakub Jirutka <jakub@jirutka.cz>
Date: Mon, 11 Apr 2017 3:23:00 +0200
Subject: [PATCH] Build both static and dynamic library

This is very hack-ish, it makes option BUILD_SHARED_LIBS unusable.
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -39,7 +39,6 @@
 # Build options
 #
 OPTION( SONAME				"Set the (SO)VERSION of the target"		ON  )
-OPTION( BUILD_SHARED_LIBS	"Build Shared Library (OFF for Static)"	ON  )
 OPTION( THREADSAFE			"Build libgit2 as threadsafe"			ON )
 OPTION( BUILD_CLAR			"Build Tests using the Clar suite"		ON  )
 OPTION( BUILD_EXAMPLES		"Build library usage example apps"		OFF )
@@ -58,6 +57,8 @@
 OPTION( DEBUG_POOL			"Enable debug pool allocator"			OFF )
 OPTION( ENABLE_WERROR			"Enable compilation with -Werror"		OFF )
 OPTION( USE_BUNDLED_ZLIB    "Use the bundled version of zlib"       OFF )
+
+SET( BUILD_SHARED_LIBS ON )
 
 IF (UNIX AND NOT APPLE)
 	OPTION( ENABLE_REPRODUCIBLE_BUILDS	"Enable reproducible builds" 			OFF )
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -407,9 +407,12 @@
 ENDIF()
 
 # Compile and link libgit2
-ADD_LIBRARY(git2 ${WIN_RC} ${LIBGIT2_OBJECTS})
+ADD_LIBRARY(git2 SHARED ${WIN_RC} ${LIBGIT2_OBJECTS})
 TARGET_LINK_LIBRARIES(git2 ${LIBGIT2_LIBS})
 
+ADD_LIBRARY(git2_static STATIC ${WIN_RC} ${LIBGIT2_OBJECTS})
+SET_TARGET_PROPERTIES(git2_static PROPERTIES OUTPUT_NAME git2 CLEAN_DIRECT_OUTPUT 1)
+
 SET_TARGET_PROPERTIES(git2 PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${libgit2_BINARY_DIR})
 SET_TARGET_PROPERTIES(git2 PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${libgit2_BINARY_DIR})
 SET_TARGET_PROPERTIES(git2 PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${libgit2_BINARY_DIR})
@@ -445,7 +448,7 @@
 ENDIF ()
 
 # Install
-INSTALL(TARGETS git2
+INSTALL(TARGETS git2 git2_static
 	RUNTIME DESTINATION ${BIN_INSTALL_DIR}
 	LIBRARY DESTINATION ${LIB_INSTALL_DIR}
 	ARCHIVE DESTINATION ${LIB_INSTALL_DIR}