%define ver %(echo %version | tr -d .)
Name: openarena
Version: 0.7.1
Release: 3%{?dist}
Summary: Open source first person shooter
Group: Amusements/Games
License: GPLv2
URL: http://openarena.ws/
Source0: http://download.tuxfamily.net/cooker/openarena/rel070/oa070.zip
Source1: http://cheapy.deathmask.net/logo.gif
Source2: http://www.openarena.ws/svn/source/ui/menudef.h
Source3: openarena.desktop
Source4: oa071-patch.zip
Source99: http://openarena.ws/rel/%{ver}/ioq3-src-oa.tar.bz2
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires: %{name}-data = %{version}
Requires: opengl-games-utils
BuildRequires: ImageMagick
BuildRequires: SDL-devel openal-devel curl-devel libvorbis-devel
BuildRequires: desktop-file-utils
%description
OpenArena is an open-source content package for Quake III Arena licensed under
the GPL, effectively creating a free stand-alone game.
%package data
Group: Amusements/Games
Summary: Data files for %{name}
Requires: %{name}
%description data
OpenArena is an open-source content package for Quake III Arena licensed under
the GPL, effectively creating a free stand-alone game.
This package contains data files essential to play OpenArena.
%prep
%setup -qn openarena-0.7.0
#1. let us create wrapper for openarena and for openarena_ded
# we can use one wrapper to that task
cat > %{name} << EOF
#!/bin/bash
. /usr/share/opengl-games-utils/opengl-game-functions.sh
checkDriOK openarena
BASEOA_HOME_DIR=\$HOME/.openarena/baseoa
DATA_DIR=%{_datadir}/%{name}
[[ -d \$BASEOA_HOME_DIR ]] || mkdir -p \$BASEOA_HOME_DIR
for file in \$(find \$DATA_DIR -type f -printf "%f "); do
[[ -a \$BASEOA_HOME_DIR/\$file ]] \
|| ln -s \$DATA_DIR/\$file \$BASEOA_HOME_DIR/\$file
done
if [[ "\$0" =~ "ded" ]]; then
exec %{_libexecdir}/%{name}/ioq3ded.%{_arch} "\$@"
else
exec %{_libexecdir}/%{name}/ioquake3.%{_arch} "\$@"
fi
EOF
chmod +x %{name}
ln -s %{name} %{name}_ded
#2. set the sources
%setup -q -c -T -D -b 99 -n openarena-0.7.0 #unpack sources in the same directory where data
%setup -q -c -T -D -b 4 -n openarena-0.7.0 #unpack patch in the same directory where data
#3. copy all documentation to one directory and get rid of unexpected
# permissions to make a %files section easier ;-)
mkdir doc
cp -p CHANGES COPYING CREDITS README doc
chmod -x doc/*
#4. fix end-of-line encodings
for file in doc/{COPYING,CREDITS,CHANGES,README}; do
sed s/\\r// -i $file
done
#5. convert a .gif file to .png format
convert %{SOURCE1} %{name}.png
#6. make this thing compilable
mkdir ui
cp -p %{SOURCE2} ui
%build
FLAGS="-fno-strict-aliasing -Wimplicit -Wstrict-prototypes \
-DUSE_OPENAL=1 -DUSE_CURL=1 -DUSE_CURL_DLOPEN=1 \
-DUSE_SDL_VIDEO=1 -DUSE_SDL_SOUND=1 $(sdl-config --cflags) \
-DUSE_LOCAL_HEADERS=1"
%ifarch ppc ppc64
FLAGS="$FLAGS -DNO_VM_COMPILED"
%endif
make distclean
make build_debug DEBUG_CFLAGS="%{optflags} $FLAGS"
%install
rm -rf $RPM_BUILD_ROOT
IOQ3="build/debug-linux-%{_arch}"
# there's no option to install unstripped binary files so we have to do it manually
mkdir -p $RPM_BUILD_ROOT%{_libexecdir}/%{name}
mkdir -p $RPM_BUILD_ROOT%{_datadir}/%{name}
mkdir -p $RPM_BUILD_ROOT%{_bindir}
mkdir $RPM_BUILD_ROOT%{_datadir}/pixmaps
# there's a few dirs and files we don't need
# get them deleted!
rm -rf $IOQ3/{baseq3,client,ded,missionpack}
rm -f $IOQ3/*smp*
# the things we have done above make it easier to install the application
cp -rp $IOQ3/* $RPM_BUILD_ROOT%{_libexecdir}/%{name}
#ugly hack for 0.7.1 patch, sorry, please clean.
mv openarena-0.7.0/baseoa/* baseoa
rmdir openarena-0.7.0/baseoa
mv openarena-0.7.0/* .
cp -p baseoa/* $RPM_BUILD_ROOT%{_datadir}/%{name}
cp -p %{name} %{name}_ded $RPM_BUILD_ROOT%{_bindir}
cp -p %{name}.png $RPM_BUILD_ROOT%{_datadir}/pixmaps
desktop-file-install --vendor="fedora" \
--dir=$RPM_BUILD_ROOT%{_datadir}/applications \
%{SOURCE3}
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
%doc doc/*
%{_bindir}/%{name}*
%{_libexecdir}/%{name}
%{_datadir}/applications/fedora-*
%{_datadir}/pixmaps/%{name}.png
%files data
%defattr(-,root,root,-)
%doc doc/COPYING
%{_datadir}/%{name}
%changelog
* Fri Oct 05 2007 Michał Bentkowski <mr.ecik at gmail.com> - 0.7.1-3
- Add support for opengl-games-utils
* Fri Aug 24 2007 Michał Bentkowski <mr.ecik at gmail.com> - 0.7.1-2
- BuildID rebuild
- License tag fix
* Mon Aug 13 2007 Jon Ciesla <limb@jcomserv.net> - 0.7.1-1
- Added 0.7.1 patch.
- Uses 0.7.0 .zip, took version macro out of URL and setup to accommodate.
* Fri Jul 13 2007 Michał Bentkowski <mr.ecik at gmail.com> - 0.7.0-3
- NO_VM_COMPILED flag on ppc64
* Fri Jul 13 2007 Michał Bentkowski <mr.ecik at gmail.com> - 0.7.0-2
- Add libvorbis-devel BR
* Wed Jul 11 2007 Michał Bentkowski <mr.ecik at gmail.com> - 0.7.0-1
- Update to 0.7.0
* Fri Jan 12 2007 Michał Bentkowski <mr.ecik at gmail.com> - 0.6.0-4
- Get rid of -maltivec flag
* Wed Jan 10 2007 Michał Bentkowski <mr.ecik at gmail.com> - 0.6.0-3
- Do some ppc fixes
* Wed Jan 03 2007 Michał Bentkowski <mr.ecik at gmail.com> - 0.6.0-2
- Add COPYING to data subpackage
- Remove LINUXNOTES from %%doc
* Mon Jan 01 2007 Michał Bentkowski <mr.ecik at gmail.com> - 0.6.0-1
- Initial new year release