File dxvk.spec of Package dxvk

# spec file for package dxvk
# Copyright (c) 2020 SUSE LLC
# 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

Name:           dxvk
Version:        1.8.1
Release:        0
Summary:        Vulkan-based D3D11 implementation for Linux / Wine
License:        zlib-acknowledgement
Group:          System/Emulators/PC
Source1:        baselibs.conf

BuildRequires:  gcc
BuildRequires:  gcc-c++
BuildRequires:  glslang-devel
BuildRequires:  meson
BuildRequires:  ninja
BuildRequires:  wine
BuildRequires:  xz

%ifarch x86_64
BuildRequires:  mingw64-cross-cpp
BuildRequires:  mingw64-cross-gcc
BuildRequires:  mingw64-cross-gcc-c++
BuildRequires:  mingw64-headers

#Require 32bit version
Requires:       %{name}-32bit
BuildRequires:  mingw32-cross-cpp
BuildRequires:  mingw32-cross-gcc
BuildRequires:  mingw32-cross-gcc-c++
BuildRequires:  mingw32-headers

Provides a Vulkan-based implementation of DXGI and D3D11 in order to run 3D applications on Linux using Wine

%setup -q

export CFLAGS="%optflags -DNDEBUG -fPIC -O2 -pthread -fno-strict-aliasing -fpredictive-commoning -fuse-linker-plugin -fno-stack-protector -fno-stack-clash-protection"
export CXXFLAGS="${CFLAGS} -fpermissive"
export LDFLAGS="-fPIC -Wl,--sort-common -Wl,--gc-sections -Wl,-O1 -fuse-linker-plugin"

mkdir ../build

meson \
    --cross-file build-win$(arch | tail -c 3 | sed 's|86|32|g').txt \
    --strip \
    --buildtype "release" \
    --unity off \
    --prefix /%{name} \

cd ../build


#install wrapper scripts
mkdir -p %{buildroot}%{_bindir} %{buildroot}%{_libexecdir}/%{name}/bin
sed \
    -e 's|basedir=.*|basedir="%{_libexecdir}/%{name}"|g' \
    -e 's|x32|lib|g' -e 's|x64|lib64|g' \ > %{buildroot}%{_libexecdir}/%{name}/bin/
ln -s %{_libexecdir}/%{name}/bin/ %{buildroot}%{_bindir}/wine%{name}

#install dxvk proper
cd ../build
DESTDIR=%{buildroot}%{_libexecdir} ninja install

%ifarch x86_64
if [ -d %{buildroot}%{_libexecdir}/%{name}/lib ];then
    mv %{buildroot}%{_libexecdir}/%{name}/lib %{buildroot}%{_libexecdir}/%{name}/%{_lib}
rm %{buildroot}%{_libexecdir}/%{name}/%{_lib}/*.dll.a && \
mv %{buildroot}%{_libexecdir}/%{name}/bin/*.dll %{buildroot}%{_libexecdir}/%{name}/%{_lib}/

%license LICENSE

%dir %{_libexecdir}/%{name}
%attr(755, root, root) %{_libexecdir}/%{name}/bin

openSUSE Build Service is sponsored by