File snes9x.spec of Package snes9x
#
# spec file for package snes9x
#
# Copyright (c) 2025 SUSE LLC
# Copyright (c) 2018–2021 Markus S. <kamikazow@opensuse.org>
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# snes9x needs a compatible c++17 compiler at least
%if 0%{?sle_version} && 0%{?sle_version} < 160000
%global force_gcc_version 13
%endif
Name: snes9x
Version: 1.63
Release: 0
Summary: Portable, freeware Super Nintendo Entertainment System (TM) emulator
License: SUSE-Freeware AND GPL-2.0-only AND GPL-3.0-only AND LGPL-2.0-only AND LGPL-2.1-only
Group: System/Emulators/Other
URL: https://www.snes9x.com/
Source: %{name}-%{version}.tar.xz
Source1: snes9x-gtk.appdata.xml
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: binutils
BuildRequires: cmake
BuildRequires: gcc%{?force_gcc_version}-c++
BuildRequires: fdupes
BuildRequires: freeglut-devel
BuildRequires: hicolor-icon-theme
BuildRequires: intltool
BuildRequires: libdrm-devel
BuildRequires: libepoxy-devel
BuildRequires: libpng-devel
BuildRequires: libxml2-devel
BuildRequires: nasm
BuildRequires: ninja
BuildRequires: pkgconfig
BuildRequires: pkgconfig(alsa)
BuildRequires: pkgconfig(gtk+-3.0)
BuildRequires: pkgconfig(gtkmm-3.0)
BuildRequires: pkgconfig(libpulse)
BuildRequires: pkgconfig(sdl2)
BuildRequires: pkgconfig(xrandr)
BuildRequires: pkgconfig(xv)
BuildRequires: portaudio-devel
Requires: hicolor-icon-theme
%if 0%{?fedora} >= 30
BuildRequires: minizip-compat-devel
%else
BuildRequires: minizip-devel
%endif
%if 0%{?suse_version}
BuildRequires: appstream-glib
%else
BuildRequires: libappstream-glib
%endif
%description
Snes9x is a portable, freeware Super Nintendo Entertainment System
(SNES) emulator. It basically allows you to play most games designed
for the SNES and Super Famicom Nintendo game systems on your PC.
%package -n %{name}-gtk
Summary: Graphical User Interface for snes9x
Group: System/Emulators/Other
%description -n %{name}-gtk
This package adds a GTK graphical user interface to snes9x.
%prep
%autosetup -p1
# On openSUSE, joysticks appear under /dev/input:
%if 0%{?suse_version}
perl -pi -e 's,/dev/js,/dev/input/js,g;' unix/unix.cpp
%endif
%build
%if 0%{?force_gcc_version}
export CXX="g++-%{force_gcc_version}"
%endif
pushd unix
%configure --enable-netplay \
CFLAGS="%{optflags}" CXXFLAGS="%{optflags}"
%make_build
popd
pushd gtk
%define __builder ninja
%cmake
%cmake_build
popd
%install
# Install CLI version
mkdir -p %{buildroot}%{_bindir}
install -m 755 unix/snes9x %{buildroot}%{_bindir}
# Install AppData file
install -d %{buildroot}%{_datadir}/metainfo
install -p -m 644 %{SOURCE1} %{buildroot}%{_datadir}/metainfo
appstream-util validate-relax --nonet %{buildroot}%{_datadir}/metainfo/*.appdata.xml
pushd gtk
%cmake_install
popd
%find_lang snes9x-gtk
%files
%doc docs/*
%doc unix/docs/readme_unix.html
%license LICENSE
%{_bindir}/%{name}
%files gtk -f %{name}-gtk.lang
%license LICENSE
%doc gtk/AUTHORS
%{_bindir}/%{name}-gtk
%{_datadir}/%{name}
%{_datadir}/metainfo/%{name}-gtk.appdata.xml
%{_datadir}/applications/%{name}-gtk.desktop
%{_datadir}/icons/hicolor/*/apps/snes9x.png
%{_datadir}/icons/hicolor/scalable/apps/snes9x.svg
%changelog