File duckstation.spec of Package duckstation

#
# spec file for package duckstation
#
# Copyright (c) 2025 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/
#

%if 0%{?sle_version} && 0%{?sle_version} < 160000
%global force_gcc_version 13
%endif
Name:           duckstation
Version:        git.20230414.5fee6f5
Release:        0
Summary:        Sony PlayStation(TM) Emulator
License:        GPL-3.0-or-later
URL:            https://github.com/stenzek/duckstation
Source:         %{name}-%{version}.tar.xz
Patch:          fix-build-error-va_list-has-not-been-declared.patch
BuildRequires:  cmake
BuildRequires:  gcc%{?force_gcc_version}-c++
BuildRequires:  git
BuildRequires:  SDL2-devel
BuildRequires:  gtk3-devel
BuildRequires:  pkgconfig(Qt6Core)
BuildRequires:  pkgconfig(Qt6Gui)
BuildRequires:  pkgconfig(Qt6Linguist)
BuildRequires:  pkgconfig(Qt6Widgets)
BuildRequires:  pkgconfig(Qt6Network)
BuildRequires:  ninja
BuildRequires:  curl-devel
BuildRequires:  libevdev-devel
BuildRequires:  libgbm-devel
BuildRequires:  libdrm-devel
BuildRequires:  alsa-lib-devel
BuildRequires:  libpulse-devel
BuildRequires:  xorg-x11-proto-devel
BuildRequires:  libXrandr-devel
BuildRequires:  libXrender-devel
BuildRequires:  libxkbcommon-devel
BuildRequires:  qt6-concurrent-devel
BuildRequires:  qt6-gui-private-devel

%description
DuckStation is an simulator/emulator of the Sony PlayStation(TM) console, focusing on playability, speed, and long-term maintainability.
The goal is to be as accurate as possible while maintaining performance suitable for low-end devices.
"Hack" options are discouraged, the default configuration should support all playable games with only
some of the enhancements having compatibility issues.

A "BIOS" ROM image is required to to start the emulator and to play games.

%prep
%autosetup -p1 -n %{name}-%{version}

%build
%if 0%{?force_gcc_version}
export CXX="g++-%{?force_gcc_version}"
%endif
%define __builder ninja
%cmake .. \
        -DENABLE_DISCORD_PRESENCE=OFF \
        -DUSE_FBDEV=ON \
        -DBUILD_SHARED_LIBS=OFF \
        -DCMAKE_BUILD_TYPE=Release

%cmake_build

%install
mkdir -p %{buildroot}%{_libexecdir}/%{name}
mv %{_builddir}/%{name}-%{version}/build/bin/* %{buildroot}%{_libexecdir}/%{name}/

mkdir -p %{buildroot}%{_bindir}
ln -s %{_libexecdir}/%{name}/%{name}-qt %{buildroot}%{_bindir}/

install -d -m 0755 %{buildroot}%{_datadir}/pixmaps
ln -s %{_libexecdir}/%{name}/resources/images/duck.png %{buildroot}%{_datadir}/pixmaps/%{name}.png

install -d %{buildroot}%{_datadir}/applications
cat > %{buildroot}%{_datadir}/applications/%{name}.desktop << EOF
[Desktop Entry]
Name=Duckstation
Comment=%{summary}
Exec=%{_bindir}/%{name}-qt
Icon=%{name}
Terminal=false
Type=Application
StartupNotify=true
Categories=Game;Emulator;
EOF

%files
%license LICENSE
%doc NEWS.md README.md
%{_bindir}/%{name}-qt
%{_libexecdir}/%{name}
%{_datadir}/pixmaps/%{name}.png
%{_datadir}/applications/%{name}.desktop

%changelog
openSUSE Build Service is sponsored by