File yuzu.spec of Package yuzu

#
# spec file for package yuzu
#
# Copyright © 2017–2018 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright © 2017–2020 Markus S. <kamikazow@opensuse.org>
#
# 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
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# 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 <http://www.gnu.org/licenses/>.
#

%define _cxx g++

Name:               yuzu
Version:            mainline0313
Release:            0
Summary:            Nintendo Switch emulator/debugger
License:            GPL-2.0-only
Group:              System/Emulators/Other
Url:                https://yuzu-emu.org/
Source0:            %{name}-%{version}.tar.xz
ExclusiveArch:      x86_64

BuildRequires:      cmake >= 3.6
BuildRequires:      boost-devel
BuildRequires:      binutils gcc gcc-c++
BuildRequires:      vulkan-devel
BuildRequires:      pkgconfig(libcurl)
BuildRequires:      pkgconfig(libpng)
BuildRequires:      pkgconfig(Qt5Core)
BuildRequires:      pkgconfig(Qt5Widgets)
BuildRequires:      pkgconfig(Qt5OpenGL)
BuildRequires:      pkgconfig(sdl2)
BuildRequires:      python

%if 0%{?fedora} || 0%{?centos_version} || 0%{?rhel_version}
BuildRequires:      ninja-build
%endif
%if 0%{?suse_version}
BuildRequires:      libQt5PlatformSupport-private-headers-devel
BuildRequires:      ninja
%endif

# Ignore compiler warnings (for now)
BuildRequires:      -post-build-checks

Requires(post):     hicolor-icon-theme
Requires(postun):   hicolor-icon-theme
Requires(post):     shared-mime-info
Requires(postun):   shared-mime-info
%if 0%{?suse_version}
BuildRequires:      libQt5Concurrent-devel
Requires(post):     update-desktop-files
Requires(postun):   update-desktop-files
%endif

%description
yuzu is an open source Nintendo Switch emulator/debugger.

%prep
%setup -q

# Enforce package versioning in GUI
sed -i \
-e 's|@GIT_REV@|%{release}|g' \
-e 's|@GIT_BRANCH@|master|g' \
-e 's|@GIT_DESC@|%{version}|g' \
-e 's|@BUILD_NAME@|%{name}|g' \
src/common/scm_rev.cpp.in

# Avoid submodule checks as OBS ensures source consistency
sed -i 's|check_submodules_present()||g' CMakeLists.txt

%build
mkdir build
cd build

cmake .. \
        -G "Ninja" \
        -DCMAKE_BUILD_TYPE=Release \
        -DENABLE_CUBEB=ON \
        -DCMAKE_CXX_COMPILER=%{_cxx} \
        -DCMAKE_INSTALL_PREFIX="%{_prefix}" \
        -DCMAKE_INSTALL_LIBEXEC="%_libexecdir" \
        -DUSE_PCH=OFF -DENABLE_PCH=OFF \
        -DENABLE_PRECOMPILED_HEADERS=OFF \
        -DSKIP_PRECOMPILE_HEADERS=ON \
        -DUSE_PRECOMPILED_HEADERS=OFF \
        -DYUZU_USE_QT_WEB_ENGINE=OFF \
        -DUSE_SYSTEM_CURL="ON"

ninja -v

%install
cd build
DESTDIR=%{buildroot} ninja install

# Delete leftover development files
rm -rf %{?buildroot}%{_includedir}

%post
%if 0%{?suse_version}
%desktop_database_post
%icon_theme_cache_post
%mime_database_post
%endif

%postun
%if 0%{?suse_version}
%desktop_database_postun
%icon_theme_cache_postun
%mime_database_postun
%endif

%files
%defattr(-,root,root)
%doc README.md CONTRIBUTING.md
%license license.txt
%attr(755, root, root) %{_bindir}/%{name}
%attr(755, root, root) %{_bindir}/%{name}-cmd
%attr(755, root, root) %{_bindir}/%{name}-tester
%{_datadir}/applications/%{name}.desktop
%{_datadir}/mime/packages/%{name}.xml
%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg

%changelog
openSUSE Build Service is sponsored by