File intel-opencl-legacy1.spec of Package intel-opencl-legacy1

#
# spec file for package intel-opencl-legacy1
#
# Copyright (c) 2025 SUSE LLC
# Copyright (c) 2025, 2026 Boian Berberov
#
# 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/
#

%bcond_without  debug_cond
%bcond_without  lto_cond

%bcond_with     current_platforms
%if 1600 <= 0%{?suse_version} || 42 <= 0%{?fedora}
%bcond_without  level_zero
%else
%bcond_with     level_zero
%endif

%if %{with current_platforms}
%global         lib_suffix  %{nil}
%global         ocloc_ver   1
%else
%global         lib_suffix  _legacy1
%global         ocloc_ver   0
%endif



Name:           intel-opencl-legacy1
Version:        24.35.30872.42
Release:        0%{?dist}
Group:          Development/Libraries/C and C++
Summary:        Intel Graphics Compute Runtime for OpenCL (legacy version)
License:        MIT
URL:            https://github.com/intel/compute-runtime

Source0:        %{url}/archive/refs/tags/%{version}.tar.gz

Patch0:         compute-runtime-24.35.30872.42_gcc13+-support.patch

BuildRequires:  cmake >= 3.13

# BEGIN multibuild BuildRequires: GCC all
%if 0%{?is_opensuse}
	%if 0%{?sle_version}
		%if 0%{?sle_version} == 150600
BuildRequires:  gcc13
BuildRequires:  gcc13-c++
# BuildRequires:  libstdc++6-devel-gcc13
# Conflicts:      libstdc++6-devel < 10
%global         multi_gcc  gcc-13
%global         multi_gpp  gcc-13 -E
%global         multi_gxx  g++-13
		%else
			%if 0%{?sle_version} == 150500
BuildRequires:  gcc12
BuildRequires:  gcc12-c++
# BuildRequires:  libstdc++6-devel-gcc12
# Conflicts:      libstdc++6-devel < 10
%global         multi_gcc  gcc-12
%global         multi_gpp  gcc-12 -E
%global         multi_gxx  g++-12
			%else
BuildRequires:  gcc             >= 10
BuildRequires:  gcc-c++         >= 10
# BuildRequires:  libstdc++-devel >= 10
%global         multi_gcc  gcc
%global         multi_gpp  gcc -E
%global         multi_gxx  g++
			%endif
		%endif
	%else
BuildRequires:  gcc
BuildRequires:  gcc-c++
%global         multi_gcc  gcc
%global         multi_gpp  gcc -E
%global         multi_gxx  g++
	%endif
%else
BuildRequires:  gcc
BuildRequires:  gcc-c++
%global         multi_gcc  gcc
%global         multi_gpp  gcc -E
%global         multi_gxx  g++
%endif
# END   multibuild BuildRequires: GCC all

%if 0%{?is_opensuse}
BuildRequires:  ninja
%else
BuildRequires:  ninja-build
%endif
BuildRequires:  pkgconfig

%if %{with level_zero}
	%if 0%{?is_opensuse}
BuildRequires:  igsc
BuildRequires:  cmake(igsc)
	%else
BuildRequires:  intel-gsc
BuildRequires:  cmake(igsc)
	%endif
BuildRequires:  pkgconfig(level-zero)
BuildRequires:  pkgconfig(libnl-3.0)
BuildRequires:  pkgconfig(libudev)
%endif

%if 0%{?is_opensuse}
# NOTE: split from pkgconfig(igc-opencl)
BuildRequires:  libigc-devel
%endif
BuildRequires:  pkgconfig(igc-opencl)
BuildRequires:  pkgconfig(igdgmm)       >= 12.3.0
BuildRequires:  pkgconfig(libva)

Requires:       libigc2
Requires:       libigdfcl2
Requires:       libigdgmm12
Requires:       libopencl-clang16

Recommends:     libOpenCL1

%if %{with current_platforms}
Conflicts:      intel-opencl
%endif

# BEGIN Supplements:

# NOTE: This list is incomplete

# Gen8
Supplements:    modalias(llamacpp:pci:v00008086d00001612sv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00001616sv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d0000161esv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00001622sv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00001626sv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d0000162asv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d0000162bsv*sd*bc*sc*i*)

# Gen9
Supplements:    modalias(llamacpp:pci:v00008086d00001902sv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00001906sv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d0000190bsv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00001912sv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d0000190bsv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d0000190dsv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d0000190esv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00001921sv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00001923sv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00001926sv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00001927sv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d0000192bsv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d0000192dsv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00005a84sv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00005a85sv*sd*bc*sc*i*)

# Gen9.5
Supplements:    modalias(llamacpp:pci:v00008086d00003e90sv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00003e91sv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00003e92sv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00003e93sv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00003e94sv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00003e96sv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00003e98sv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00003e9asv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00003e9bsv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00003e9csv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00003ea0sv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00003ea1sv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00003ea5sv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00003ea6sv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00003ea8sv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00003ea9sv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00005902sv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00005906sv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d0000590bsv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00005912sv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00005916sv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00005917sv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d0000591bsv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d0000591csv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d0000591dsv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d0000591esv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00005921sv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00005923sv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00005926sv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00005927sv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d000087c0sv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d000087casv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00009b21sv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00009b41sv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00009ba4sv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00009ba8sv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00009baasv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00009bacsv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00009bc4sv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00009bc5sv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00009bc6sv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00009bc8sv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00009bcasv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00009bccsv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00009be6sv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00009bf6sv*sd*bc*sc*i*)

# Gen11
Supplements:    modalias(llamacpp:pci:v00008086d00008a51sv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00008a52sv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00008a53sv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00008a56sv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00008a58sv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00008a5asv*sd*bc*sc*i*)
Supplements:    modalias(llamacpp:pci:v00008086d00008a5csv*sd*bc*sc*i*)

# END   Supplements:

ExclusiveArch:  x86_64

%description
Intel Graphics Compute Runtime for OpenCL supporting Intel Gen8, Gen9 and Gen 11 devices

%if %{with current_platforms}
%package        devel
Summary:        Headers for the Intel Graphics Compute Runtime for OpenCL (legacy version)

Requires:       %{name}%{?_isa} = %{version}-%{release}

Conflicts:      intel-opencl-devel

BuildArch:      noarch

%description    devel
Development package for Intel Graphics Compute Runtime for OpenCL.

%endif

%if %{with level_zero}
	%if 0%{?is_opensuse}
%package        -n libze_intel_gpu_legacy1
Summary:        Intel GPU support for oneAPI level zero

Requires:       level-zero%{?_isa}

Conflicts:      libze_intel_gpu1

%description    -n libze_intel_gpu_legacy1
This package provides offloading to an Intel GPU via the oneAPI level zero interface.



%package        -n libze_intel_gpu_legacy1-devel
Summary:        Headers for the Intel GPU support for oneAPI level zero

Requires:       libze_intel_gpu_legacy1%{?_isa} = %{version}-%{release}

Conflicts:      libze_intel_gpu1-devel

BuildArch:      noarch

%description    -n libze_intel_gpu_legacy1-devel
This package provides offloading to an Intel GPU via the oneAPI level zero interface.

	%else
%package        -n intel-level-zero-legacy
Summary:        oneAPI L0 support implementation for Intel GPUs

Requires:       oneapi-level-zero%{?_isa}

Conflicts:      intel-level-zero

%description    -n intel-level-zero-legacy
This package provides offloading to an Intel GPU via the oneAPI level zero interface.



%package        -n intel-level-zero-legacy-devel
Summary:        oneAPI L0 support implementation for Intel GPUs

Requires:       intel-level-zero-legacy%{?_isa} = %{version}-%{release}

Conflicts:      intel-level-zero-devel

BuildArch:      noarch

%description    -n intel-level-zero-legacy-devel
This package provides offloading to an Intel GPU via the oneAPI level zero interface.

	%endif
%endif



%prep
%autosetup -p1 -n compute-runtime-%{version}



%build
%define         __builder  ninja

export CC=%{multi_gcc}
export CXX=%{multi_gxx}

# Needed for gcc12+
# export CXXFLAGS="${CXXFLAGS} -Wno-error=maybe-uninitialized -Wno-error=mismatched-new-delete -Wno-error=unused-variable -Wno-error=alloc-size-larger-than="

# NOTE: NEO_BUILD_WITH_OCL=ON is default
# NOTE: L0_INSTALL_UDEV_RULES=OFF is default
%cmake \
%if ! 0%{?is_opensuse}
	-GNinja \
%endif
	-DNEO_BUILD_WITH_OCL=ON \
%if %{with level_zero}
	-DBUILD_WITH_L0=ON \
%else
	-DBUILD_WITH_L0=OFF \
%endif
%if %{with lto_cond}
	-DNEO_DISABLE_LTO=ON \
%else
	-DNEO_DISABLE_LTO=OFF \
%endif
	\
%if %{with debug_cond}
	-DNEO_BUILD_DEBUG_SYMBOLS_PACKAGE=ON \
%else
	-DNEO_BUILD_DEBUG_SYMBOLS_PACKAGE=OFF \
%endif
	\
	-DNEO_SKIP_UNIT_TESTS=ON \
	\
	-DNEO_LEGACY_PLATFORMS_SUPPORT=ON \
%if %{with current_platforms}
	-DNEO_CURRENT_PLATFORMS_SUPPORT=ON \
%else
	-DNEO_CURRENT_PLATFORMS_SUPPORT=OFF \
%endif
	\
	-DNEO_DISABLE_MITIGATIONS=ON \
	\
	-DL0_INSTALL_UDEV_RULES=OFF \
	\
%if 0%{?fedora} || 0%{?rhel}
	-DCMAKE_BUILD_TYPE=RelWithDebInfo \
%endif
%if %{with debug_cond}
	-DCMAKE_C_FLAGS_RELWITHDEBINFO="-g2" \
	-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="-g2" \
%else
	-DCMAKE_C_FLAGS_RELWITHDEBINFO="-g0" \
	-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="-g0" \
%endif
	%{nil}

%if 0%{?fedora} || 0%{?rhel}
%ninja_build -C redhat-linux-build
%else
%cmake_build
%endif



%install
%if 0%{?fedora} || 0%{?rhel}
%ninja_install -C redhat-linux-build
%else
%cmake_install
%endif

# TEST:
%__chmod +x %{buildroot}%{_libdir}/intel-opencl/libigdrcl%{lib_suffix}.so

# WARNING: no update-alternatives since we "Conflicts: intel-opencl"
%__ln_s %{_bindir}/ocloc-24.35.%{ocloc_ver} %{buildroot}%{_bindir}/ocloc

%if 0%{?is_opensuse} && 1600 < 0%{?suse_version}
%__mkdir -p %{buildroot}/%{_datadir}/OpenCL/vendors
%__mv \
	%{buildroot}/%{_sysconfdir}/OpenCL/vendors/intel%{lib_suffix}.icd \
	%{buildroot}/%{_datadir}/OpenCL/vendors/
%endif

%__rm -Rf %{buildroot}%{_prefix}/lib/debug



%post   -p /sbin/ldconfig
%postun -p /sbin/ldconfig

%if %{with level_zero}
	%if 0%{?is_opensuse}
%post   -n libze_intel_gpu_legacy1 -p /sbin/ldconfig
%postun -n libze_intel_gpu_legacy1 -p /sbin/ldconfig
	%else
%post   -n intel-level-zero-legacy -p /sbin/ldconfig
%postun -n intel-level-zero-legacy -p /sbin/ldconfig
	%endif
%endif



%files
%license        LICENSE.md
%dir            %{_libdir}/intel-opencl
%{_bindir}/ocloc
%{_bindir}/ocloc-24.35.%{ocloc_ver}
%{_libdir}/intel-opencl/libigdrcl%{lib_suffix}.so
%{_libdir}/libocloc%{lib_suffix}.so

%if 0%{?is_opensuse} && 1600 < 0%{?suse_version}
%dir            %{_datadir}/OpenCL
%dir            %{_datadir}/OpenCL/vendors
%{_datadir}/OpenCL/vendors/intel%{lib_suffix}.icd
%else
%dir            %{_sysconfdir}/OpenCL
%dir            %{_sysconfdir}/OpenCL/vendors
%{_sysconfdir}/OpenCL/vendors/intel%{lib_suffix}.icd
%endif

%if %{with current_platforms}
%files          devel
%license        LICENSE.md
%{_includedir}/ocloc_api.h
%endif

%if %{with level_zero}
	%if 0%{?is_opensuse}
%files          -n libze_intel_gpu_legacy1
%license        LICENSE.md
%{_libdir}/libze_intel_gpu%{lib_suffix}.so.1
%{_libdir}/libze_intel_gpu%{lib_suffix}.so.1.5.*

%files          -n libze_intel_gpu_legacy1-devel
%{_includedir}/level_zero/
	%else
%files          -n intel-level-zero-legacy
%license        LICENSE.md
%{_libdir}/libze_intel_gpu%{lib_suffix}.so.1
%{_libdir}/libze_intel_gpu%{lib_suffix}.so.1.5.*

%files          -n intel-level-zero-legacy-devel
%{_includedir}/level_zero/
	%endif
%endif



%changelog

* Fri Dec 05 2025 Boian Berberov
- Added changelog for openSUSE Leap 16
openSUSE Build Service is sponsored by