[packages/criterion] - added shared-nanopb patch and system_nanopb bcond (off currently, tests fail with system nanopb 0.

qboosh qboosh at pld-linux.org
Fri Jan 13 21:02:27 CET 2023


commit b91549dbf5188a18282fededc2d605db10299c4d
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Fri Jan 13 21:03:24 2023 +0100

    - added shared-nanopb patch and system_nanopb bcond (off currently, tests fail with system nanopb 0.4.7)

 criterion-shared-nanopb.patch | 11 +++++++++++
 criterion.spec                | 31 +++++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+)
---
diff --git a/criterion.spec b/criterion.spec
index 7d1e6c5..e551d50 100644
--- a/criterion.spec
+++ b/criterion.spec
@@ -1,9 +1,11 @@
 # TODO:
 # - system boxfort (when released): https://github.com/diacritic/BoxFort
+# - system nanopb (0.4.5 bundled)
 # - system libcsptr (when some post-2017 release made): https://github.com/Snaipe/libcsptr
 #
 # Conditional build:
 %bcond_without	tests		# build without tests
+%bcond_with	system_nanopb	# system nanopb (tests fail with nanopb 0.4.7)
 #
 Summary:	A cross-platform C and C++ unit testing framework for the 21th century
 Summary(pl.UTF-8):	Wieloplatformowy szkielet do testów jednostkowych dla C i C++ w XXI wieku
@@ -16,14 +18,17 @@ Group:		Libraries
 Source0:	https://github.com/Snaipe/Criterion/releases/download/v%{version}/%{name}-%{version}.tar.xz
 # Source0-md5:	93e91812837a68524d76339409ed2008
 Patch0:		x32.patch
+Patch1:		%{name}-shared-nanopb.patch
 URL:		https://github.com/Snaipe/Criterion
 BuildRequires:	dyncall >= 1.0
 BuildRequires:	libffi-devel
 BuildRequires:	libgit2-devel
 BuildRequires:	meson >= 0.51.0
 BuildRequires:	nanomsg-devel >= 1.0.0
+%{?with_system_nanopb:BuildRequires:	nanopb-devel >= 0.4.5}
 BuildRequires:	ninja
 BuildRequires:	rpmbuild(macros) >= 1.736
+BuildRequires:	sed >= 4.0
 BuildRequires:	tar >= 1:1.22
 BuildRequires:	xz
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
@@ -48,15 +53,34 @@ Header files for criterion library.
 %description devel -l pl.UTF-8
 Pliki nagłówkowe biblioteki criterion.
 
+%package static
+Summary:	Static criterion libraries
+Summary(pl.UTF-8):	Statyczne biblioteki criterion
+Group:		Development/Libraries
+Requires:	%{name} = %{version}-%{release}
+
+%description static
+Static criterion libraries.
+
+%description static -l pl.UTF-8
+Statyczne biblioteki criterion.
+
 %prep
 %setup -q
 %patch0 -p1
+%patch1 -p1
+
+%if %{without system_nanopb}
+%{__sed} -i -e '/dependency.*nanopb/ s/nanopb::protobuf-nanopb/notfound::protobuf-nanopb/' meson.build
+%endif
 
 %build
 %meson build \
+	--default-library=shared \
 	-Dtests=%{__true_false tests}
 
 %ninja_build -C build
+
 %{?with_tests:%ninja_test -C build}
 
 %install
@@ -83,3 +107,10 @@ rm -rf $RPM_BUILD_ROOT
 %attr(755,root,root) %{_libdir}/libcriterion.so
 %{_includedir}/criterion
 %{_pkgconfigdir}/criterion.pc
+
+%files static
+%defattr(644,root,root,755)
+%{_libdir}/libcriterion.a
+%if %{without system_nanopb}
+%{_libdir}/libprotobuf_nanopb_static.a
+%endif
diff --git a/criterion-shared-nanopb.patch b/criterion-shared-nanopb.patch
new file mode 100644
index 0000000..f4b7708
--- /dev/null
+++ b/criterion-shared-nanopb.patch
@@ -0,0 +1,11 @@
+--- criterion-2.4.1/meson.build.orig	2022-04-26 08:55:00.518896600 +0200
++++ criterion-2.4.1/meson.build	2022-11-21 20:40:59.950706878 +0100
+@@ -174,7 +174,7 @@ else
+ 	config.set('NN_REQREP_H', '<nanomsg/reqrep.h>')
+ endif
+ 
+-nanopb = dependency('nanopb', required: false, method: 'cmake', modules: ['nanopb::protobuf-nanopb-static'])
++nanopb = dependency('nanopb', required: false, method: 'cmake', modules: ['nanopb::protobuf-nanopb'])
+ must_regenerate_pb = nanopb.found()
+ if not nanopb.found()
+ 	nanopb_proj = cmake.subproject('nanopb',
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/criterion.git/commitdiff/79185653c3b76324606da1bc93c182adcae1daaf



More information about the pld-cvs-commit mailing list