File caprice32.spec of Package caprice32

#
# spec file for package caprice32
#
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#

%if 0%{?sle_version} && 0%{?sle_version} < 160000
%global force_gcc_version 13
%endif
Name:           caprice32
Version:        4.6.0
Release:        0
Summary:        Amstrad CPC Emulator
License:        GPL-2.0-only
Group:          System/Emulators/Other
# http://www.caprice32.cybercube.com is dead
# http://caprice32.sourceforge.net is dead
URL:            https://github.com/ColinPitrat/caprice32
Source:         %{name}-%{version}.tar.gz
# pkg-config needs libpng16
Patch1:         0001-Use-libpng16-in-pkg-config-call.patch
# prevents aliasing errors
Patch2:         0002-Fix-membank_config-type.patch
# find a good home for cap32.cfg
Patch3:         0003-Add-usr-share-caprice32-as-patch-to-search-for-cap32.patch
BuildRequires:  gcc%{?force_gcc_version}-c++
BuildRequires:  freetype2-devel
BuildRequires:  libSDL2-devel
BuildRequires:  libpng16-devel
BuildRequires:  xorg-x11-Mesa-devel
BuildRequires:  zlib-devel

%description
Caprice32 is a software emulator of the Amstrad CPC 8bit home computer
series. The emulator faithfully imitates the CPC464, CPC664, and CPC6128
models. By recreating the operations of all hardware components at a low
level, the emulator achieves a high degree of compatibility with original
CPC software. These programs or games can be run unmodified at real-time
or higher speeds, depending on the emulator host environment.

%prep
%setup -q -n %{name}-latest
%patch -P 1 -p1
%patch -P 2 -p1
%patch -P 3 -p1

%build
%if 0%{?force_gcc_version}
export CXX="g++-%{?force_gcc_version}"
%endif

APP_PATH=%{_datadir}/%{name} VERSION=%{version} RELEASE=1 CFLAGS="%{optflags}" make %{?_smp_mflags}

%install
# install section
install -D -m 755 cap32 %{buildroot}%{_bindir}/cap32
install -d -m 755 %{buildroot}%{_datadir}/%{name}
cp -a rom %{buildroot}%{_datadir}/%{name}
install -m 644 cap32.cfg %{buildroot}%{_datadir}/%{name}
install -d -m 755 %{buildroot}%{_datadir}/%{name}/resources
install -m 644 resources/*.ttf %{buildroot}%{_datadir}/%{name}/resources
install -m 644 resources/*.bmp %{buildroot}%{_datadir}/%{name}/resources
install -m 644 resources/*.map %{buildroot}%{_datadir}/%{name}/resources

%files
%doc README.md
%license COPYING.txt
%license "licenses/Bitstream Vera License.txt"
%license "licenses/wGui License.txt"

%{_bindir}/cap32
%{_datadir}/caprice32

%changelog
openSUSE Build Service is sponsored by