File crawl.spec of Package crawl

#
# spec file for package crawl
#
# 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.

Name:           crawl
Version:        0.9.1
Release:        0
License:        GPLv2+
Summary:        Roguelike dungeon exploration game
Url:            http://crawl.develz.org/
Group:          Amusements/Games/RPG
Source0:        stone_soup-%{version}.tar.bz2
Source1:        %{name}.desktop
BuildRequires:  SDL_image-devel
BuildRequires:  desktop-file-utils
BuildRequires:  freetype2-devel
BuildRequires:  gcc-c++
BuildRequires:  libpng-devel
BuildRequires:  lua-devel
BuildRequires:  ncurses-devel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version}
BuildRequires:  pkg-config
BuildRequires:  update-desktop-files
%else
BuildRequires:  pkgconfig
%endif
Requires:       %{name}-data = %{version}

%description
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.

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
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.

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
%if 0%{?suse_version} >= 1120
BuildArch:      noarch
%endif
Requires:       %{name} = %{version}

%description data
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.

These are the data files for Dungeon Crawl Stone Soup.

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

%build
cd source
make clean
make %{?_smp_flags} DATADIR="%{_datadir}/crawl/" SAVEDIR="/var/games/crawl/" EXTRA_FLAGS="%{optflags}"
mv crawl crawl.tty # avoid name clashes temporarily
make clean
make %{?_smp_flags} DATADIR="%{_datadir}/crawl/" SAVEDIR="/var/games/crawl/" TILES="1" EXTRA_FLAGS="%{optflags}"
mv crawl crawl-sdl
mv crawl.tty crawl

%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,key_changes,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
# saves directory
install -d %{buildroot}%{_localstatedir}/games/%{name}/morgue
install -d %{buildroot}%{_localstatedir}/games/%{name}/saves
chmod -R 0775 %{buildroot}%{_localstatedir}/games/%{name}

%if 0%{?suse_version}
%suse_update_desktop_file -i %{name} Game RolePlaying
%endif
%if 0%{?fedora}
desktop-file-install --dir=%{buildroot}%{_datadir}/applications %{SOURCE1}
%endif

%if 0%{?mandriva_version} > 2006
%post
%update_menus

%postun
%clean_menus
%endif

%files
%defattr(-,root,root)
%{_mandir}/man6/*
%attr(0775,games,games) %dir %{_localstatedir}/games/%{name}
%attr(0775,games,games) %dir %{_localstatedir}/games/%{name}/morgue
%attr(0775,games,games) %dir %{_localstatedir}/games/%{name}/saves
%attr(0755,root,root) %{_bindir}/%{name}

%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}/

%changelog
openSUSE Build Service is sponsored by