1 |
commit: 34cc9b34ece4e078343c264acaf4b9962a57969b |
2 |
Author: Anssi Jaatinen <hofnarr <AT> hofnarr <DOT> fi> |
3 |
AuthorDate: Fri May 8 17:48:22 2020 +0000 |
4 |
Commit: Joonas Niilola <juippis <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue May 12 13:57:12 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=34cc9b34 |
7 |
|
8 |
dev-libs/json-c: add patch for static-libs support |
9 |
|
10 |
Enable building both static and shared libraries. |
11 |
Closes: https://bugs.gentoo.org/720742 |
12 |
|
13 |
Signed-off-by: Anssi Jaatinen <hofnarr <AT> hofnarr.fi> |
14 |
Signed-off-by: Jakov Smolic <jakov.smolic <AT> sartura.hr> |
15 |
Signed-off-by: Luka Perkov <luka.perkov <AT> sartura.hr> |
16 |
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org> |
17 |
|
18 |
.../files/json-c-0.14_cmake-static-libs.patch | 56 ++++++++++++++++++++++ |
19 |
.../{json-c-0.14.ebuild => json-c-0.14-r1.ebuild} | 5 ++ |
20 |
2 files changed, 61 insertions(+) |
21 |
|
22 |
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 |
23 |
new file mode 100644 |
24 |
index 00000000000..3913fc320bc |
25 |
--- /dev/null |
26 |
+++ b/dev-libs/json-c/files/json-c-0.14_cmake-static-libs.patch |
27 |
@@ -0,0 +1,56 @@ |
28 |
+diff --git a/CMakeLists.txt b/CMakeLists.txt |
29 |
+index ba692ff..fc2edff 100644 |
30 |
+--- a/CMakeLists.txt |
31 |
++++ b/CMakeLists.txt |
32 |
+@@ -65,6 +65,7 @@ include(GNUInstallDirs) |
33 |
+ include(CMakePackageConfigHelpers) |
34 |
+ |
35 |
+ option(BUILD_SHARED_LIBS "Default to building shared libraries" ON) |
36 |
++option(BUILD_STATIC_LIBS "Default to building static libraries" OFF) |
37 |
+ |
38 |
+ # Generate a release merge and test it to verify the correctness of republishing the package. |
39 |
+ ADD_CUSTOM_TARGET(distcheck |
40 |
+@@ -383,7 +384,7 @@ add_library(${PROJECT_NAME} |
41 |
+ set_target_properties(${PROJECT_NAME} PROPERTIES |
42 |
+ VERSION 5.0.0 |
43 |
+ SOVERSION 5) |
44 |
+- |
45 |
++list(APPEND CMAKE_TARGETS ${PROJECT_NAME}) |
46 |
+ # If json-c is used as subroject it set to target correct interface -I flags and allow |
47 |
+ # to build external target without extra include_directories(...) |
48 |
+ target_include_directories(${PROJECT_NAME} |
49 |
+@@ -392,7 +393,33 @@ target_include_directories(${PROJECT_NAME} |
50 |
+ $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}> |
51 |
+ ) |
52 |
+ |
53 |
+-install(TARGETS ${PROJECT_NAME} |
54 |
++# Allow to build static and shared libraries at the same time |
55 |
++if (BUILD_STATIC_LIBS) |
56 |
++ set(STATIC_LIB ${PROJECT_NAME}-static) |
57 |
++ add_library(${STATIC_LIB} STATIC |
58 |
++ ${JSON_C_SOURCES} |
59 |
++ ${JSON_C_HEADERS} |
60 |
++ ) |
61 |
++ |
62 |
++ # rename the static library |
63 |
++ set_target_properties(${STATIC_LIB} PROPERTIES |
64 |
++ OUTPUT_NAME ${PROJECT_NAME} |
65 |
++ ) |
66 |
++ list(APPEND CMAKE_TARGETS ${STATIC_LIB}) |
67 |
++endif () |
68 |
++ |
69 |
++# Always create new install dirs with 0755 permissions, regardless of umask |
70 |
++set(CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS |
71 |
++ OWNER_READ |
72 |
++ OWNER_WRITE |
73 |
++ OWNER_EXECUTE |
74 |
++ GROUP_READ |
75 |
++ GROUP_EXECUTE |
76 |
++ WORLD_READ |
77 |
++ WORLD_EXECUTE |
78 |
++ ) |
79 |
++ |
80 |
++install(TARGETS ${CMAKE_TARGETS} |
81 |
+ EXPORT ${PROJECT_NAME}-targets |
82 |
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} |
83 |
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} |
84 |
|
85 |
diff --git a/dev-libs/json-c/json-c-0.14.ebuild b/dev-libs/json-c/json-c-0.14-r1.ebuild |
86 |
similarity index 90% |
87 |
rename from dev-libs/json-c/json-c-0.14.ebuild |
88 |
rename to dev-libs/json-c/json-c-0.14-r1.ebuild |
89 |
index 5ce2710a381..90731d8f93d 100644 |
90 |
--- a/dev-libs/json-c/json-c-0.14.ebuild |
91 |
+++ b/dev-libs/json-c/json-c-0.14-r1.ebuild |
92 |
@@ -15,6 +15,10 @@ SLOT="0/5" |
93 |
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos" |
94 |
IUSE="doc static-libs threads" |
95 |
|
96 |
+PATCHES=( |
97 |
+ "${FILESDIR}/${P}_cmake-static-libs.patch" |
98 |
+) |
99 |
+ |
100 |
MULTILIB_WRAPPED_HEADERS=( |
101 |
/usr/include/json-c/config.h |
102 |
) |
103 |
@@ -26,6 +30,7 @@ src_prepare() { |
104 |
multilib_src_configure() { |
105 |
local mycmakeargs=( |
106 |
-DBUILD_DOCUMENTATION=$(multilib_native_usex doc) |
107 |
+ -DBUILD_STATIC_LIBS=$(usex static-libs) |
108 |
-DDISABLE_WERROR=ON |
109 |
-DENABLE_THREADING=$(usex threads) |
110 |
) |