File vavoom.spec of Package vavoom

#
# spec file for package vavoom
#
# 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 http://bugs.opensuse.org/
#


Name:           vavoom
Version:        1.33
Release:        0
Summary:        Source port of the DOOM game engine
License:        GPL-2.0+
Group:          Amusements/Games/3D/Shoot
Url:            http://vavoom-engine.com/
Source:         http://dl.sourceforge.net/vavoom/%{name}-%{version}.tar.bz2
Source99:       %{name}.changes
# from Fedora
Patch0:         vavoom-1.21-datadir.patch
# PATCH-FIX-UPSTREAM vavoom-1.27-CMakeLists.patch -- Fix CMake for %%cmake macro, reported upstream (E-Mail)
Patch1:         vavoom-1.27-CMakeLists.patch
Patch2:         vavoom-1.33-format-security.patch
Patch3:         vavoom-1.33-dont-override-delete.patch
Patch4:         vavoom-1.33-default-iwaddir.patch
Patch5:         vavoom-1.33-gcc6.patch
# PATCH-FIX-UPSTREAM fix-overflow-undefined-operation.patch -- Fix some overflows, upstream reported (email)
Patch6:         fix-overflow-undefined-operation.patch
BuildRequires:  cmake
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  libjpeg-devel
BuildRequires:  pkgconfig
BuildRequires:  update-desktop-files
BuildRequires:  wxWidgets-devel
BuildRequires:  pkgconfig(SDL_mixer)
BuildRequires:  pkgconfig(SDL_net)
BuildRequires:  pkgconfig(flac++)
BuildRequires:  pkgconfig(gl)
BuildRequires:  pkgconfig(libmikmod)
BuildRequires:  pkgconfig(libpng)
BuildRequires:  pkgconfig(openal)
BuildRequires:  pkgconfig(sdl)
BuildRequires:  pkgconfig(vorbis)
Recommends:     freedoom
Suggests:       timidity
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Vavoom is an advanced port of the Doom, Hexen/Heretic game engine.
It adds features such as translucency, lights and freelook support.

%prep
%setup -q
%patch0 -p1 -b .datadir
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1

# Allow the separation of binaries and data according to FHS.
sed -i "s|#define FL_BASEDIR.*|#define FL_BASEDIR \"%{_datadir}/%{name}\"|" source/files.h
sed -i "s|#define CONFIG_FILE.*|#define CONFIG_FILE \"%{_sysconfdir}/timidity.cfg\"|" source/timidity/timidity.h

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

%build
%cmake -DDATADIR=%{_datadir}/%{name} -DIWADDIR="-IWADDIR \"%{_datadir}/doom/\" -opengl" \
	-DWITH_SDL=Y \
	-DWITH_OPENGL=Y \
	-DWITH_OPENAL=Y \
	-DWITH_FLAC=Y \
	-DWITH_LIBMAD=N \
	-DWITH_ALLEGRO=N

make %{?_smp_mflags} VERBOSE=1

%install
%cmake_install

%suse_update_desktop_file -c %{name} Vavoom "Game Engine" vavoom vavoom Game ActionGame

mkdir -p %{buildroot}%{_datadir}/icons/hicolor/32x32/apps/
cp source/vavoom.png %{buildroot}%{_datadir}/icons/hicolor/32x32/apps/

%fdupes %{buildroot}%{_datadir}

%post
%desktop_database_post
%icon_theme_cache_post

%postun
%desktop_database_postun
%icon_theme_cache_postun

%files
%defattr(-,root,root)
%doc docs/*.log docs/gnu.txt docs/vavoom.txt
%{_bindir}/*
%{_datadir}/%{name}*
%{_datadir}/applications/*.desktop
%{_datadir}/icons/hicolor/32x32/apps/vavoom.png

%changelog
openSUSE Build Service is sponsored by