File quakespasm.spec of Package quakespasm

#
# spec file for package quakespasm
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2016 Luke Jones <luke.nukem.jones@gmail.com>
#
# 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:           quakespasm
Version:        0.92.0
Release:        0
Summary:        Quakspasm Quake Engine
License:        GPL-2.0
Group:          Amusements/Games/3D/Shoot
Url:            http://quakespasm.sourceforge.net/
Source:         http://ufpr.dl.sourceforge.net/project/quakespasm/Source/%{name}-%{version}.tgz
Source99:       %{name}.changes
BuildRequires:  libSDL2-devel
BuildRequires:  libSDL2_net-devel
BuildRequires:  libvorbis-devel
BuildRequires:  update-desktop-files
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
QuakeSpasm is a Quake 1 engine based on the SDL2 port of FitzQuake.  It includes
64bit CPU support, a new sound driver, several networking fixes and a few
graphical niceities, while also staying true to the original game.
Game data must be placed in ~/.quakespasm/id1

%prep
%setup
# Fix usage of __DATE__ and __TIME__ macros to prevent build in excess
modified="$(sed -n '/^----/n;s/ - .*$//;p;q' "%{SOURCE99}")"
DATE="\"$(date -d "${modified}" "+%%b %%e %%Y")\""
TIME="\"$(date -d "${modified}" "+%%R")\""
sed -i "s/__DATE__/${DATE}/g;s/__TIME__/${TIME}/g" Quake/host.c
# Prepare for later installation
mkdir html/
ln -s README.html ./html/README.html
mv Quakespasm.txt README
mv Quakespasm-Music.txt MUSIC
mv LICENSE.txt LICENSE

%build
export CFLAGS='%{optflags} -DQUAKE_BASEDIR=\"%{_datadir}/quake\"'
make %{?_smp_mflags} -C Quake\
    DO_USERDIRS=1 \
    USE_CODEC_MP3=0 \
    USE_SDL2=1

%install
install -D -p -m 755 Quake/quakespasm %{buildroot}%{_bindir}/quakespasm
install -D -p -m 644 Misc/QuakeSpasm_512.png %{buildroot}%{_datadir}/pixmaps/quakespasm.png
install -d -m 755 %{buildroot}%{_datadir}/quake/

%suse_update_desktop_file -c quakespasm 'Quake' 'QuakeSpasm' quakespasm quakespasm Game ActionGame

%post
%desktop_database_post

%postun
%desktop_database_postun

%files
%defattr(-,root,root)
%doc README MUSIC LICENSE html/
%{_bindir}/quakespasm
%dir %{_datadir}/quake/
%{_datadir}/pixmaps/quakespasm.png
%{_datadir}/applications/quakespasm.desktop

%changelog
openSUSE Build Service is sponsored by