# sameboy will use clang if it can
# here is a global override that also
# sets build requirements
%global COMPILER gcc
Name: SameBoy
Version: 0.14.2
Release: 1%{?dist}
Summary: Game Boy and Game Boy Color emulator written in C
License: MIT
URL: https://sameboy.github.io/
Source0: https://github.com/LIJI32/SameBoy/archive/v%{version}.tar.gz
# Remove in next SameBoy release
# https://github.com/LIJI32/SameBoy/pull/370
Patch0: 0001-replace-PREFIX-share-sameboy-with-DATA_DIR.patch
# https://github.com/LIJI32/SameBoy/pull/371
Patch1: 0002-Correct-usage-of-PREFIX-with-DATA_DIR.patch
BuildRequires: %{COMPILER}
BuildRequires: make
BuildRequires: rgbds
BuildRequires: SDL2-devel
BuildRequires: desktop-file-utils
%description
SameBoy is an open source Game Boy (DMG) and Game Boy Color (CGB) emulator,
written in portable C. It has a native Cocoa front-end for MacOS,
an SDL front-end for other operating systems, and a libretro core.
It also includes a text-based debugger with expression evaluation.
%prep
%autosetup -n SameBoy-%{version}
%build
export CC=%{COMPILER}
%make_build sdl FREEDESKTOP=true \
PREFIX=%{_prefix} \
DATA_DIR=%{_datadir}/%{name}/
%install
%{__mkdir_p} %{buildroot}/%{_bindir}
%{__mkdir_p} %{buildroot}/%{_datadir}
export CC=%{COMPILER}
%make_install FREEDESKTOP=true \
PREFIX=%{_prefix} \
DATA_DIR=%{_datadir}/%{name}/
cd FreeDesktop
mv sameboy.desktop sameboy-terminal.desktop
desktop-file-install \
--set-name='SameBoy (Terminal)' \
--set-key=Terminal --set-value='true' \
--dir=%{buildroot}/%{_datadir}/applications \
sameboy-terminal.desktop
%files
%dir %{_datadir}/%{name}
%{_bindir}/sameboy
%{_datadir}/%{name}/*.bin
%{_datadir}/%{name}/*.sym
%{_datadir}/%{name}/background.bmp
%{_datadir}/%{name}/Shaders/*.fsh
%{_datadir}/%{name}/LICENSE
%{_datadir}/applications/sameboy.desktop
%{_datadir}/applications/sameboy-terminal.desktop
%{_datadir}/mime/packages/sameboy.xml
%{_datadir}/icons/hicolor/
%license LICENSE
%doc README.md
%changelog
* Thu Mar 25 2021 Jan Drögehoff <sentrycraft123@gmail.com> - 0.14.2-1
- Initial spec