File oilrush.spec of Package OilRush

#
# spec file for package oilrush
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# 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/
#

%ifarch %ix86
%define cpu x86
%define nocpu x64
%endif
%ifarch x86_64
%define cpu x64
%define nocpu x86
%endif

Name:           oilrush
Version:		1.35
Release:		2
License:		Commercial
Summary:		A real-time naval strategy game based on group control
Url:			http://oilrush-game.com/
Group:			Amusements/Games
Source0:		OilRush-%{version}.run
Source1:		icons.tar.bz2
Source2:		oilrush
NoSource:		0
BuildRequires:	tar chrpath
Requires:		%name-data = %version
BuildRoot:  	%{_tmppath}/%{name}-%{version}-build
Packager:		Andrea Florio <andrea@opensuse.org>

%description
Oil Rush is a real-time naval strategy game based on group control.
It combines the strategic challenge of a classical RTS with the sheer
fun of Tower Defence.

%package data
Group:		Amusements/Games
Summary:	Game data for %name
BuildArch:	noarch

%description data
Oil Rush is a real-time naval strategy game based on group control.
It combines the strategic challenge of a classical RTS with the sheer
fun of Tower Defence.

%prep
mkdir %name-%version
%setup -D -T

%build
%install
chmod +x %{SOURCE0}
# install everything in /opt
%{SOURCE0} --target %buildroot/opt/%name

# remove 32bit only library already provided by all distro
%__rm %buildroot/opt/%name/bin/libopenal.so.1

# remove what is not for the building arch
%__rm %buildroot/opt/%name/bin/*%{nocpu}*
%__rm %buildroot/opt/%name/launcher_%{nocpu}.sh

# remove ugly RPATH from binaries
chrpath --delete %buildroot/opt/%name/bin/*

# create a symlink so that the launching script is universal
%__ln_s /opt/%name/bin/launcher_%{cpu} %buildroot/opt/%name/bin/launcher

# install icons and launcher
%__tar -xvf %{SOURCE1}
%__mkdir -p %buildroot/%_bindir/
mv share %buildroot/%_prefix/
cp %{SOURCE2} %buildroot/%_bindir/
chmod +x %buildroot/%_bindir/%name

%clean
%{?buildroot:%__rm -rf "%{buildroot}"}

%files
%defattr(-,root,root)
%dir /opt/%name
%dir /opt/%name/bin
/opt/%name/bin/OilRush_%{cpu}d
/opt/%name/bin/launcher
/opt/%name/bin/launcher_%{cpu}
/opt/%name/bin/libNetwork_%{cpu}d.so
/opt/%name/bin/libQtCoreUnigine_%{cpu}.so.4
/opt/%name/bin/libQtGuiUnigine_%{cpu}.so.4
/opt/%name/bin/libQtNetworkUnigine_%{cpu}.so.4
/opt/%name/bin/libQtWebKitUnigine_%{cpu}.so.4
/opt/%name/bin/libQtXmlUnigine_%{cpu}.so.4
/opt/%name/bin/libRakNet_%{cpu}d.so
/opt/%name/bin/libUnigine_%{cpu}d.so
/opt/%name/launcher_%{cpu}.sh

%files data
%defattr(-,root,root)
%doc /opt/%name/documentation/user_manual.pdf
%dir /opt/%name
%dir /opt/%name/documentation
%dir %_datadir/icons/hicolor
%dir %_datadir/icons/hicolor/16x16
%dir %_datadir/icons/hicolor/32x32
%dir %_datadir/icons/hicolor/48x48
%dir %_datadir/icons/hicolor/64x64
%dir %_datadir/icons/hicolor/128x128
%dir %_datadir/icons/hicolor/*x*/apps
/opt/%name/data
/opt/%name/%name-0.75.cfg
%_bindir/oilrush
%_datadir/applications/oilrush.desktop
%_datadir/pixmaps/oilrush.xpm
%_datadir/icons/hicolor/*x*/apps/oilrush.png

%changelog