%global upver 2018 %global uprel 2 Name: tbb Summary: The Threading Building Blocks library abstracts low-level threading details Version: %{upver}%{?uprel:.%{uprel}} Release: 10%{?dist}.1 License: ASL 2.0 Group: Development/Tools URL: http://threadingbuildingblocks.org/ Source0: https://github.com/01org/tbb/archive/%{upver}%{?uprel:_U%{uprel}}.tar.gz # These three are downstream sources. Source6: tbb.pc Source7: tbbmalloc.pc Source8: tbbmalloc_proxy.pc # Propagate CXXFLAGS variable into flags used when compiling C++. # This is so that RPM_OPT_FLAGS are respected. Patch1: tbb-4.4-cxxflags.patch # For 32-bit x86 only, don't assume that the mfence instruction is available. # It was added with SSE2. This patch causes a lock xchg instruction to be # emitted for non-SSE2 builds, and the mfence instruction to be emitted for # SSE2-enabled builds. Patch2: tbb-4.0-mfence.patch # Don't snip -Wall from C++ flags. Add -fno-strict-aliasing, as that # uncovers some static-aliasing warnings. # Related: https://bugzilla.redhat.com/show_bug.cgi?id=1037347 Patch3: tbb-4.3-dont-snip-Wall.patch # python3 is not available on RHEL <=7 %if 0%{?rhel} && 0%{?rhel} <= 7 # disable python3 by default %bcond_with python3 %else %bcond_without python3 %endif # python2 is not available on RHEL > 7 and not needed on Fedora > 28 %if 0%{?rhel} > 7 || 0%{?fedora} > 28 # disable python2 by default %bcond_with python2 %else %bcond_without python2 %endif BuildRequires: gcc-c++ BuildRequires: swig %if %{with python2} BuildRequires: python2-devel %endif %if %{with python3} BuildRequires: python3-devel %endif %description Threading Building Blocks (TBB) is a C++ runtime library that abstracts the low-level threading details necessary for optimal multi-core performance. It uses common C++ templates and coding style to eliminate tedious threading implementation work. TBB requires fewer lines of code to achieve parallelism than other threading models. The applications you write are portable across platforms. Since the library is also inherently scalable, no code maintenance is required as more processor cores become available. %package devel Summary: The Threading Building Blocks C++ headers and shared development libraries Group: Development/Libraries Requires: %{name}%{?_isa} = %{version}-%{release} %description devel Header files and shared object symlinks for the Threading Building Blocks (TBB) C++ libraries. %package doc Summary: The Threading Building Blocks documentation Group: Documentation %description doc HTML documentation for the user of the Threading Building Block (TBB) C++ library. %if %{with python2} %package -n python2-%{name} Summary: Python 2 TBB module %{?python_provide:%python_provide python2-%{name}} Requires: tbb = %{version}-%{release} %description -n python2-%{name} Python 2 TBB module. %endif %if %{with python3} %package -n python3-%{name} Summary: Python 3 TBB module %{?python_provide:%python_provide python3-%{name}} Requires: tbb = %{version}-%{release} %description -n python3-%{name} Python 3 TBB module. %endif %prep %setup -q -n %{name}-%{upver}_U%{uprel} %patch1 -p1 %patch2 -p1 %patch3 -p1 # For repeatable builds, don't query the hostname or architecture sed -i 's/"`hostname -s`" ("`uname -m`"/fedorabuild (%{_arch}/' \ build/version_info_linux.sh # Do not assume the RTM instructions are available sed -i 's/-mrtm//' build/linux.gcc.inc %if %{with python2} # Invoke the right python binary directly sed -i 's,env python,python2,' python/TBB.py python/tbb/__*.py %endif %if %{with python3} # Invoke the right python binary directly sed -i 's,env python,python3,' python/TBB.py python/tbb/__*.py %endif # Remove shebang from files that don't need it sed -i '/^#!/d' python/tbb/{pool,test}.py # Fix libdir on 64-bit systems if [ "%{_libdir}" != "%{_prefix}/lib" ]; then sed -i.orig 's/"lib"/"%{_lib}"/' cmake/TBBMakeConfig.cmake touch -r cmake/TBBMakeConfig.cmake.orig cmake/TBBMakeConfig.cmake rm cmake/TBBMakeConfig.cmake.orig fi # Prepare to build the python module for both python 2 and python 3 %if %{with python2} cp -a python python2 %endif %if %{with python3} cp -a python python3 sed -i 's,python,python3,g' python3/Makefile python3/rml/Makefile sed -i 's,python2,python3,' python3/TBB.py python3/tbb/__*.py # Invoke Python with the %%{__python3} executable instead of hardcoded python3 sed -i 's,PY_SETUP=python3,PY_SETUP=%{__python3},g' python3/Makefile sed -i 's,python3 -m tbb test,%{__python3} -m tbb test,g' python3/Makefile %endif # Remove jQuery rm doc/html/jquery.js find doc/html -name '*.html' | xargs sed -i '/