File prosystem.spec of Package prosystem

#
# spec file for package prosystem
#
# Copyright (c) 2020 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/
#


Name:           prosystem
Version:        1.0.2
Release:        0
Summary:        Atari 7800 Emulator
License:        GPL-2.0-or-later
Source:         7800-v%{version}-src.zip
Source1:        7800-v%{version}-bin.zip
Patch0:         7800-v%{version}.dif
Patch1:         7800-cpp.patch
BuildRequires:  dos2unix
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  unzip
BuildRequires:  pkgconfig(SDL_image)
BuildRequires:  pkgconfig(SDL_mixer)
BuildRequires:  pkgconfig(SDL_ttf)
BuildRequires:  pkgconfig(libjpeg)
BuildRequires:  pkgconfig(libpng)
BuildRequires:  pkgconfig(xext)
BuildRequires:  pkgconfig(zlib)

%description
This port targets the GP2X handheld, so the key assignment is a bit odd. Try the numpad and A/S/Z/X.

%prep
%setup -q -a1 -n 7800-v%{version}
%patch0
%patch1
dos2unix *.txt
chmod -x *.txt
pushd 7800-v%{version}/game/7800
chmod -x ProSystem.dat help.txt kbd/foo.txt scr/foo.txt set/foo.txt
popd

%build
cd src
%make_build -f Makefile-linux DEFAULT_CFLAGS="%{optflags} `sdl-config --cflags`"

%install
mkdir -pv %{buildroot}%{_prefix}/lib/prosystem
cp -a 7800-v*/game/7800/* %{buildroot}%{_prefix}/lib/prosystem
rm -fr %{buildroot}%{_prefix}/lib/prosystem/{roms,*.gpe}
install -m 755 src/gp2x7800 %{buildroot}%{_prefix}/lib/prosystem
mkdir -p %{buildroot}%{_bindir}
cat <<EOT >%{buildroot}%{_bindir}/prosystem
#!/bin/sh
if test ! -e \$HOME/.prosystem
then
  mkdir \$HOME/.prosystem
  ln -s %{_prefix}/lib/prosystem/* \$HOME/.prosystem
  mkdir \$HOME/.prosystem/roms
fi
cd \$HOME/.prosystem
./gp2x7800 "\$@"
EOT
%fdupes %{buildroot}

%files
%doc *.txt
%attr(0755, root, root) %{_bindir}/prosystem
%{_prefix}/lib/prosystem

%changelog
openSUSE Build Service is sponsored by