File vulkan-headers.spec of Package vulkan-headers
%define realname Vulkan-Headers
%define realver 1.3.267
%define srcext tar.gz
%if 0%{?rhel} == 8
%define python3_pkg platform-python
%define python3 %{_libexecdir}/platform-python
%else
%define python3_pkg python3
%define python3 %{_bindir}/python3
%endif
%if ! 0%{?py3_ver:1}
%define py3_ver %(%python3 -c "import sys; v=sys.version_info[:2]; print ('%%d.%%d'%%v)" 2>/dev/null || echo PYTHON3-NOT-FOUND)
%endif
# Common info
Name: vulkan-headers
Version: %{realver}
Release: wiz%{?extraver:0.}1%{?dist}
License: Apache-2.0
Group: Development/Languages/C and C++
URL: https://github.com/KhronosGroup/Vulkan-Headers
Summary: Vulkan Header files and API registry
# Install-time parameters
Requires: python(abi) = %{py3_ver}
# Build-time parameters
BuildRequires: cmake pkg-config
BuildRequires: %{python3_pkg}
BuildRoot: %{_tmppath}/%{name}-root
BuildArch: noarch
Source0: https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/v%{realver}.%{srcext}#/%{realname}-%{realver}%{?extraver}.%{srcext}
%description
Vulkan header files and API registry.
# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{realver}%{?extraver}
%build
mkdir build
cd build
cmake .. \
-DCMAKE_INSTALL_PREFIX=%{_prefix}
%{__make} %{?_smp_mflags}
%install
%{__make} -C build install DESTDIR=%{buildroot}
# Fix shebang lines
%{__sed} -ri '1 s|python3|%{python3}|' %{buildroot}%{_datadir}/vulkan/registry/*.py
%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}
%files
%defattr(-,root,root)
%doc README.md
%{_includedir}/vulkan/
%{_includedir}/vk_video/
%dir %{_datadir}/vulkan/registry
%dir %{_datadir}/vulkan
%{_datadir}/vulkan/registry/*
%dir %{_datadir}/cmake
%dir %{_datadir}/cmake/VulkanHeaders
%{_datadir}/cmake/VulkanHeaders/VulkanHeadersConfig.cmake
%{_datadir}/cmake/VulkanHeaders/VulkanHeadersConfigVersion.cmake
%changelog