File bsnes-hd.spec of Package bsnes-hd

#
# Spec file for package bsnes
#
# Copyright © 2018–2019 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:             bsnes-hd
Summary:          Super Nintendo Emulator
Version:          master
Release:          1
Group:            System/Emulators/Other

# https://github.com/byuu/bsnes/blob/master/LICENSE.txt
License:          GPL-3.0-only
URL:              https://github.com/DerKoun/bsnes-hd
Source0:          %{name}-%{version}.tar.xz
Source1:          bsnes-hd.desktop
BuildRequires:    gcc gcc-c++
BuildRequires:    hicolor-icon-theme
BuildRequires:    sed
BuildRequires:    update-desktop-files
BuildRequires:    pkgconfig(alsa)
BuildRequires:    pkgconfig(ao)
BuildRequires:    pkgconfig(cairo)
BuildRequires:    pkgconfig(gl)
BuildRequires:    pkgconfig(gtk+-2.0)
BuildRequires:    pkgconfig(gtksourceview-2.0)
BuildRequires:    pkgconfig(libpulse)
BuildRequires:    pkgconfig(libudev)
BuildRequires:    pkgconfig(openal)
BuildRequires:    pkgconfig(sdl2)
BuildRequires:    pkgconfig(xext)
BuildRequires:    pkgconfig(xi)
BuildRequires:    pkgconfig(xinerama)
BuildRequires:    pkgconfig(xrandr)
BuildRequires:    pkgconfig(xxf86vm)
BuildRequires:    pkgconfig(xv)

Provides:  bsnes

# Ignore compiler warnings
BuildRequires:    -post-build-checks
Requires(post):   hicolor-icon-theme
Requires(postun): hicolor-icon-theme

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

%description
bsnes-hd is a fork of bsnes that adds HD video features.
%prep
%setup -q
sed -i "/flags += -march=native/d" ./bsnes/GNUmakefile

%build
export CCFLAGS='%{optflags}'
make %{?_smp_mflags} -C bsnes compiler="%{_cxx}" platform="linux"

%install
export CCFLAGS='%{optflags}'
make prefix=%{buildroot}/bsnesbuild -C bsnes install
install -D -m 0775 %{buildroot}/bsnesbuild/bin/bsnes %{buildroot}/%{_bindir}/bsnes-hd
mkdir -p %{buildroot}%{_datadir}
mv %{buildroot}/bsnesbuild/share/bsnes/ %{buildroot}%{_datadir}/bsnes-hd/
desktop-file-install --dir %{buildroot}%{_datadir}/applications %{SOURCE1}
# Icon installed in wrong directory by default
install -d %{buildroot}/%{_datadir}/icons/hicolor/256x256/apps/
mv %{buildroot}/bsnesbuild/share/icons/bsnes.png %{buildroot}/%{_datadir}/icons/hicolor/256x256/apps/bsnes-hd.png
# Tell RPM build to shut up
rm -rf %{buildroot}/bsnesbuild

%clean
rm -rf %{buildroot}

%files
%{_bindir}/bsnes-hd*
%{_datadir}/bsnes-hd
%{_datadir}/applications/bsnes-hd.desktop
%{_datadir}/icons/hicolor/*/apps/bsnes-hd.png

%changelog
openSUSE Build Service is sponsored by