File compute-runtime.spec of Package intel-compute-runtime
%define realname compute-runtime
%define realver 24.13.29138.7
%define srcext tar.gz
%bcond_without ninja
%bcond_with gold
# Common info
Name: intel-compute-runtime
Version: %{realver}
Release: wiz%{?extraver:0.}1%{?dist}
License: MIT
Group: System/Libraries
URL: https://github.com/intel/compute-runtime
Summary: Intel(R) Graphics Compute Runtime for OpenCL(TM)
# Install-time parameters
Requires: igc
Provides: intel-opencl = %{version}-%{release}
Obsoletes: intel-opencl < %{version}-%{release}
# Build-time parameters
BuildRequires: cmake >= 3.5
%if %{with gold}
BuildRequires: binutils-gold
%endif
%if %{with ninja}
BuildRequires: ninja
%endif
BuildRequires: gcc-c++
BuildRequires: pkgconfig(libdrm)
BuildRequires: pkgconfig(igc-opencl)
BuildRequires: pkgconfig(igdgmm)
BuildRequires: libopencl-clang-devel
%if 0%{?suse_version}
BuildRequires: pkgconfig(libva) >= 1.0.0
%endif
BuildRoot: %{_tmppath}/%{name}-root
Source0: https://github.com/intel/compute-runtime/archive/refs/tags/%{realver}%{?extraver}.%{srcext}#/%{realname}-%{realver}%{?extraver}.%{srcext}
%description
The Intel(R) Graphics Compute Runtime for OpenCL(TM) is a open source project to
converge Intel's development efforts on OpenCL(TM) compute stacks supporting
the GEN graphics hardware architecture.
# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{realver}%{?extraver}
# Build step (compile/build binaries, documentation, etc)
%build
_CFLAGS='%{optflags} %{?gcc_lto} -Wno-error=odr'
_LDFLAGS='-Wl,--as-needed -Wl,--strip-all -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro %{?gcc_lto} -fuse-ld=%{?with_gold:gold -Wl,--threads}%{!?with_gold:bfd}'
mkdir tmp_build
cd tmp_build
cmake .. \
%if %{with ninja}
-G Ninja \
%endif
-DCMAKE_INSTALL_PREFIX=%{_prefix} \
-DCMAKE_INSTALL_LIBDIR=%{_libdir} \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_FLAGS_RELEASE="$_CFLAGS" \
-DCMAKE_C_FLAGS_RELEASE="$_CFLAGS" \
-DCMAKE_EXE_LINKER_FLAGS_RELEASE="$_LDFLAGS" \
-DCMAKE_MODULE_LINKER_FLAGS_RELEASE="$_LDFLAGS" \
-DCMAKE_SHARED_LINKER_FLAGS_RELEASE="$_LDFLAGS" \
-DCMAKE_VERBOSE_MAKEFILE=YES \
\
-DVERSION_list=$(awk -F. '{printf "%i;%i", $1, $2}' <<< %{version}) \
-DNEO_REVISION=%{version} \
-DSKIP_UNIT_TESTS=YES
%if %{with ninja}
ninja -v %{?_smp_mflags}
%else
%{__make} %{?_smp_mflags}
%endif
# Install built stuff
%install
%if %{with ninja}
DESTDIR=%{buildroot} ninja -v -C tmp_build install
%else
%{__make} -C tmp_build install DESTDIR=%{buildroot}
%endif
# Cleanup
%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}
# Files list
%files
%defattr(-,root,root)
%license LICENSE.md
%doc README.md FAQ.md
%dir %{_sysconfdir}/OpenCL/vendors/
%dir %{_sysconfdir}/OpenCL/
%config(noreplace) %{_sysconfdir}/OpenCL/vendors/intel.icd
%{_bindir}/ocloc
%dir %{_libdir}/intel-opencl
%{_libdir}/intel-opencl/libigdrcl.so
%{_libdir}/libocloc.so
%{_includedir}/ocloc_api.h
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%changelog