File doomsday.spec of Package doomsday

# spec file for package doomsday
# Copyright (c) 2016 SUSE LINUX 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

Name:           doomsday
Version:        1.15.8
Release:        0
Summary:        A greatly enhanced DOOM source port
License:        GPL-2.0+ and GPL-2.0
Group:          Amusements/Games/3D/Shoot
# md2tool is the one being GPL-2.0-only
#Git-Clone:	git://
Source98:       %{name}-rpmlintrc
Source99:       %{name}.changes
Patch1:         doomsday-no-abs-icon.patch
Patch2:         doomsday-ncurses.diff
BuildRequires:  Mesa-devel
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  libpng-devel
BuildRequires:  ncurses-devel
BuildRequires:  pkgconfig
BuildRequires:  xorg-x11-devel
BuildRequires:  zlib-devel
BuildRequires:  pkgconfig(Qt5Core)
BuildRequires:  pkgconfig(Qt5Gui)
BuildRequires:  pkgconfig(Qt5Network)
BuildRequires:  pkgconfig(Qt5OpenGL)
BuildRequires:  pkgconfig(Qt5Widgets)
BuildRequires:  pkgconfig(Qt5X11Extras)
BuildRequires:  pkgconfig(SDL2_mixer)
BuildRequires:  pkgconfig(assimp)
BuildRequires:  pkgconfig(sdl2)
# Doomsday 1.12 needs OpenGL 2.x, which Mesa 9.0 (as shipped in openSUSE 12.3)
# does not have.
# For the situation in openSUSE 13.1+, as far as RPM is concerned, 3rd party
# GL drivers can coexist with Mesa-libGL1 as they are located in a separate
# directory, which means that having the following Mesa require is always
# acceptable.
Requires:       Mesa-libGL1 >= 9.2
Recommends:     timidity
Recommends:     timidity-eawpats
Provides:       jdoom = %{version}-%{release}
Provides:       jheretic = %{version}-%{release}
Provides:       jhexen = %{version}-%{release}
Obsoletes:      deng < %{version}-%{release}
Provides:       deng = %{version}-%{release}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

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
Group:          Amusements/Games/3D/Shoot
BuildRequires:  python
Requires:       %{name} = %{version}
Requires:       python-wxWidgets
BuildArch:      noarch

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

%setup -q -n %{name}-stable-%{version}
%patch1 -p1
%patch2 -p1

# Fix usage of __DATE__ and __TIME__ macros
modified="$(sed -n '/^----/n;s/ - .*$//;p;q' "%{SOURCE99}")"
DATE="\"$(date -d "${modified}" "+%%b %%e %%Y")\""
TIME="\"$(date -d "${modified}" "+%%R")\""
find . '(' -name '*.h' -o -name '*.cpp' ')' -exec \
	sed -i "s/__DATE__/${DATE}/g;s/__TIME__/${TIME}/g" \{\} +

pushd doomsday
%if 0%{?suse_version} > 1320
cf="$cf -Wno-narrowing"
qmake-qt5 QMAKE_CFLAGS+="%{optflags}" QMAKE_CXXFLAGS+="$cf" \
	QMAKE_STRIP="true" DENG_LIB_DIR="%{_libdir}"
make %{?_smp_mflags}

pushd doomsday
make install INSTALL_ROOT=%{buildroot}
mkdir -p "%{buildroot}%{_libexecdir}/%{name}"
mv "%{buildroot}%{_bindir}"/{md2tool,savegametool,texc} "%{buildroot}%{_libexecdir}/%{name}/"

# Prepare for the icons
mkdir -p "%{buildroot}%{_datadir}/pixmaps"
cp snowberry/graphics/snowberry.png "%{buildroot}%{_datadir}/pixmaps/doomsday-snowberry.png"
cp doomsday/tools/shell/shell-gui/res/shell.png "%{buildroot}%{_datadir}/pixmaps/doomsday-shell.png"

mkdir -p "%{buildroot}%{_sysconfdir}/doomsday";
cat >"%{buildroot}%{_sysconfdir}/doomsday/paths" <<-EOF
	basedir: %{_datadir}/doomsday
	libdir: %{_libdir}/doomsday
	iwaddir: %{_datadir}/doom

%fdupes %{buildroot}%{_datadir}

echo "INFO: %{name}: The global IWAD directory is %{_datadir}/doom.";

%postun -p /sbin/ldconfig

%dir %{_sysconfdir}/doomsday
%config %{_sysconfdir}/doomsday/paths
%dir %{_datadir}/%{name}/

%files launcher