File asciiportal.spec of Package asciiportal

#
# spec file for package asciiportal
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright Vincent Petry <PVince81@yahoo.fr>
#
# 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 http://bugs.opensuse.org/
#


%define _pdcurses PDCurses-3.4

Name:           asciiportal
BuildRequires:  SDL-devel
BuildRequires:  SDL_mixer-devel
BuildRequires:  dos2unix
BuildRequires:  gcc-c++
Summary:        ASCII sidescroller with portals
License:        MIT
Group:          Amusements/Games/Action/Arcade
Version:        1.2c
Release:        0
# Downloaded from http://cymonsgames.com/asciiportal/
# Extracted the archive.
# Repacked as tar.bz2
Source:         %{name}-%{version}.tar.bz2
# Downloaded from http://sourceforge.net/projects/pdcurses/files/pdcurses/3.4/PDCurses-3.4.tar.gz/download
# The game compiles statically against this library. PDCurses can't be compiled as shared libraries without
# a lot of changes (TODO).
# The license of the SDL version of PDCurses is Public Domain.
# The following subdirs in the archive are removed: dos, x11, win32, os2,
# then repacked as tar.bz2.
Source1:        %{_pdcurses}.tar.bz2
Source2:        %{name}-wrapper.sh
Source3:        LICENSE.txt
Source4:        %{name}.desktop
Source5:        %{name}.png
Patch0:         %{name}-Makefile.patch
Url:            http://cymonsgames.com/asciiportal/
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} > 1020
BuildRequires:  fdupes
%endif
%if 0%{?suse_version}
BuildRequires:  update-desktop-files
%endif

%description
ASCIIpOrtal is an ASCII sidescroller. In the game, you have a gun that fires portals, or links between parts of the level. It contains 50 mind-bending levels, and user-created levels are frequently submitted on the forum.

%prep
%setup -q -a 1
%patch0 -p0
sed -i 's/__DATE__/"%{version}"/' menu.cpp ap_draw.cpp

cp %{S:3} .
dos2unix *.txt

%build
cp %{S:1} .

make -f ASCIIpOrtal-linux-Makefile.txt

%install
install -m 755 -D -d %{buildroot}/%{_bindir}/
# Install wrapper
install -m 755 -D %{S:2} %{buildroot}/%{_bindir}/%{name}
# Install real binary
install -m 755 -D %{name} %{buildroot}/%{_bindir}/%{name}-bin
# Install maps and media
install -m 755 -D -d %{buildroot}/%{_datadir}/%{name}/
cp -R challengeme evil maps masterlevels media raisonbran648 %{buildroot}/%{_datadir}/%{name}/

# Install desktop shortcut and icon
install -D %{S:4} %{buildroot}/%{_datadir}/applications/%{name}.desktop
install -D %{S:5} %{buildroot}/%{_datadir}/pixmaps/%{name}.png

%if 0%{?suse_version} > 1020
# create symlinks for man pages
%fdupes -s %{buildroot}/%{_datadir}/%{name}/
%endif

%if 0%{?suse_version}
%suse_update_desktop_file %{name}
%endif

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root,-)
%doc readme.txt map_making_tips.txt LICENSE.txt
%{_bindir}/%{name}
%{_bindir}/%{name}-bin
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/*
%{_datadir}/applications/%{name}.desktop
%{_datadir}/pixmaps/%{name}.png

%changelog