## START: Set by rpmautospec
## (rpmautospec version 0.6.5)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 2;
    base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
    print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec

%global srcname level-zero
%global lib_version 1.17
%global patch_version 0

Name:           oneapi-%{srcname}
Version:        1.17.19
Release:        %{autorelease}
Summary:        OneAPI Level Zero Specification Headers and Loader

License:        MIT
URL:            https://github.com/oneapi-src/%{srcname}
Source:         %{url}/archive/v%{version}/%{srcname}-%{version}.tar.gz

ExclusiveArch:  x86_64

BuildRequires:  chrpath
BuildRequires:  gcc-c++
BuildRequires:  cmake
BuildRequires:  make
BuildRequires:  opencl-headers
BuildRequires:  spdlog-devel

# Useful for a quick oneAPI Level-Zero testing
Recommends:     %{name}-zello_world

%description
The objective of the oneAPI Level-Zero Application Programming Interface
(API) is to provide direct-to-metal interfaces to offload accelerator
devices. Its programming interface can be tailored to any device needs
and can be adapted to support broader set of languages features such as
function pointers, virtual functions, unified memory,
and I/O capabilities.

%package        devel
Summary:        The oneAPI Level Zero Specification Headers and Loader development package
Requires:       %{name}%{?_isa} = %{version}-%{release}

%description    devel
The %{name}-devel package contains library and header files for
developing applications that use %{name}.

%package        zello_world
Summary:        The oneAPI Level Zero quick test package with zello_world binary
Requires:       %{name}%{?_isa} = %{version}-%{release}

%description    zello_world
The %{name}-zello_world package contains a zello_world binary which is capable of a quick test
of the oneAPI Level-Zero driver and dumping out the basic device and driver characteristics.

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

%build
# spdlog uses fmt, but since this doesn't setup linking, use it in header only mode
export CXXFLAGS="%{build_cxxflags} -DFMT_HEADER_ONLY=1"
%cmake -DSYSTEM_SPDLOG=ON
%cmake_build

%install
%cmake_install
# Install also the zello_world binary to ease up testing of the l0
mkdir -p %{buildroot}%{_bindir}/
install -p -m 755 ./redhat-linux-build/bin/zello_world %{buildroot}%{_bindir}/zello_world
chrpath --delete %{buildroot}%{_bindir}/zello_world

%files
%license LICENSE
%doc README.md SECURITY.md
%{_libdir}/libze_loader.so.%{lib_version}.%{patch_version}
%{_libdir}/libze_loader.so.1
%{_libdir}/libze_validation_layer.so.%{lib_version}.%{patch_version}
%{_libdir}/libze_validation_layer.so.1
%{_libdir}/libze_tracing_layer.so.%{lib_version}.%{patch_version}
%{_libdir}/libze_tracing_layer.so.1

%files zello_world
%{_bindir}/zello_world

%files devel
%{_includedir}/level_zero
%{_libdir}/libze_loader.so
%{_libdir}/libze_validation_layer.so
%{_libdir}/libze_tracing_layer.so
%{_libdir}/pkgconfig/libze_loader.pc
%{_libdir}/pkgconfig/%{srcname}.pc

%changelog
## START: Generated by rpmautospec
* Mon Jul 15 2024 Kefu Chai <tchaikov@gmail.com> - 1.17.19-2
- Rebuild for fmt 11

* Thu Jul 11 2024 František Zatloukal <fzatlouk@redhat.com> - 1.17.19-1
- Update to 1.17.19

* Tue Jul 02 2024 František Zatloukal <fzatlouk@redhat.com> - 1.17.17-1
- Update to 1.17.17 (RHBZ#2269788)

* Thu May 23 2024 Orion Poplawski <orion@nwra.com> - 1.17.2-1
- Update to 1.17.2

* Sat Feb 17 2024 František Zatloukal <fzatlouk@redhat.com> - 1.16.1-1
- Update to 1.16.1 (RHBZ#2264638)

* Thu Feb 15 2024 František Zatloukal <fzatlouk@redhat.com> - 1.16.0-1
- Update to 1.16.0 (RHBZ#2264291)

* Thu Feb 08 2024 František Zatloukal <fzatlouk@redhat.com> - 1.15.13-1
- Update to 1.15.13 (RHBZ#2263327)

* Thu Jan 25 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.15.8-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Sun Jan 21 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.15.8-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Thu Dec 21 2023 František Zatloukal <fzatlouk@redhat.com> - 1.15.8-1
- Update to 1.15.8 (RHBZ#2255469)

* Wed Nov 01 2023 Ali Erdinc Koroglu <aekoroglu@linux.intel.com> - 1.15.1-1
- Update to 1.15.1 (RHBZ #2246035)

* Thu Oct 05 2023 František Zatloukal <fzatlouk@redhat.com> - 1.14.0-1
- Update to 1.14.0 (Fixes RHBZ#2236644)

* Thu Aug 10 2023 František Zatloukal <fzatlouk@redhat.com> - 1.13.5-1
- Update to 1.13.5 (Fixes RHBZ#2230755)

* Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.13.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

* Sat Jul 15 2023 František Zatloukal <fzatlouk@redhat.com> - 1.13.1-1
- Update to 1.13.1 (Fixes RHBZ#2222838)

* Sun Jun 11 2023 František Zatloukal <fzatlouk@redhat.com> - 1.12.0-2
- Upload sources

* Sun Jun 11 2023 Luya Tshimbalanga <luya@fedoraproject.org> - 1.12.0-1
- Updates to 1.12.0

* Tue May 09 2023 František Zatloukal <fzatlouk@redhat.com> - 1.11.0-1
- Update to 1.10.0 (#2192053)

* Mon Apr 10 2023 Luya Tshimbalanga <luya@fedoraproject.org> - 1.10.0-1
- Update to 1.10.0 (#2185594)

* Thu Mar 09 2023 aekoroglu <aekoroglu@linux.intel.com> - 1.9.9-1
- update to 1.9.9

* Fri Jan 20 2023 František Zatloukal <fzatlouk@redhat.com> - 1.9.4-1
- Release 1.9.4

* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.8.12-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild

* Wed Dec 14 2022 František Zatloukal <fzatlouk@redhat.com> - 1.8.12-1
- Release 1.8.12

* Mon Dec 12 2022 Luya Tshimbalanga <luya@fedoraproject.org> - 1.8.8-1
- New package
## END: Generated by rpmautospec