+#
+# Conditional build:
+%bcond_without tests # perform test build
+#
Summary: C++11 threading classes implementation for MinGW
Summary(pl.UTF-8): Implementacja klas C++11 związanych z wątkami dla MinGW
Name: crossmingw32-std-threads
Version: 0
-%define gitref b7e670d91d33b7ce5836c6255d37e69f17eb3687
-%define snap 20160317
+%define gitref ee67ef384470e998c8e0b7301f7a79b5019251a2
+%define snap 20180912
Release: 0.%{snap}.1
License: BSD
Group: Development/Libraries
Source0: https://github.com/meganz/mingw-std-threads/archive/%{gitref}/mingw-std-threads-%{snap}.tar.gz
-# Source0-md5: e5f0fcdb69d99ab493f45e65767f9346
+# Source0-md5: c55d7a463149d803535b71c6bb1346cb
Patch0: mingw-std-threads-include.patch
+Patch1: mingw-std-threads-errors.patch
URL: https://github.com/meganz/mingw-std-threads
+%if %{with tests}
+BuildRequires: crossmingw32-gcc-c++ >= 1:4.7
+%endif
Requires: crossmingw32-gcc-c++ >= 1:4.7
Requires: crossmingw32-runtime
Requires: crossmingw32-w32api
%define target i386-mingw32
%define target_platform i386-pc-mingw32
+%define __cc %{target}-gcc
+%define __cxx %{target}-g++
+
%define _sysprefix /usr
%define _prefix %{_sysprefix}/%{target}
+%ifnarch %{ix86}
+# arch-specific flags (like alpha's -mieee) are not valid for i386 gcc.
+# now at least i486 is required for atomic operations
+%define optflags -O2
+%endif
+# -z options are invalid for mingw linker, most of -f options are Linux-specific
+%define filterout_ld -Wl,-z,.*
+%define filterout_c -f[-a-z0-9=]*
+%define filterout_cxx -f[-a-z0-9=]*
+
%description
Standard C++11 threading classes (std::condition_variable, std::mutex,
std::thread) implementation, which are currently still missing on
%prep
%setup -q -n mingw-std-threads-%{gitref}
%patch0 -p1
+%patch1 -p1
+
+%build
+%if %{with tests}
+install -d tests/build
+cd tests/build
+CC="%{__cc}" \
+CXX="%{__cxx}" \
+cmake .. \
+ -DCMAKE_BUILD_TYPE=PLD \
+ -DCMAKE_CXX_FLAGS_PLD="%{rpmcxxflags} -DWINVER=0x0501" \
+ -DCMAKE_SYSTEM_NAME=Windows \
+ -DCMAKE_SYSTEM_PROCESSOR=i386 \
+ -DCMAKE_VERBOSE_MAKEFILE=ON
+
+%{__make}
+%endif
%install
rm -rf $RPM_BUILD_ROOT