File crawl.spec of Package crawl

#
# spec file for package crawl
#
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2011 Sascha Peilicke <sasch.pe@gmx.de>
#
# 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/
#


Name:           crawl
Version:        0.16.2
Release:        0
Summary:        Roguelike dungeon exploration game
License:        GPL-2.0+
Group:          Amusements/Games/RPG
Url:            http://crawl.develz.org/
Source0:        https://crawl.develz.org/release/stone_soup-%{version}-nodeps.tar.xz
Source1:        %{name}.desktop
BuildRequires:  SDL2-devel
BuildRequires:  SDL2_image-devel
BuildRequires:  dejavu-fonts
BuildRequires:  desktop-file-utils
BuildRequires:  freetype2-devel
BuildRequires:  gcc-c++
BuildRequires:  libpng-devel
BuildRequires:  lua51-devel
BuildRequires:  ncurses-devel
BuildRequires:  sqlite-devel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  pkg-config
BuildRequires:  update-desktop-files
BuildRequires:  pkgconfig(glu)
Requires(pre):  pwdutils
Requires:       %{name}-data = %{version}

%define about Crawl is a fun game in the grand tradition of games like Rogue, Hack, and Moria. Your objective is to travel deep into a subterranean cave complex and retrieve the Orb of Zot, which is guarded by many horrible and hideous creatures.

%description
%about

This is the Stone Soup version of Dungeon Crawl.

Note: You need to be in the 'games' group in order to play the game.

%package sdl
Summary:        Roguelike dungeon exploration game (SDL version)
Group:          Amusements/Games/RPG
Requires:       %{name} = %{version}

%description sdl
%about

This is the (SDL-based) tiled Stone Soup version of Dungeon Crawl.

Note: You need to be in the 'games' group in order to play the game.

%package data
Summary:        Roguelike dungeon exploration game (Data files)
Group:          Amusements/Games/RPG
BuildArch:      noarch
Requires:       %{name} = %{version}

%description data
%about

These are the data files for Dungeon Crawl Stone Soup.

%prep
%setup -q -n stone_soup-%{version}

%build
cd source
tmpflags="%{optflags}"
%ifarch ppc64le
# avoid contentions between SDL vector and gcc defines
# disable the include of altivec.h in /usr/include/SDL2/SDL_cpuinfo.h
# note that --disable-altivec not supported by gcc 4.8
tmpflags="$tmpflags -U__ALTIVEC__"
%endif
make clean
make %{?_smp_flags} DATADIR="%{_datadir}/%{name}/" EXTRA_FLAGS="${tmpflags}"
mv crawl crawl.tty # avoid name clashes temporarily
make clean
make %{?_smp_flags} DATADIR="%{_datadir}/%{name}/" EXTRA_FLAGS="${tmpflags}" TILES="1"
mv crawl crawl-sdl
mv crawl.tty crawl

%pre
getent group games >/dev/null || groupadd -r games
getent passwd games >/dev/null || useradd -r -g games -d /var/games -s /sbin/nologin
# move old saves
if [ -d /var/games/crawl ]; then
	if [ -d /root/.crawl ]; then
		mv /root/.crawl /root/.crawl_old
	fi
	mv /var/games/crawl /root/.crawl
fi

%install
# binaries
install -D -m 0755 source/crawl %{buildroot}%{_bindir}/crawl
install -D -m 0755 source/crawl-sdl %{buildroot}%{_bindir}/crawl-sdl
# man pages
install -D -m 0644 docs/crawl.6 %{buildroot}%{_mandir}/man6/crawl.6
# documentation
install -d %{buildroot}%{_docdir}/%{name}
install -m 0644 docs/{arena,changelog,keybind,ssh_guide}.txt %{buildroot}%{_docdir}/%{name}
cp -a docs/develop docs/license %{buildroot}%{_docdir}/%{name}
# those are needed ingame, therefore they move elsewhere
install -d %{buildroot}%{_datadir}/%{name}/docs
install -m 0644 README.txt %{buildroot}%{_datadir}/%{name}
install -m 0644 docs/{aptitudes,crawl_manual,macros_guide,options_guide,quickstart,tiles_help}.txt %{buildroot}%{_datadir}/%{name}/docs
# common data
cp -a source/dat %{buildroot}%{_datadir}/%{name}/dat
# config
cp -a settings %{buildroot}%{_datadir}/%{name}/settings
#install -m 755 -d %%{buildroot}%%{_sysconfdir}/%%{name}
#touch %%{buildroot}%%{_sysconfdir}/%%{name}/crawlrc
# icon and desktop file
install -D -m 0644 source/dat/tiles/stone_soup_icon-32x32.png %{buildroot}%{_datadir}/pixmaps/%{name}.png

%suse_update_desktop_file -i %{name} Game RolePlaying

%files sdl
%defattr (-,root,root)
%{_datadir}/applications/%{name}.desktop
%{_datadir}/pixmaps/%{name}.png
%attr(0755,root,root) %{_bindir}/%{name}-sdl

%files data
%defattr (-,root,root)
%{_docdir}/%{name}
%{_datadir}/%{name}

%files
%defattr(-,root,root)
%{_mandir}/man6/*
%attr(0755,root,root) %{_bindir}/%{name}

%changelog
openSUSE Build Service is sponsored by