File ishiiruka-dolphin.spec of Package ishiiruka-dolphin

# Spec file for package Ishiiruka-Dolphin Emulator
# Copyright © 2014–2019 Markus S. <>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <>.

%define _localname ishiiruka
%define _prettyname Ishiiruka-Dolphin
%define _descAddendum This version differs from official Dolphin by prioritizing gaming performance over emulation accuracy.
%define _cxx g++

Name:             ishiiruka-dolphin-unstable
Summary:          %{_prettyname}, a GameCube and Wii Emulator
Version:          5.0.0
Release:          0
Group:            System/Emulators/Other
License:          GPL-2.0-or-later
Source0:          %{name}-%{version}.tar.xz
Source1:          dolphin-emu.png
Source2:          dolphin-emu.appdata.xml
ExclusiveArch:    x86_64
Obsoletes:        ishiiruka-dolphin-unstable < %{version}

# Package names verified with Fedora and openSUSE.
# Should the packages in your distro be named differently,
# see
# All other distros should work as well as Dolphin bundles
# its dependencies for static linking.

BuildRequires:    binutils gcc gcc-c++
BuildRequires:    cmake >= 2.8
BuildRequires:    desktop-file-utils
BuildRequires:    libevdev-devel
BuildRequires:    libSM-devel
BuildRequires:    libcurl-devel
BuildRequires:    lzo-devel
BuildRequires:    mbedtls-devel
BuildRequires:    pkgconfig(alsa)
BuildRequires:    pkgconfig(ao)
BuildRequires:    pkgconfig(bluez)
BuildRequires:    pkgconfig(gl)
BuildRequires:    pkgconfig(harfbuzz)
BuildRequires:    pkgconfig(libpng)
BuildRequires:    pkgconfig(libpulse)
BuildRequires:    pkgconfig(libudev)
BuildRequires:    pkgconfig(libusb-1.0)
BuildRequires:    pkgconfig(sdl2)
BuildRequires:    pkgconfig(sfml-all)
BuildRequires:    pkgconfig(soundtouch)
BuildRequires:    pkgconfig(xi)
BuildRequires:    pkgconfig(xext)
BuildRequires:    pkgconfig(xinerama)
BuildRequires:    pkgconfig(xrandr)
BuildRequires:    pkgconfig(xxf86vm)
BuildRequires:    pkgconfig(zlib)
BuildRequires:    sed
## wx GUI
BuildRequires:    gtk2-devel

%if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version}
BuildRequires:    gettext
BuildRequires:    gtest-devel
BuildRequires:    hidapi-devel
BuildRequires:    libappstream-glib
BuildRequires:    miniupnpc-devel
BuildRequires:    SOIL-devel

%if 0%{?suse_version}
BuildRequires:    appstream-glib
BuildRequires:    googletest-devel
BuildRequires:    libhidapi-devel
BuildRequires:    libminiupnpc-devel
BuildRequires:    update-desktop-files
#BuildRequires:    pkgconfig(libavcodec)
#BuildRequires:    pkgconfig(libavformat)
#BuildRequires:    pkgconfig(libavutil)
#BuildRequires:    pkgconfig(libswscale)

## wx GUI
#BuildRequires:    wxWidgets-3_2-devel

# Not in default repos:
BuildRequires:    libSOIL-devel

Recommends:       dolphin-emu-udevrules
Requires(post):   hicolor-icon-theme
Requires(postun): hicolor-icon-theme

%if 0%{?fedora} > 26
%undefine _debugsource_packages

%{_prettyname} is an emulator for Nintendo GameCube and 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 lang
Summary:          Translations for %{_prettyname} Emulator
BuildArch:        noarch

%description lang
Translations into various languages for %{_prettyname} Emulator

%files lang

%setup -q -n %{name}-%{version}

export CCFLAGS='%{optflags}'

# CMake options:
# - ENABLE_ALSA: ALSA sound back-end (on by default, crashes Qt port)
# - ENABLE_ANALYTICS: Analytics on (turn off for forks)
# - ENABLE_OPENAL: OpenAL off (stuttering sound)
# - ENABLE_QT2: Qt GUI (on by default, turn off for wx-only builds)
# - ENABLE_WX: wxWidgets GUI (on by default)
# - DOLPHIN_WC_REVISION: Set vesion number for About window
# - DOLPHIN_WC_BRANCH: Set branch name for About window (usually set to "master")

cmake \
      -DCMAKE_CXX_COMPILER=%{_cxx} \
      -DENABLE_QT2=OFF \
      -DDOLPHIN_WC_REVISION=%{version} \
      -DDOLPHIN_WC_BRANCH=master \
      -DCMAKE_BUILD_TYPE=Release \
      -DCMAKE_INSTALL_PREFIX=%{_prefix} \
make -j1

export CCFLAGS='%{optflags}'
make %{?_smp_mflags} install DESTDIR="%{?buildroot}"

# Delete static libraries
cd ..
find %{buildroot} -name '*.a' -delete
# Delete dev files
rm -rf %{buildroot}%{_includedir}/

# Use current icon
rm -rf %{buildroot}%{_datadir}/icons/hicolor/scalable
install -Dm 755 %{S:1} "%{buildroot}/%{_datadir}/icons/hicolor/512x512/apps/%{_localname}.png"

# Install appdata.xml
install -p -D -m 0644 %{S:2} %{buildroot}/%{_datadir}/appdata/%{_localname}.appdata.xml

appstream-util validate-relax --nonet %{buildroot}/%{_datadir}/appdata/*.appdata.xml

/bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :

if [ $1 -eq 0 ] ; then
    /bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null
    /usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :

/usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :

rm -rf %{buildroot}

%doc license.txt