Work around ocl-icd-devel not being in CS9

Signed-off-by: Tom Rix <Tom.Rix@amd.com>
This commit is contained in:
2024-09-11 11:10:14 -07:00
parent 7dfe69d154
commit 2e87389c6a

View File

@@ -28,9 +28,25 @@
%global build_prof_api OFF
%endif
%if 0%{?rhel} && 0%{?rhel} < 10
# No ocl-icd-devel in cs9
%bcond_with ocl
%else
%bcond_without ocl
%endif
%if %{with ocl}
%global build_ocl ON
%else
%global build_ocl OFF
%endif
Name: rocclr
Version: %{rocm_version}
%if 0%{?rhel} && 0%{?rhel} < 10
Release: 1%{?dist}
%else
Release: %autorelease
%endif
Summary: ROCm Compute Language Runtime
Url: https://github.com/ROCm-Developer-Tools/clr
License: MIT
@@ -58,9 +74,15 @@ BuildRequires: hipcc
BuildRequires: libffi-devel
BuildRequires: perl
BuildRequires: perl-generators
%if 0%{?rhel} && 0%{?rhel} < 10
BuildRequires: libglvnd-devel
%else
BuildRequires: pkgconfig(opengl)
BuildRequires: pkgconfig(numa)
%endif
%if %{with ocl}
BuildRequires: pkgconfig(ocl-icd)
%endif
BuildRequires: pkgconfig(numa)
%if %{with cppheaderparser}
BuildRequires: python3-cppheaderparser
%endif
@@ -74,13 +96,16 @@ BuildRequires: zlib-devel
# Also depends on rocm-runtime which doesn't build non x86
ExclusiveArch: x86_64
%if %{with ocl}
# rocclr bundles OpenCL 2.2 headers
# Some work is needed to unbundle this, as it fails to compile with latest
Provides: bundled(opencl-headers) = 2.2
%endif
%description
ROCm Compute Language Runtime
%if %{with ocl}
%package -n rocm-opencl
Summary: ROCm OpenCL platform and device tool
Requires: comgr(major) = %{comgr_maj_api_ver}
@@ -105,6 +130,7 @@ Summary: ROCm OpenCL platform and device tool
%description -n rocm-clinfo
A simple ROCm OpenCL application that enumerates all possible platform and
device information.
%endif
%package -n rocm-hip
Summary: ROCm HIP platform and device tool
@@ -184,7 +210,7 @@ export PATH=%rocmllvm_prefix/bin:$PATH
-DROCM_PATH=%{_prefix} \
-DBUILD_ICD=OFF \
-DCLR_BUILD_HIP=ON \
-DCLR_BUILD_OCL=ON \
-DCLR_BUILD_OCL=%{build_ocl} \
-DFILE_REORG_BACKWARD_COMPATIBILITY=OFF \
-DHIP_ENABLE_ROCPROFILER_REGISTER=OFF \
-DUSE_PROF_API=%{build_prof_api} \
@@ -194,6 +220,7 @@ export PATH=%rocmllvm_prefix/bin:$PATH
%install
%cmake_install
%if %{with ocl}
# Install OpenCL ICD configuration:
install -D -m 644 opencl/config/amdocl64.icd \
%{buildroot}%{_sysconfdir}/OpenCL/vendors/amdocl64.icd
@@ -204,6 +231,7 @@ mv %{buildroot}%{_includedir}/CL %{buildroot}%{_includedir}/%{name}/CL
# Avoid file conflicts with clinfo package:
mv %{buildroot}%{_bindir}/clinfo %{buildroot}%{_bindir}/rocm-clinfo
%endif
# Clean up file dupes
%if 0%{?fedora}
@@ -213,6 +241,7 @@ mv %{buildroot}%{_bindir}/clinfo %{buildroot}%{_bindir}/rocm-clinfo
# TODO send upstream a patch, libhip should be installed with cmake's 'TARGETS'
chmod 755 %{buildroot}%{_libdir}/lib*.so*
%if %{with ocl}
%files -n rocm-opencl
%license opencl/LICENSE.txt
%config(noreplace) %{_sysconfdir}/OpenCL/vendors/amdocl64.icd
@@ -229,6 +258,7 @@ chmod 755 %{buildroot}%{_libdir}/lib*.so*
%files -n rocm-clinfo
%license opencl/LICENSE.txt
%{_bindir}/rocm-clinfo
%endif
%files -n rocm-hip
%license hipamd/LICENSE.txt
@@ -261,4 +291,9 @@ chmod 755 %{buildroot}%{_libdir}/lib*.so*
%{_docdir}/hip
%changelog
%if 0%{?rhel} && 0%{?rhel} < 10
* Tue Sep 10 2024 Tom Rix <Tom.Rix@amd.com> - 6.2.0-1
- A placeholder for rhel 9
%else
%autochangelog
%endif