A new user interface for you! Read more...

File sauerbraten.spec of Package sauerbraten

Name:		sauerbraten
Version:	20090619
Release:	1%{?dist}
Summary:	Free multi player/single player first person shooter 

Group:		Amusements/Games
License:	zlib
URL:		http://www.sauerbraten.org
Source0:	http://downloads.sourceforge.net/%{name}/%{name}_2009_05_04_trooper_edition_linux.tar.bz2
Source1:	http://downloads.sourceforge.net/project/%{name}/%{name}/2009_05_04/patch_2009_06_19_linux.tar.bz2
Source2:	%{name}.png
Source3:	%{name}.desktop
Source4:	%{name}-server

BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildRequires:	gcc-c++
BuildRequires:	SDL-devel >= 1.2.10
BuildRequires:	SDL_mixer-devel
BuildRequires:	SDL_image-devel
BuildRequires:	mesa-libGL-devel
BuildRequires:	mesa-libGLU-devel
BuildRequires:	desktop-file-utils

Requires:	SDL >= 1.2.10
Requires:	SDL_mixer
Requires:	SDL_image
Requires:	mesa-libGL
Requires:	mesa-libGLU
Requires:	%{name}-data = %{version}

%description
Cube 2: Sauerbraten (Trooper Edition) is a free multi player/single player
first person shooter, built as a major redesign of the Cube FPS.

%package data
Summary:	Data files for %{name}
Group:		Amusements/Games
Requires:	%{name} = %{version}
BuildArch:	noarch

%description data
Data files for Sauerbraten

%package server
Summary:	Sauerbraten server
Group:		Amusements/Games
Requires:	%{name} = %{version}

%description server
Provides server client for %{name}

%prep
%setup -q -n %{name}

# Update sources, data and others
pushd ..
%{__tar} xjf %{SOURCE1}
popd

%{__rm} -f bin_unix/*
%{__rm} -f docs/favicon.ico

%{__cp} %{SOURCE4} .

# Sauerbraten DIR
%{__sed} -i 's|SAUER_DATA=\.|SAUER_DATA=%{_datadir}/games/%{name}|g' \
	%{name}_unix
%{__sed} -i 's|SAUER_DATA=\.|SAUER_DATA=%{_datadir}/games/%{name}|g' \
	%{name}-server

# use external enet
#%{__sed} -i -e 's|-Ienet/include|-I%{_includedir}/enet|g'	\
#	src/Makefile
#%{__sed} -i -e 's|-Lenet|-L%{_libdir} -lenet|g'		\
#	src/Makefile

%build
pushd src/
%{__make} %{?_smp_mflags}
popd

%install
%{__rm} -rf %{buildroot}

	pushd src
	%{__make} install
	popd

	# Data files
	%{__install} -dm 755 %{buildroot}%{_datadir}/games/%{name}
	%{__install} -m 644 server-init.cfg \
		%{buildroot}%{_datadir}/games/%{name}

	for file in data packages; do
		%{__cp} -R "$file" %{buildroot}%{_datadir}/games/%{name}
	done
	find %{buildroot}%{_datadir}/games/%{name} -type f -exec %{__chmod} 644 '{}' \;

	# Binary files
	%{__install} -dm 755 %{buildroot}%{_libdir}/%{name}
	%{__install} -m 755 bin_unix/native_client \
		%{buildroot}%{_libdir}/%{name}/%{name}_client
	%{__install} -m 755 bin_unix/native_server \
		%{buildroot}%{_libdir}/%{name}/%{name}_server

	# Symlinks
	%{__install} -dm 755 %{buildroot}%{_datadir}/games/%{name}/bin_unix
	%{__ln_s} %{_libdir}/%{name}/%{name}_client \
		%{buildroot}%{_datadir}/games/%{name}/bin_unix/native_client
	%{__ln_s} %{_libdir}/%{name}/%{name}_server \
		%{buildroot}%{_datadir}/games/%{name}/bin_unix/native_server

	# startscripts
	%{__install} -dm 755 %{buildroot}%{_bindir}
	%{__install} -m 755 %{name}_unix	\
		%{buildroot}%{_bindir}/%{name}
	%{__install} -m 755 %{name}-server	\
		%{buildroot}%{_bindir}/%{name}-server

	# icon
	%{__install} -dm 755 %{buildroot}%{_datadir}/pixmaps
	%{__install} -m 644 %{SOURCE2} %{buildroot}%{_datadir}/pixmaps

	desktop-file-install	--dir %{buildroot}%{_datadir}/applications \
				--add-category 'Game;ActionGame;' %{SOURCE3}
%clean
%{__rm} -rf %{buildroot}


%files
%defattr(-,root,root,-)
%doc README.html docs/*
%dir %{_datadir}/games/%{name}
%dir %{_datadir}/games/%{name}/bin_unix
%{_datadir}/games/%{name}/bin_unix/native_client
%{_datadir}/applications/%{name}.desktop
%{_datadir}/pixmaps/%{name}.png
%dir %{_libdir}/%{name}
%{_libdir}/%{name}/%{name}_client
%{_bindir}/%{name}


%files data
%defattr(-,root,root,-)
%dir %{_datadir}/games/%{name}/packages
%{_datadir}/games/%{name}/packages/*
%dir %{_datadir}/games/%{name}/data
%{_datadir}/games/%{name}/data/*

%files server
%defattr(-,root,root,-)
%{_datadir}/games/%{name}/server-init.cfg
%{_datadir}/games/%{name}/bin_unix/native_server
%{_libdir}/%{name}/%{name}_server
%{_bindir}/%{name}-server

%changelog
* Thu Feb 26 2010 - Elder Marco <eldermarco@gmail.com> 20090619-1
- Initial Package