diff options
Diffstat (limited to 'main')
-rw-r--r-- | main/libgit2/APKBUILD | 7 | ||||
-rw-r--r-- | main/libgit2/build-both-static-dynamic.patch | 53 |
2 files changed, 57 insertions, 3 deletions
diff --git a/main/libgit2/APKBUILD b/main/libgit2/APKBUILD index 269943d067..b4a27bba33 100644 --- a/main/libgit2/APKBUILD +++ b/main/libgit2/APKBUILD @@ -18,6 +18,7 @@ replaces="$pkgname-libs" # for backward compatibility with v3.4 source="$pkgname-$pkgver.tar.gz::https://github.com/$pkgname/$pkgname/archive/v$pkgver.tar.gz libressl.patch pkgconfig-do-not-quote-Libs.patch + build-both-static-dynamic.patch " builddir="$srcdir/$pkgname-$pkgver" @@ -33,10 +34,9 @@ builddir="$srcdir/$pkgname-$pkgver" build() { cd "$builddir" cmake \ + -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=/usr \ -DCMAKE_INSTALL_LIBDIR=lib \ - -DBUILD_SHARED_LIBS=True \ - -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_CXX_FLAGS="$CXXFLAGS" \ -DCMAKE_C_FLAGS="$CFLAGS" \ || return 1 @@ -50,4 +50,5 @@ package() { sha512sums="bbd0d27c95406b548185ce02e2a9288a9dcb8c3b28476ba20f4f4917f6bd67f1ddee80de3054d30b79cdb9d973c3061a15ea7847c79bfa4e0c62e41d5195cb99 libgit2-0.25.1.tar.gz 3674957d09207b11d268ba9fcb442a081b8efe318d0e8501b7afa0ae2397efc9aff8572b1ffd9f2286c46a06a647fbe943c2cc7e8f97d1a0288e74010846d439 libressl.patch -635fb1f64c4b676044e7800cc8796646f90d7e6447ab77f97b3491f746351e826ffa9c03b6bef7ffabad9c50a5c5e983ea9e53b4972211813f54d81b703b4aed pkgconfig-do-not-quote-Libs.patch" +635fb1f64c4b676044e7800cc8796646f90d7e6447ab77f97b3491f746351e826ffa9c03b6bef7ffabad9c50a5c5e983ea9e53b4972211813f54d81b703b4aed pkgconfig-do-not-quote-Libs.patch +39534d10f38f394446f93df810233464807fca3b0e903ee40067971ecbe1d78102bbe04283435032f757f970e6846ecf279eb727ab137c01e84427bd16913ee6 build-both-static-dynamic.patch" diff --git a/main/libgit2/build-both-static-dynamic.patch b/main/libgit2/build-both-static-dynamic.patch new file mode 100644 index 0000000000..eeb179a1e0 --- /dev/null +++ b/main/libgit2/build-both-static-dynamic.patch @@ -0,0 +1,53 @@ +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 +@@ -28,7 +28,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 ) +@@ -44,6 +43,8 @@ + OPTION( CURL "Use curl for HTTP if available" ON) + OPTION( DEBUG_POOL "Enable debug pool allocator" OFF ) + ++SET( BUILD_SHARED_LIBS ON ) ++ + IF(DEBUG_POOL) + ADD_DEFINITIONS(-DGIT_DEBUG_POOL) + ENDIF() +@@ -602,7 +603,8 @@ + ENDIF() + + # Compile and link libgit2 +-ADD_LIBRARY(git2 ${SRC_H} ${SRC_GIT2} ${SRC_OS} ${SRC_ZLIB} ${SRC_HTTP} ${SRC_REGEX} ${SRC_SSH} ${SRC_SHA1} ${WIN_RC}) ++ADD_LIBRARY(objlib OBJECT ${SRC_H} ${SRC_GIT2} ${SRC_OS} ${SRC_ZLIB} ${SRC_HTTP} ${SRC_REGEX} ${SRC_SSH} ${SRC_SHA1} ${WIN_RC}) ++ADD_LIBRARY(git2 SHARED $<TARGET_OBJECTS:objlib>) + TARGET_LINK_LIBRARIES(git2 ${SECURITY_DIRS}) + TARGET_LINK_LIBRARIES(git2 ${COREFOUNDATION_DIRS}) + TARGET_LINK_LIBRARIES(git2 ${SSL_LIBRARIES}) +@@ -611,6 +613,9 @@ + TARGET_LINK_LIBRARIES(git2 ${ICONV_LIBRARIES}) + TARGET_OS_LIBRARIES(git2) + ++ADD_LIBRARY(git2_static STATIC $<TARGET_OBJECTS:objlib>) ++SET_TARGET_PROPERTIES(git2_static PROPERTIES OUTPUT_NAME git2 CLEAN_DIRECT_OUTPUT 1) ++ + # Workaround for Cmake bug #0011240 (see http://public.kitware.com/Bug/view.php?id=11240) + # Win64+MSVC+static libs = linker error + IF(MSVC AND GIT_ARCH_64 AND NOT BUILD_SHARED_LIBS) +@@ -639,7 +644,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} |