File vulkan.spec of Package vulkan

#
# spec file for package vulkan
#
# Copyright (c) 2018 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.65.0

Name:           vulkan
%define lname	libvulkan1
Version:        1.0.65.0
Release:        0
Summary:        Vulkan loader and validation layers
License:        MIT
Group:          Development/Libraries/C and C++
Url:            http://www.khronos.org/

Source:         Vulkan-LoaderAndValidationLayers-%version.tar.xz
Source9:        baselibs.conf
BuildRequires:  bison
BuildRequires:  cmake >= 2.8.11
BuildRequires:  gcc-c++ >= 4.8
BuildRequires:  glslang-devel >= 3.0
BuildRequires:  libpciaccess-devel
BuildRequires:  pkg-config
BuildRequires:  python3
BuildRequires:  spirv-tools-devel
BuildRequires:  systemd-devel
BuildRequires:  pkgconfig(wayland-client)
BuildRequires:  pkgconfig(wayland-cursor)
BuildRequires:  pkgconfig(wayland-egl)
BuildRequires:  pkgconfig(wayland-server)
BuildRequires:  pkgconfig(x11)
BuildRequires:  pkgconfig(xcb)
BuildRequires:  pkgconfig(xkbcommon)
BuildRequires:  pkgconfig(xrandr)

%description
Vulkan is a 3D graphics and compute API providing cross-platform
access to modern GPUs with low overhead and targeting 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
# for config files
Group:          System/Libraries
Requires:       %name

%description -n %lname
Vulkan is a 3D graphics and compute API providing cross-platform
access to modern GPUs with low overhead and targeting 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 3D graphics and compute API providing cross-platform
access to modern GPUs with low overhead and targeting 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

%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 \
	-DCMAKE_INSTALL_SYSCONFDIR="%_sysconfdir" \
	-DBUILD_WSI_MIR_SUPPORT=OFF
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
mkdir -p "$b/%_bindir"
cp -a build/demos/cube "$b/%_bindir/vkcube"
cp -a build/demos/cubepp "$b/%_bindir/vkcubepp"

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

%files
%defattr(-,root,root)
%_bindir/*
%dir %_sysconfdir/vulkan/
%config %_sysconfdir/vulkan/explicit_layer.d/
%dir %_sysconfdir/vulkan/icd.d/
%_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
%_libdir/pkgconfig/vulkan.pc

%changelog
openSUSE Build Service is sponsored by