# TODO:
# - system boxfort (when released): https://github.com/diacritic/BoxFort
# - system libcsptr (when some post-2017 release made): https://github.com/Snaipe/libcsptr
+#
+# Conditional build:
+%bcond_without tests # build without tests
+#
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
Name: criterion
Version: 2.3.3
-Release: 4
+Release: 5
License: LGPL v2.1+
Group: Libraries
#Source0Download: https://github.com/Snaipe/Criterion/releases
Source0: https://github.com/Snaipe/Criterion/releases/download/v%{version}/%{name}-v%{version}.tar.bz2
# Source0-md5: 0305dbb5e00f04fd65b22e9ad82ba952
Patch0: %{name}-libdir.patch
+Patch1: x32.patch
+Patch2: no-cram.patch
URL: https://github.com/Snaipe/Criterion
BuildRequires: cmake >= 2.8.0
BuildRequires: dyncall >= 1.0
%prep
%setup -q -n %{name}-v%{version}
%patch0 -p1
+%patch1 -p1
+%patch2 -p1
%build
install -d build
cd build
-%cmake ..
+%cmake .. \
+ %{cmake_on_off tests CTESTS}
+
%{__make}
+%{?with_tests:%{__make} criterion_tests test}
+
%install
rm -rf $RPM_BUILD_ROOT
--- /dev/null
+--- criterion-v2.3.3/dependencies/boxfort/CMakeLists.txt~ 2018-11-05 02:19:59.000000000 +0100
++++ criterion-v2.3.3/dependencies/boxfort/CMakeLists.txt 2020-05-06 09:01:11.433286507 +0200
+@@ -70,9 +70,15 @@
+ else ()
+ set (BXF_ABI "systemv")
+ endif ()
++ if (CMAKE_C_COMPILER_ABI MATCHES "ELF X32")
++ set (BXF_ARCH "x86_64")
++ set (BXF_BITS 32)
++ set (BXF_ARCH_x86_64 1)
++ else ()
+ set (BXF_ARCH "x86_64")
+ set (BXF_BITS 64)
+ set (BXF_ARCH_x86_64 1)
++ endif ()
+ elseif (_ARCH MATCHES "${ARM32}")
+ set (BXF_ARCH "arm")
+ set (BXF_ABI "arm")