summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnssi Jaatinen <hofnarr@hofnarr.fi>2020-05-08 20:48:22 +0300
committerJoonas Niilola <juippis@gentoo.org>2020-05-12 16:57:12 +0300
commit34cc9b34ece4e078343c264acaf4b9962a57969b (patch)
tree037cfc0cfb55ed3f94767a5cd2dbcc181c0437c8 /dev-libs/json-c
parentdev-libs/json-c: add new maintainers (diff)
downloadgentoo-34cc9b34ece4e078343c264acaf4b9962a57969b.tar.gz
gentoo-34cc9b34ece4e078343c264acaf4b9962a57969b.tar.bz2
gentoo-34cc9b34ece4e078343c264acaf4b9962a57969b.zip
dev-libs/json-c: add patch for static-libs support
Enable building both static and shared libraries. Closes: https://bugs.gentoo.org/720742 Signed-off-by: Anssi Jaatinen <hofnarr@hofnarr.fi> Signed-off-by: Jakov Smolic <jakov.smolic@sartura.hr> Signed-off-by: Luka Perkov <luka.perkov@sartura.hr> Signed-off-by: Joonas Niilola <juippis@gentoo.org>
Diffstat (limited to 'dev-libs/json-c')
-rw-r--r--dev-libs/json-c/files/json-c-0.14_cmake-static-libs.patch56
-rw-r--r--dev-libs/json-c/json-c-0.14-r1.ebuild (renamed from dev-libs/json-c/json-c-0.14.ebuild)5
2 files changed, 61 insertions, 0 deletions
diff --git a/dev-libs/json-c/files/json-c-0.14_cmake-static-libs.patch b/dev-libs/json-c/files/json-c-0.14_cmake-static-libs.patch
new file mode 100644
index 000000000000..3913fc320bca
--- /dev/null
+++ b/dev-libs/json-c/files/json-c-0.14_cmake-static-libs.patch
@@ -0,0 +1,56 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index ba692ff..fc2edff 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -65,6 +65,7 @@ include(GNUInstallDirs)
+ include(CMakePackageConfigHelpers)
+
+ option(BUILD_SHARED_LIBS "Default to building shared libraries" ON)
++option(BUILD_STATIC_LIBS "Default to building static libraries" OFF)
+
+ # Generate a release merge and test it to verify the correctness of republishing the package.
+ ADD_CUSTOM_TARGET(distcheck
+@@ -383,7 +384,7 @@ add_library(${PROJECT_NAME}
+ set_target_properties(${PROJECT_NAME} PROPERTIES
+ VERSION 5.0.0
+ SOVERSION 5)
+-
++list(APPEND CMAKE_TARGETS ${PROJECT_NAME})
+ # If json-c is used as subroject it set to target correct interface -I flags and allow
+ # to build external target without extra include_directories(...)
+ target_include_directories(${PROJECT_NAME}
+@@ -392,7 +393,33 @@ target_include_directories(${PROJECT_NAME}
+ $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}>
+ )
+
+-install(TARGETS ${PROJECT_NAME}
++# Allow to build static and shared libraries at the same time
++if (BUILD_STATIC_LIBS)
++ set(STATIC_LIB ${PROJECT_NAME}-static)
++ add_library(${STATIC_LIB} STATIC
++ ${JSON_C_SOURCES}
++ ${JSON_C_HEADERS}
++ )
++
++ # rename the static library
++ set_target_properties(${STATIC_LIB} PROPERTIES
++ OUTPUT_NAME ${PROJECT_NAME}
++ )
++ list(APPEND CMAKE_TARGETS ${STATIC_LIB})
++endif ()
++
++# Always create new install dirs with 0755 permissions, regardless of umask
++set(CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS
++ OWNER_READ
++ OWNER_WRITE
++ OWNER_EXECUTE
++ GROUP_READ
++ GROUP_EXECUTE
++ WORLD_READ
++ WORLD_EXECUTE
++ )
++
++install(TARGETS ${CMAKE_TARGETS}
+ EXPORT ${PROJECT_NAME}-targets
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
diff --git a/dev-libs/json-c/json-c-0.14.ebuild b/dev-libs/json-c/json-c-0.14-r1.ebuild
index 5ce2710a3816..90731d8f93d0 100644
--- a/dev-libs/json-c/json-c-0.14.ebuild
+++ b/dev-libs/json-c/json-c-0.14-r1.ebuild
@@ -15,6 +15,10 @@ SLOT="0/5"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos"
IUSE="doc static-libs threads"
+PATCHES=(
+ "${FILESDIR}/${P}_cmake-static-libs.patch"
+)
+
MULTILIB_WRAPPED_HEADERS=(
/usr/include/json-c/config.h
)
@@ -26,6 +30,7 @@ src_prepare() {
multilib_src_configure() {
local mycmakeargs=(
-DBUILD_DOCUMENTATION=$(multilib_native_usex doc)
+ -DBUILD_STATIC_LIBS=$(usex static-libs)
-DDISABLE_WERROR=ON
-DENABLE_THREADING=$(usex threads)
)