Files
rocthrust/rocthrust.spec
Egbert Eich b37e0ff68a Convert to SUSE Format
Signed-off-by: Egbert Eich <eich@suse.com>
2025-08-31 08:52:37 +02:00

178 lines
5.9 KiB
RPMSpec

#
# spec file for package rocthrust
#
# Copyright Fedora Project Authors.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
# Copyright (c) 2025 SUSE LLC and contributors
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%global upstreamname rocThrust
%global rocm_release 6.4
%global rocm_patch 2
%global rocm_version %{rocm_release}.%{rocm_patch}
# Compiler is hipcc, which is clang based:
%global toolchain rocm
# hipcc does not support some clang flags
%global build_cxxflags %(echo %{optflags} | sed -e 's/-fstack-protector-strong/-Xarch_host -fstack-protector-strong/' -e 's/-fcf-protection/-Xarch_host -fcf-protection/' -e 's/-mtls-dialect=gnu2//')
# there is no debug package
%global debug_package %{nil}
# Option to test suite for testing on real HW:
%bcond_with check
%if %{with check}
%global build_test ON
%else
%global build_test OFF
%endif
# Compression type and level for source/binary package payloads.
# "w7T0.xzdio" xz level 7 using %%{getncpus} threads
# Threaded compression reduces the build time.
%global _source_payload w7T0.xzdio
%global _binary_payload w7T0.xzdio
Name: rocthrust
Version: %{rocm_version}
Release: 5%{?dist}
Summary: ROCm Thrust libary
URL: https://github.com/ROCm/%{upstreamname}
%if 0%{?suse_version}
# https://en.opensuse.org/openSUSE:Accepted_licences
# Uses 'Public Domain' but this is not a spdx tag and hangs up the SLE 15.7 autochecker
# The license should also include Public Domain
License: Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND BSL-1.0 AND MIT
%else
# https://docs.fedoraproject.org/en-US/legal/allowed-licenses/
# Uses 'LicenseRef-Fedora-Public-Domain'
License: Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND BSL-1.0 AND MIT AND LicenseRef-Fedora-Public-Domain
%endif
# All files are Apache 2.0 with some exceptions:
# ./cmake contains only files under MIT
# ./internal/benchmark/*.py are dual licensed Apache 2.0 and Boost 1.0
# ./thrust/ contain some headers files that are Boost 1.0 licensed
# ./thrust/ contain some headers that are dual Apache 2.0 and Boost 1.0
# ./thrust/cmake/FindTBB.cmake is public domain
# ./thrust/detail/allocator/allocator_traits.h is dual Apache 2.0 and MIT
# ./thrust/detail/complex contains BSD 2 clause licensed headers
Source0: %{url}/archive/rocm-%{version}.tar.gz#/%{upstreamname}-%{version}.tar.gz
BuildRequires: cmake
BuildRequires: gcc-c++
BuildRequires: rocm-cmake
BuildRequires: rocm-comgr-devel
BuildRequires: rocm-compilersupport-macros
BuildRequires: rocm-hip-devel
BuildRequires: rocm-rpm-macros
BuildRequires: rocm-runtime-devel
BuildRequires: rocprim-static
%if %{with check}
%if 0%{?suse_version}
BuildRequires: gtest
%else
BuildRequires: gtest-devel
%endif
BuildRequires: rocminfo
%endif
# Only headers, cmake infra, noarch confuses libdir
# BuildArch: noarch
# Only x86_64 works right now:
ExclusiveArch: x86_64
%description
Thrust is a parallel algorithm library. This library has been
ported to HIP/ROCm platform, which uses the rocPRIM library.
%package devel
Summary: The %{upstreamname} development package
Provides: %{name}-static = %{version}-%{release}
%description devel
The %{upstreamname} development package.
%prep
%autosetup -p1 -n %{upstreamname}-rocm-%{version}
#
# The ROCMExportTargetsHeaderOnly.cmake file
# generates a files that reference the install location of other files
# Make this change so they match
sed -i -e 's/ROCM_INSTALL_LIBDIR lib/ROCM_INSTALL_LIBDIR lib64/' cmake/ROCMExportTargetsHeaderOnly.cmake
%build
%if %{with check}
# Building all the gpu's does not make sense
# Build only the first one, this only works well with rpmbuild.
gpu=`rocm_agent_enumerator | head -n 1`
%endif
%cmake \
-DCMAKE_CXX_COMPILER=hipcc \
-DCMAKE_C_COMPILER=hipcc \
-DCMAKE_LINKER=%rocmllvm_bindir/ld.lld \
-DCMAKE_AR=%rocmllvm_bindir/llvm-ar \
-DCMAKE_RANLIB=%rocmllvm_bindir/llvm-ranlib \
-DBUILD_FILE_REORG_BACKWARD_COMPATIBILITY=OFF \
-DBUILD_TEST=%{build_test} \
%if %{with check}
-DAMDGPU_TARGETS=${gpu} \
%endif
-DCMAKE_PREFIX_PATH=%{rocmllvm_cmakedir}/.. \
-DROCM_SYMLINK_LIBS=OFF
%cmake_build
%install
%cmake_install
rm -f %{buildroot}%{_prefix}/share/doc/rocthrust/LICENSE
%check
%if %{with check}
%ctest
%endif
%files devel
%doc README.md
%license LICENSE
%license NOTICES.txt
%{_includedir}/thrust
%{_libdir}/cmake/%{name}
%changelog