File vulkan.spec of Package vulkan

#
# spec file for package vulkan
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#


%define version_unconverted 1.0.3.g5493

Name:           vulkan
%define lname	libvulkan1
Version:        1.0.3.g5493
Release:        0
Summary:        Vulkan loader and validation layers
License:        MIT
Group:          System/Libraries
Url:            http://www.khronos.org/

Source:         Vulkan-LoaderAndValidationLayers-%version.tar.xz
Patch1:         0001-loader-Add-install-rule.patch
Patch2:         0001-vkjson-don-t-clobber-cflags-or-you-ll-lose-fPIC.patch
Patch3:         0001-layers-Install-to-CMAKE_INSTALL_LIBDIR.patch
BuildRequires:  ImageMagick-devel
BuildRequires:  bison
BuildRequires:  cmake >= 2.8.11
BuildRequires:  gcc-c++ >= 4.8
BuildRequires:  glslang-devel
BuildRequires:  libpciaccess-devel
BuildRequires:  pkg-config
BuildRequires:  python3
BuildRequires:  spirv-tools-devel
BuildRequires:  systemd-devel
BuildRequires:  pkgconfig(x11)
BuildRequires:  pkgconfig(xcb)

%description
Vulkan is a new-generation 3D graphics and compute API providing
cross-platform access to modern GPUs with low overhead and targeting
high-performance realtime graphics applications such as games and
interactive media.

This package contains the reference ICD loader and validation layers
for Vulkan.

%package -n %lname
Summary:        The Vulkan 3D graphics and compute API
Group:          System/Libraries
# for config files
Requires:       %name

%description -n %lname
Vulkan is a new-generation 3D graphics and compute API providing
cross-platform access to modern GPUs with low overhead and targeting
high-performance realtime graphics applications such as games and
interactive media.

%package devel
Summary:        Vulkan development package
Group:          Development/Libraries/C and C++
Requires:       %lname = %version-%release

%description devel
Vulkan is a new-generation 3D graphics and compute API providing
cross-platform access to modern GPUs with low overhead and targeting
high-performance realtime graphics applications such as games and
interactive media.

This subpackage contains the development headers for packages wanting
to make use of Vulkan.

%prep
%setup -qn Vulkan-LoaderAndValidationLayers-%version
%patch -P 1 -P 2 -P 3 -p1

%build
chmod a-x *.md *.txt
perl -i -pe 's{inttypes\.h}{cinttypes}g' layers/*.cpp layers/*.h *.py
mkdir -p ../glslang/install/bin ../glslang/build/install
ln -sv /usr/bin/glslangValidator ../glslang/install/bin/
ln -Tsv "%_libdir" ../glslang/build/install/lib
%cmake -DSPIRV_TOOLS_LIB="%_libdir/libSPIRV-Tools-1.1.so"
make %{?_smp_mflags} 

%install
b="%buildroot"
%cmake_install
mkdir -p "$b/%_bindir" "$b/%_includedir" \
	"$b/%_datadir/vulkan/implicit_layer.d" \
	"$b/%_datadir/vulkan/explicit_layer.d" \
	"$b/%_sysconfdir/vulkan/icd.d"
install -pm0755 build/demos/vulkaninfo "$b/%_bindir/vulkaninfo"
cp -a include/vulkan "$b/%_includedir/"
cp -a layers/linux/*.json "$b/%_datadir/vulkan/explicit_layer.d/"
rm -f "$b/%_datadir/vulkan/explicit_layer.d"/*implicit*
for i in "$b/%_datadir/vulkan/explicit_layer.d"/*.json; do
	perl -i -pe 's{"\./lib}{"lib}g' "$i"
done

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

%files
%defattr(-,root,root)
%_bindir/*
%dir %_sysconfdir/vulkan/
%dir %_sysconfdir/vulkan/icd.d/
%_datadir/vulkan/

%files -n libvulkan1
%defattr(-,root,root)
%doc README.md LICENSE.txt
%_libdir/libVkLayer*.so
%_libdir/libvulkan.so.1*

%files devel
%defattr(-,root,root)
%_includedir/vulkan/
%_libdir/libvulkan.so

%changelog
openSUSE Build Service is sponsored by