summaryrefslogtreecommitdiff
path: root/tbb.spec
blob: 857c2b828f28f67525ae893e6c94b1c6cdafe8c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
%global debug_package %{nil}

Name:           tbb
Version:        2021.11.0
Release:        1%{?dist}
Summary:        Intel oneAPI Threading Building Blocks (oneTBB)
License:        Apache License 2.0
URL:            https://github.com/oneapi-src/oneTBB
Source0:        %{name}-%{version}.tar.gz

BuildRequires:  cmake
BuildRequires:  gcc
BuildRequires:  gcc-c++
BuildRequires:  pkgconfig
BuildRequires:  hwloc-devel

Requires:       glibc
Requires:       libstdc++-devel

%description
Intel oneAPI Threading Building Blocks (oneTBB) is a library for parallel programming and concurrency in C++.

%package devel
Summary:        Development files for %{name}
Requires:       %{name} = %{version}-%{release}
Requires:       pkgconfig

%description devel
Development files for Intel oneAPI Threading Building Blocks (oneTBB), including header files, CMake configuration, and pkg-config files.

%prep
%autosetup -p1 -n oneTBB-%{version}

%build
mkdir -p build
cd build
%cmake .. \
    -DCMAKE_INSTALL_PREFIX=%{_prefix} \
    -DCMAKE_BUILD_TYPE=RelWithDebInfo \
    -DTBB_TEST=OFF \
    -DTBB_STRICT=OFF \
    -DTBB_GENERATE_CONFIG=ON \
    -DTBB_INSTALL_CMAKE_DIR=%{_libdir}/cmake/TBB

make -j$(nproc)

%install
cd build
make install DESTDIR=%{buildroot}

# 手动确保 CMake 配置文件正确安装
if [ -f "TBBConfig.cmake" ] && [ -f "TBBConfigVersion.cmake" ]; then
    mkdir -p %{buildroot}%{_libdir}/cmake/TBB
    cp TBBConfig.cmake TBBConfigVersion.cmake %{buildroot}%{_libdir}/cmake/TBB/
fi

# 清理不需要的文件
find %{buildroot} -name '*.la' -delete
find %{buildroot} -name '*.a' -delete
find %{buildroot} -name 'debugsourcefiles.list' -delete || true

%files
%{_libdir}/libtbb.so.*
%{_libdir}/libtbbmalloc.so.*
%{_libdir}/libtbbmalloc_proxy.so.*
%{_libdir}/libtbbbind_2_5.so.*
%{_libdir}/libtbbmalloc.so
%{_libdir}/libtbbmalloc_proxy.so
%{_libdir}/libtbbbind_2_5.so

%files devel
%{_libdir}/libtbb.so
%{_includedir}/tbb/
%{_includedir}/oneapi/tbb.h
%{_includedir}/oneapi/tbb/
%{_libdir}/cmake/TBB/
%{_libdir}/pkgconfig/tbb.pc
%doc %{_datadir}/doc/TBB/README.md

%changelog
* Fri Jan 5 2024 Sebastian <microseyuyu@gmail.com> - 2021.11.0-1
- Explicitly included /usr/include/oneapi/tbb.h in files section.
- Fixed unpackaged file error for oneapi headers.
- Ensured proper CMake and pkg-config configurations.