From b91549dbf5188a18282fededc2d605db10299c4d Mon Sep 17 00:00:00 2001 From: Jakub Bogusz Date: Fri, 13 Jan 2023 21:03:24 +0100 Subject: [PATCH] - 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(+) create mode 100644 criterion-shared-nanopb.patch 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', '') + 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', 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 -- 2.44.0