-%define major 4
-%define minor 3
-%define micro 20150611
-%define sourcebasename tbb%{major}%{minor}_%{micro}oss
+# use: major=year, minor=Update version, [micro=date if present]
+%define major 2021
+%define minor 5
+%define micro 0
+
+%ifarch %{armv6}
+%define with_libatomic 1
+%endif
+
Summary: The Threading Building Blocks library abstracts low-level threading details
Summary(pl.UTF-8): Threading Building Blocks - biblioteka abstrahująca niskopoziomowe szczegóły obsługi wątków
Name: tbb
-Version: %{major}.%{minor}.%{micro}
-Release: 2
-License: GPL v2 with runtime exception
+Version: 2021.12.0
+Release: 1
+License: Apache v2.0
Group: Development/Tools
-# Source0Download: https://www.threadingbuildingblocks.org/download
-Source0: https://www.threadingbuildingblocks.org/sites/default/files/software_releases/source/%{sourcebasename}_src.tgz
-# Source0-md5: bb144ec868c53244ea6be11921d86f03
+# Source0Download: https://github.com/oneapi-src/oneTBB/releases
+Source0: https://github.com/01org/tbb/archive/v%{version}/oneTBB-%{version}.tar.gz
+# Source0-md5: 558a40c7c3da965a5cfc3fbe0566b5ae
Source1: http://www.threadingbuildingblocks.org/uploads/81/91/Latest%20Open%20Source%20Documentation/Design_Patterns.pdf
# Source1-md5: 46062fef922d39abfd464bc06e02cdd8
Source2: http://www.threadingbuildingblocks.org/uploads/81/91/Latest%20Open%20Source%20Documentation/Getting_Started.pdf
# Source3-md5: 1481cbd378f4964691046d0ba570b374
Source4: http://www.threadingbuildingblocks.org/uploads/81/91/Latest%20Open%20Source%20Documentation/Tutorial.pdf
# Source4-md5: 5bbdd1050c5dac5c1b782a6a98db0c46
-Source5: %{name}.pc.in
-Source6: %{name}malloc.pc.in
-Source7: %{name}malloc_proxy.pc.in
-Patch0: no-forced-arch-bits.patch
-Patch1: %{name}-cxxflags.patch
-Patch2: mfence.patch
URL: http://www.threadingbuildingblocks.org/
-BuildRequires: libstdc++-devel
+BuildRequires: cmake >= 3.5
+BuildRequires: hwloc-devel
+%{?with_libatomic:BuildRequires: libatomic-devel}
+BuildRequires: libstdc++-devel >= 6:4.7
BuildRequires: pkgconfig
+BuildRequires: rpm-build >= 4.6
+BuildRequires: rpmbuild(macros) >= 2.007
BuildRequires: sed >= 4.0
-# We need "arch" binary:
-BuildRequires: util-linux
-ExclusiveArch: %{ix86} %{x8664} x32 %{arm} ia64 ppc ppc64
+ExclusiveArch: %{ix86} %{x8664} x32 %{arm} aarch64 ia64 ppc ppc64
# __TBB_machine_cmpswp8 uses gcc's __sync_val_compare_and_swap8 or directly cmpxchg8b asm instruction
ExcludeArch: i386 i486
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+# see src/tbb/CMakeLists.txt /TBB_PC_NAME
+%ifarch %{ix86} x32 %{arm} ppc
+%define tbb_pc_name tbb32
+%else
+%define tbb_pc_name tbb
+%endif
+
%description
Threading Building Blocks (TBB) is a C++ runtime library that
abstracts the low-level threading details necessary for optimal
Summary: The Threading Building Blocks documentation
Summary(pl.UTF-8): Dokumentacja bibliotek Threading Building Blocks
Group: Documentation
+BuildArch: noarch
%description doc
PDF documentation for the user of the Threading Building Block (TBB)
Building Blocks (TBB).
%prep
-%setup -q -n %{sourcebasename}
-%patch0 -p1
-%patch1 -p1
-%patch2 -p1
+%setup -q -n oneTBB-%{version}
cp -p %{SOURCE1} %{SOURCE2} %{SOURCE3} %{SOURCE4} .
-cp -p %{SOURCE5} %{SOURCE6} %{SOURCE7} .
-
%build
-%{__make} \
- CPLUS="%{__cxx}" \
- CXXFLAGS="%{rpmcxxflags}" \
- tbb_build_prefix=obj
+%cmake -B build \
+ %{?with_libatomic:-DTBB_LIB_LINK_LIBS=-latomic} \
+ -DTBB_STRICT:BOOL=OFF \
+ -DTBB_TEST:BOOL=OFF
+
+%{__make} -C build
%install
rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT{%{_libdir},%{_includedir},%{_pkgconfigdir}}
-
-cd build/obj_release
-for file in tbb tbbmalloc tbbmalloc_proxy; do
- install lib${file}.so.2 $RPM_BUILD_ROOT%{_libdir}/lib${file}.so.2.%{version}
- ln -s lib${file}.so.2.%{version} $RPM_BUILD_ROOT%{_libdir}/lib${file}.so
- ln -s lib${file}.so.2.%{version} $RPM_BUILD_ROOT%{_libdir}/lib${file}.so.2
-done
-cd -
-
-cd include
-find tbb -type f -name '*.h' -exec \
- install -p -D -m 644 {} $RPM_BUILD_ROOT%{_includedir}/{} ';'
-cd -
-
-for pc in tbb.pc tbbmalloc.pc tbbmalloc_proxy.pc; do
- in=$pc.in
- # fail if obsolete
- [ ! -f $RPM_BUILD_ROOT%{_pkgconfigdir}/$pc ] || exit 1
- sed -e '
- s,@prefix@,%{_prefix},;
- s,@libdir@,%{_libdir},;
- s,@includedir@,%{_includedir}/tbb,;
- s,@version@,%{version},
- ' $in > $RPM_BUILD_ROOT%{_pkgconfigdir}/$pc
-done
+
+%{__make} -C build install \
+ DESTDIR=$RPM_BUILD_ROOT
+
+%if "%{tbb_pc_name}" != "tbb"
+# for compatibility
+ln -sf %{tbb_pc_name}.pc $RPM_BUILD_ROOT%{_pkgconfigdir}/tbb.pc
+%endif
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(644,root,root,755)
-%doc CHANGES COPYING doc/Release_Notes.txt
-%attr(755,root,root) %{_libdir}/libtbb.so.*.*.*
-%attr(755,root,root) %ghost %{_libdir}/libtbb.so.2
-%attr(755,root,root) %{_libdir}/libtbbmalloc.so.*.*.*
+%doc README.md third-party-programs.txt
+%attr(755,root,root) %{_libdir}/libtbb.so.*.*
+%attr(755,root,root) %ghost %{_libdir}/libtbb.so.12
+%attr(755,root,root) %{_libdir}/libtbbbind.so.*.*
+%attr(755,root,root) %ghost %{_libdir}/libtbbbind.so.3
+%attr(755,root,root) %{_libdir}/libtbbmalloc.so.*.*
%attr(755,root,root) %ghost %{_libdir}/libtbbmalloc.so.2
-%attr(755,root,root) %{_libdir}/libtbbmalloc_proxy.so.*.*.*
+%attr(755,root,root) %{_libdir}/libtbbmalloc_proxy.so.*.*
%attr(755,root,root) %ghost %{_libdir}/libtbbmalloc_proxy.so.2
%files devel
%defattr(644,root,root,755)
%attr(755,root,root) %{_libdir}/libtbb.so
+%attr(755,root,root) %{_libdir}/libtbbbind.so
%attr(755,root,root) %{_libdir}/libtbbmalloc.so
%attr(755,root,root) %{_libdir}/libtbbmalloc_proxy.so
+# likely to be owned by different package?
+%dir %{_includedir}/oneapi
+%{_includedir}/oneapi/tbb.h
+%{_includedir}/oneapi/tbb
%{_includedir}/tbb
+%{_pkgconfigdir}/%{tbb_pc_name}.pc
+%if "%{tbb_pc_name}" != "tbb"
%{_pkgconfigdir}/tbb.pc
-%{_pkgconfigdir}/tbbmalloc.pc
-%{_pkgconfigdir}/tbbmalloc_proxy.pc
+%endif
+%{_libdir}/cmake/TBB
%files doc
%defattr(644,root,root,755)