[packages/jsoncpp] - added cmake-prefer-shared patch: let namespaced target (JsonCpp::JsonCpp) point to shared instead
qboosh
qboosh at pld-linux.org
Wed May 10 17:52:02 CEST 2023
commit db70cfad93fea924ebb4939c3ecc37ba7de33fb1
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date: Wed May 10 17:54:22 2023 +0200
- added cmake-prefer-shared patch: let namespaced target (JsonCpp::JsonCpp) point to shared instead of static library
- fixed description
- release 3
jsoncpp-cmake-prefer-shared.patch | 16 ++++++++++++++++
jsoncpp.spec | 15 +++++++++++----
2 files changed, 27 insertions(+), 4 deletions(-)
---
diff --git a/jsoncpp.spec b/jsoncpp.spec
index fe7fe10..270020e 100644
--- a/jsoncpp.spec
+++ b/jsoncpp.spec
@@ -1,18 +1,20 @@
#
# Conditional build:
-%bcond_without apidocs # doxygen apidocs build
-%bcond_without tests # tests during build
+%bcond_without apidocs # doxygen apidocs build
+%bcond_without static_libs # static library
+%bcond_without tests # tests during build
Summary: API for manipulating JSON
Summary(pl.UTF-8): API do operacji na strukturach JSON
Name: jsoncpp
Version: 1.9.5
-Release: 2
+Release: 3
License: MIT or Public Domain
Group: Libraries
#Source0Download: https://github.com/open-source-parsers/jsoncpp/releases
Source0: https://github.com/open-source-parsers/jsoncpp/archive/%{version}/%{name}-%{version}.tar.gz
# Source0-md5: d6c8c609f2162eff373db62b90a051c7
+Patch0: %{name}-cmake-prefer-shared.patch
URL: https://github.com/open-source-parsers/jsoncpp/
BuildRequires: cmake >= 3.8.0
BuildRequires: libstdc++-devel >= 6:4.8.1
@@ -29,7 +31,7 @@ BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
JSONCPP provides a simple API to manipulate JSON values, and handle
serialization and unserialization to strings.
-%description
+%description -l pl.UTF-8
JSONCPP udostępnia proste API do operacji na wartościach JSON oraz
obsługi serializacji oraz deserializacji z łańcuchów znaków.
@@ -71,11 +73,14 @@ Dokumentacja API biblioteki JSONCPP.
%prep
%setup -q
+%patch0 -p1
%build
install -d build
cd build
%cmake .. \
+ -DBUILD_OBJECT_LIBS=OFF \
+ %{!?with_static_libs:-DBUILD_STATIC_LIBS=OFF} \
-DCMAKE_INSTALL_INCLUDEDIR:PATH=%{_includedir}/%{name} \
-DJSONCPP_WITH_CMAKE_PACKAGE=ON \
%{!?with_tests:-DJSONCPP_WITH_TESTS=OFF} \
@@ -115,9 +120,11 @@ rm -rf $RPM_BUILD_ROOT
%{_pkgconfigdir}/jsoncpp.pc
%{_libdir}/cmake/jsoncpp
+%if %{with static_libs}
%files static
%defattr(644,root,root,755)
%{_libdir}/libjsoncpp.a
+%endif
%if %{with apidocs}
%files apidocs
diff --git a/jsoncpp-cmake-prefer-shared.patch b/jsoncpp-cmake-prefer-shared.patch
new file mode 100644
index 0000000..bc9fce5
--- /dev/null
+++ b/jsoncpp-cmake-prefer-shared.patch
@@ -0,0 +1,16 @@
+--- jsoncpp-1.9.5/jsoncpp-namespaced-targets.cmake.orig 2021-11-03 18:53:28.000000000 +0100
++++ jsoncpp-1.9.5/jsoncpp-namespaced-targets.cmake 2023-05-10 16:21:39.573256446 +0200
+@@ -1,7 +1,7 @@
+-if (TARGET jsoncpp_static)
+- add_library(JsonCpp::JsonCpp INTERFACE IMPORTED)
+- set_target_properties(JsonCpp::JsonCpp PROPERTIES INTERFACE_LINK_LIBRARIES "jsoncpp_static")
+-elseif (TARGET jsoncpp_lib)
++if (TARGET jsoncpp_lib)
+ add_library(JsonCpp::JsonCpp INTERFACE IMPORTED)
+ set_target_properties(JsonCpp::JsonCpp PROPERTIES INTERFACE_LINK_LIBRARIES "jsoncpp_lib")
+-endif ()
+\ No newline at end of file
++elseif (TARGET jsoncpp_static)
++ add_library(JsonCpp::JsonCpp INTERFACE IMPORTED)
++ set_target_properties(JsonCpp::JsonCpp PROPERTIES INTERFACE_LINK_LIBRARIES "jsoncpp_static")
++endif ()
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/jsoncpp.git/commitdiff/db70cfad93fea924ebb4939c3ecc37ba7de33fb1
More information about the pld-cvs-commit
mailing list