File dolphin-emu.spec of Package dolphin-emu

# spec file for package dolphin-emu
# Copyright (c) 2023 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

%define commit 8bad821019721b9b72701b495da95656ace5fea5
Name:           dolphin-emu
Version:        5.0.17995
Release:        0
Summary:        Dolphin, a GameCube and Wii Emulator
License:        (Apache-2.0 OR MIT) AND BSD-2-Clause AND libpng-2.0 AND GPL-2.0-or-later
# n=dolphin-emu && v=5.0.17995 && c=8bad821019721b9b72701b495da95656ace5fea5 && cd /tmp && git clone$n/dolphin.git $n && cd $n && git checkout $c && rm -rf .??* && cd .. && n=dolphin-emu && d=$n-$v && mv $n $d && f=$d.tar.xz && tar c --remove-files "$d" | xz -9e > "$f"
Source0:        %{name}-%{version}.tar.xz
Patch0:         %{name}-not-discord-presence.patch
BuildRequires:  cmake
BuildRequires:  fdupes
BuildRequires:  gcc12
BuildRequires:  gcc12-c++
BuildRequires:  hicolor-icon-theme
BuildRequires:  libQt5Gui-private-headers-devel >= 5.9
BuildRequires:  mbedtls-devel < 3
BuildRequires:  ninja
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(Qt5Widgets) >= 5.9
BuildRequires:  pkgconfig(alsa)
BuildRequires:  pkgconfig(bluez)
BuildRequires:  pkgconfig(bzip2)
BuildRequires:  pkgconfig(fmt) >= 6.0
BuildRequires:  pkgconfig(hidapi-hidraw)
BuildRequires:  pkgconfig(jack)
BuildRequires:  pkgconfig(libavcodec)
BuildRequires:  pkgconfig(libavformat)
BuildRequires:  pkgconfig(libavutil)
BuildRequires:  pkgconfig(libcurl)
BuildRequires:  pkgconfig(libenet)
BuildRequires:  pkgconfig(libevdev)
BuildRequires:  pkgconfig(liblzma)
BuildRequires:  pkgconfig(libpng)
BuildRequires:  pkgconfig(libpulse)
BuildRequires:  pkgconfig(libswscale)
BuildRequires:  pkgconfig(libsystemd)
BuildRequires:  pkgconfig(libudev)
BuildRequires:  pkgconfig(libusb-1.0)
BuildRequires:  pkgconfig(libxxhash)
BuildRequires:  pkgconfig(libzstd)
BuildRequires:  pkgconfig(lzo2)
BuildRequires:  pkgconfig(miniupnpc)
BuildRequires:  pkgconfig(minizip)
BuildRequires:  pkgconfig(pugixml)
BuildRequires:  pkgconfig(sfml-network)
BuildRequires:  pkgconfig(sfml-system)
BuildRequires:  pkgconfig(sm)
BuildRequires:  pkgconfig(soundtouch)
BuildRequires:  pkgconfig(xi)
BuildRequires:  pkgconfig(xrandr)
Requires:       nintendo-gamecube-wiimote-udev-rules
ExclusiveArch:  x86_64 aarch64

Dolphin is an emulator for two Nintendo video game consoles, GameCube and the Wii.
It allows PC gamers to enjoy games for these two consoles in full HD with several
enhancements such as compatibility with all PC controllers, turbo speed,
networked multiplayer, and more.
Most games run perfectly or with minor bugs.

%package -n nintendo-gamecube-wiimote-udev-rules
Summary:        Udev rules for Nintendo GameCube and Wiimote game controllers
Requires:       udev
BuildArch:      noarch

%description -n nintendo-gamecube-wiimote-udev-rules
This package contains udev rules for Nintendo GameCube and Wiimote game controllers.


%autosetup -p1
#Allow building with cmake macro. Build failed on aarch64 with optflags.
%ifarch x86_64
sed -i '/CMAKE_C.*_FLAGS/d' CMakeLists.txt
sed -i 's/minizip>=2.0.0/minizip/' CMakeLists.txt

# FIXME: you should use the %%cmake macros
cmake . \
    -LA \
    -DCMAKE_BUILD_TYPE=RelWithDebInfo \
    -DCMAKE_C_COMPILER=gcc-12 \
    -DCMAKE_C_FLAGS="%{optflags}" \
    -DCMAKE_CXX_FLAGS="%{optflags}" \
    -DCMAKE_INSTALL_PREFIX=%{_prefix} \
    -DDOLPHIN_WC_DESCRIBE=%{version} \
    -DDOLPHIN_WC_REVISION=%{commit} \
    -G Ninja
ninja -v

DESTDIR=%{buildroot} ninja install
sed -i 's/^Exec=.*/Exec=%{name}/' %{buildroot}%{_datadir}/applications/%{name}.desktop
install -Dpm0644 Data/51-usb-device.rules %{buildroot}%{_udevrulesdir}/51-nintendo-gamecube-wiimote.rules
%fdupes -s %{buildroot}
%find_lang %{name}

%files lang -f %{name}.lang

%license COPYING
%attr(0755,root,root) %{_bindir}/%{name}*
%attr(0755,root,root) %{_bindir}/dolphin-tool

%files -n nintendo-gamecube-wiimote-udev-rules

openSUSE Build Service is sponsored by