File dxvk-gplasync.spec of Package dxvk-gplasync-x86-64-v3

#
# spec file for package dxvk-gplasync
#
# Copyright (c) 2024 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 https://bugs.opensuse.org/
#


Name:           dxvk-gplasync-x86-64-v3
Version:        2.4.1
Release:        0
Summary:        Vulkan-based Direct3D 8/9/10/11 implementation for Linux / Wine
License:        zlib-acknowledgement
Group:          System/Emulators/PC
URL:            https://github.com/doitsujin/dxvk
Source0:        dxvk-%{version}.tar.gz
Source1:        baselibs.conf
Source2:        setup_dxvk.sh
Patch1:         https://gitlab.com/Ph42oN/dxvk-gplasync/-/raw/main/patches/dxvk-gplasync-2.4-1.patch?ref_type=heads&inline=false#/dxvk-gplasync-2.4-1.patch
Patch2:         https://gitlab.com/Ph42oN/dxvk-gplasync/-/raw/main/patches/global-dxvk.conf.patch?ref_type=heads&inline=false#/global-dxvk.conf.patch
Provides:       dxvk
Conflicts:      dxvk
Provides:       dxvk-gplasync
Conflicts:      dxvk-gplasync

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:       dxvk-gplasync-x86-64-v3-32bit
%else
BuildRequires:  mingw32-cross-cpp
BuildRequires:  mingw32-cross-gcc
BuildRequires:  mingw32-cross-gcc-c++
BuildRequires:  mingw32-headers
%endif
ExclusiveArch:  %{ix86} x86_64

%description
A Vulkan-based translation layer for Direct3D 8/9/10/11 which allows running 3D applications on Linux using Wine.

%prep
%autosetup -n dxvk-%{version}

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

mkdir ../build

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

cd ../build
ninja

%install

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

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

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

%files
%defattr(644,root,root)
%doc README.md
%license LICENSE

%{_bindir}/winedxvk
%dir %{_libexecdir}/dxvk
%{_libexecdir}/dxvk/%{_lib}
%attr(755, root, root) %{_libexecdir}/dxvk/bin

%changelog
openSUSE Build Service is sponsored by