File doomsday.spec of Package doomsday

#
# spec file for package doomsday
#
# Copyright (c) 2012 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/
#


Name:           doomsday
Version:        1.9.9
Release:        0
Summary:        The Doomsday Engine: DOOM/Hertic/Hexen port with pretty graphics
# md2tool (apparently GPL-2.0 only) is not shipped in binary form
License:        GPL-2.0+
Group:          Amusements/Games/3D/Shoot
Url:            http://dengine.net/

#DL-URL:	http://downloads.sf.net/deng/doomsday-1.9.9.tar.gz
Source:         %name-%version.tar.xz
Patch1:		deng-nodate.diff

BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  Mesa-devel
BuildRequires:  SDL-devel
BuildRequires:  SDL_mixer-devel
BuildRequires:  gcc-c++
BuildRequires:  libpng-devel
BuildRequires:  libqt4-devel >= 4.6
BuildRequires:  ncurses-devel
BuildRequires:  xorg-x11-devel
BuildRequires:  xz
BuildRequires:  zlib-devel

%if 0%{?suse_version}
Recommends:     timidity timidity-eawpats
%endif
Provides:       jdoom = %version-%release
Provides:       jheretic = %version-%release
Provides:       jhexen = %version-%release
Obsoletes:	deng < %version-%release
Provides:	deng = %version-%release

%description
The Doomsday Engine is a source port with support for Doom, Heretic,
and Hexen. It does not support BOOM extensions.

%package launcher
Summary:	Graphical launcher for Doomsday
Requires:	%name = %version
%if 0%{?fedora_version}
BuildRequires:	python
Requires:	wxPython
%else
%py_requires
Requires:	python-wxWidgets
%endif
%if 0%{?suse_version} >= 1130 || 0%{?fedora_version}
BuildArch:	noarch
%endif

%description launcher
Snowberry is the official frontend of the Doomsday Engine. It is a
portable graphical game launcher, with support for configuring the
various types of games supported by Doomsday. It offers to save your
settings for launching a particular game (e.g., Doom).

%prep
%if 0%{?__xz:1}
%setup -q
%else
tar --use=xz -xf "%{S:0}";
%setup -DTq
%endif
%patch -P 1 -p1

%build
pushd doomsday;
find . -type f -name "*.h" -exec perl -i -pe 's{__DATE__}{""}gs' "{}" "+";
%if 0%{?fedora_version}
alias qmake="qmake-qt4";
%endif
qmake QMAKE_CFLAGS+="%optflags" QMAKE_CXXFLAGS+="%optflags" QMAKE_STRIP="true";
make %{?_smp_mflags};
popd;

%install
b="%buildroot";
pushd doomsday/;
make install INSTALL_ROOT="$b";
mkdir -p "$b/%_libexecdir/%name";
mv "$b/%_bindir"/* "$b/%_libexecdir/%name/";
mkdir -p "$b/%_libdir/%name";
mv "$b/%_libdir"/*.so.* "$b/%_libdir"/*.so "$b/%_libdir/%name/";
popd;

for i in doomsday launch-doomsday; do
	cat >"$b/%_bindir/$i" <<-EOF
		#!/bin/sh
		if ! set | grep -q "^DOOMWADDIR="; then
			DOOMWADDIR="/usr/share/doom";
			export DOOMWADDIR;
		fi;
		LD_LIBRARY_PATH="\$LD_LIBRARY_PATH:%_libdir/%name" exec "%_libexecdir/%name/$i" -libdir "%_libdir/%name" "\$@";
	EOF
done;
chmod a+x "$b/%_bindir"/{doomsday,launch-doomsday};

%files
%defattr(-,root,root)
%_bindir/doomsday
%dir %_libexecdir/%name
%_libexecdir/%name/doomsday
%dir %_libdir/%name
%_libdir/%name/lib*
%dir %_datadir/%name
%_datadir/%name/data
%_datadir/applications/doomsday-engine.desktop

%files launcher
%defattr(-,root,root)
%_bindir/launch-doomsday
%dir %_libexecdir/%name
%_libexecdir/%name/launch-doomsday
%dir %_datadir/%name
%_datadir/%name/snowberry

%changelog
openSUSE Build Service is sponsored by