File d2x-rebirth.spec of Package d2x-rebirth

# Copyright (c) 2006-2009 oc2pus
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# Please submit bugfixes or comments to toni@links2linux.de

# norootforbuild

%define _prefix	/usr

Summary:		The port of Descent 2 for Linux
Name:			d2x-rebirth
Version:		0.58.1
Release:		0.pm.1.1
License:		SUSE-Freeware
Group:			Amusements/Games/Action/Shoot
Url:			http://www.dxx-rebirth.de/
Source:			http://www.dxx-rebirth.de/download/dxx/oss/src/%{name}_v%{version}-src.tar.gz
Source1:		%{name}.png
Source2:		D2XBDE01.zip
Patch0:         fix_build.diff
Patch1:         libphysfs-3.0.1.patch
Patch2:         python3.patch
BuildRoot:		%{_tmppath}/%{name}-%{version}-%{release}-buildroot
BuildRequires:	dos2unix
BuildRequires:	gcc-c++
BuildRequires:	Mesa-devel
BuildRequires:	nasm
BuildRequires:	scons
BuildRequires:	SDL-devel
BuildRequires:	SDL_image-devel
BuildRequires:	SDL_mixer-devel
BuildRequires:	physfs-devel
BuildRequires:	unzip
BuildRequires:	update-desktop-files
%if 0%{?suse_version} >= 1500
BuildRequires:  python3
%endif
Requires:		physfs
Requires:		%{name}-exe

%description
This is the port of Descent 2, the famous 3D game for PC.

D2X is based on source code that was released the 14 December 1999 by
Parallax Software Corporation.

To use this package you'll need some datafiles installed in
/usr/share/games/descent2. See dxx-readme.txt.

%package sdl
Group:		Amusements/Games/Action/Shoot
Summary:	Descent 2 for Linux, SDL version
Requires:	d2x-rebirth = %{version}
Requires:	SDL
Requires:	SDL_image
Requires:	SDL_mixer
#Conflicts:	d2x-rebirth-gl
Provides:	%{name}-exe

%description sdl
This is the port of Descent 2, the famous 3D game for PC.

D2X is based on source code that was released the 14 December 1999
by Parallax Software Corporation.

To use this package you'll need some datafiles installed in
/usr/share/games/descent2. See dxx-readme.txt.

This version uses SDL for Audio, Input/Output and graphics
rendering.

%package gl
Group:		Amusements/Games/Action/Shoot
Summary:	Descent 2 for Linux, OpenGL version
Requires:	%{name} = %{version}
Requires:	SDL_image
Requires:	SDL_mixer
#Conflicts:	d2x-rebirth-sdl
Provides:	%{name}-exe

%description gl
This is the port of Descent 2, the famous 3D game for PC.

D2X is based on source code that was released the 14 December 1999 by
Parallax Software Corporation.

To use this package you'll need some datafiles installed in
/usr/share/games/descent2.  See dxx-readme.txt.

This version uses SDL for Audio and Input/Output and OpenGL for
graphics rendering.

%prep
%setup -q -n %{name}_v%{version}-src -a2
dos2unix     d2x.ini *.txt
%__chmod 644 d2x.ini *.txt
%patch0 -p1
%if 0%{?suse_version} > 1500 || 0%{?sle_version} >= 150100
%patch1 -p1
%endif
%patch2 -p1

%build
# currently needed with GCC10
export CFLAGS="-fcommon"
# d2x-gl
%if 0
#%% {?suse_version} >= 1500
python2 %{_bindir}/scons %{?jobs:-j%{jobs}} \
%else
scons %{?jobs:-j%{jobs}} \
%endif
	sharepath=%{_datadir}/games/descent2 \
	opengl=1 \
	sdlmixer=1 \
	asm=0
mv d2x-rebirth d2x-rebirth-gl

# d2x-sdl
%if 0
#%% {?suse_version} >= 1500
python2 %{_bindir}/scons -c
python2 %{_bindir}/scons %{?jobs:-j%{jobs}} \
%else
scons -c
scons %{?jobs:-j%{jobs}} \
%endif
	sharepath=%{_datadir}/games/descent2 \
    opengl=0 \
	sdlmixer=1 \
    asm=0
mv d2x-rebirth d2x-rebirth-sdl

%install
# binaries
%__install -dm 755 %{buildroot}%{_bindir}/
%__install -m 755 d2x-rebirth-gl \
	%{buildroot}%{_bindir}/
%__install -m 755 d2x-rebirth-sdl \
	%{buildroot}%{_bindir}/

%__install -dm 755 %{buildroot}%{_datadir}/games/descent2
# german translations
%__install -m 644 D2XBDE01/D2XbDE01/*.txb \
	%{buildroot}%{_datadir}/games/descent2
%__install -m 644 D2XBDE01/*.txt \
	%{buildroot}%{_datadir}/games/descent2
# directory for original descent data
%__install -dm 755 %{buildroot}%{_datadir}/games/descent2/missions

# man-pages
%__install -dm 755 %{buildroot}%{_mandir}/man1/
%__install  -m 644 libmve/*.1 \
	%{buildroot}%{_mandir}/man1/

# icon
%__install -dm 755 %{buildroot}%{_datadir}/pixmaps
%__install -m 644 %{SOURCE1} \
	%{buildroot}%{_datadir}/pixmaps

# menu
%__install -dm 755 %{buildroot}%{_datadir}/applications
%__cat > %{name}-sdl.desktop << EOF
[Desktop Entry]
Encoding=UTF-8
Type=Application
Name=D2x (SDL version)
Comment=The port of Descent 2 for Linux
Exec=%{_bindir}/d2x-rebirth-sdl
Icon=%{name}
Categories=Game;ActionGame;
EOF
%__install -m 644 %{name}-sdl.desktop \
	%{buildroot}%{_datadir}/applications
%suse_update_desktop_file %{name}-sdl Game ActionGame

%__cat > %{name}-gl.desktop << EOF
[Desktop Entry]
Encoding=UTF-8
Type=Application
Name=D2x (OpenGL version)
Comment=The port of Descent 2 for Linux
Exec=%{_bindir}/d2x-rebirth-gl
Icon=%{name}
Categories=Game;ActionGame;
EOF
%__install -m 644 %{name}-gl.desktop \
	%{buildroot}%{_datadir}/applications
%suse_update_desktop_file %{name}-gl Game ActionGame

%clean
[ -d "%{buildroot}" -a "%{buildroot}" != "" ] && %__rm -rf "%{buildroot}"

%files
%defattr(-,root,root)
%doc *.txt *.plist *.ini
%dir %{_datadir}/games/descent2
%{_datadir}/games/descent2/*.txb
%{_datadir}/games/descent2/*.txt
%dir %{_datadir}/games/descent2/missions
%{_mandir}/man1/*
%{_datadir}/pixmaps/%{name}.png

%files sdl
%defattr(-,root,root)
%doc COPYING*
%{_bindir}/d2x-rebirth-sdl
%{_datadir}/applications/%{name}-sdl.desktop

%files gl
%defattr(-,root,root)
%doc COPYING*
%{_bindir}/d2x-rebirth-gl
%{_datadir}/applications/%{name}-gl.desktop

%changelog
* Fri May 28 2021 Wolfgang Bauer <wbauer@tmo.at>
- Move executables from /usr/games/ to /usr/bin/
- Require one of the executables to be installed
* Fri Oct 08 2020 Wolfgang Bauer <wbauer@tmo.at>
- Add "-fcommon" to the compiler flags to fix build with GCC10
* Thu Jul 02 2020 Wolfgang Bauer <wbauer@tmo.at>
- Add libphysfs-3.0.1.patch to fix build on Leap 15.1 and higher
* Fri Oct 05 2018 Wolfgang Bauer <wbauer@tmo.at>
- Fix build on TW and Leap 15 by explicitly running scons with python2
* Fri Nov 01 2013 Wolfgang Bauer <wbauer@tmo.at>
- fix build on 13.1
* Tue Aug 06 2013 Wolfgang Bauer <wbauer@tmo.at> - 0.58.1
- update to 0.58.1
- added fix_build.diff
* Tue May 15 2012 Wolfgang Bauer <wbauer@tmo.at>
- fix build options for SDL version (opengl=0 instead of sdl_only=1, was changed upstream)
- remove conflict between SDL and OpenGL version (it is perfectly fine to install both at the same time)
* Mon May 14 2012 Wolfgang Bauer <wbauer@tmo.at> - 0.57.3
- update to 0.57.3
* Sun Mar 18 2012 Wolfgang Bauer <wbauer@tmo.at> - 0.57.2
- update to 0.57.2
- remove build patch (fixed upstream)
* Fri Dec 23 2011 Wolfgang Bauer <wbauer@tmo.at> - 0.57.1
- update to 0.57.1
- fix build on 12.1
* Sun Jan 25 2009 Toni Graffy <toni@links2linux.de> - 0.55.1-0.pm.1
- update to 0.55.1
* Sat Dec 27 2008 Toni Graffy <toni@links2linux.de> - 0.55-0.pm.1
- update to 0.55
* Sun Jun 29 2008 Toni Graffy <toni@links2linux.de> - 0.54-0.pm.1
- update to 0.54
* Mon Dec 03 2007 Toni Graffy <toni@links2linux.de> - 0.53-0.pm.2
- rebuild with new physfs(-devel) 1.1.1
* Thu Oct 25 2007 Toni Graffy <toni@links2linux.de> - 0.53-0.pm.1
- update to 0.53
* Sun May 06 2007 Toni Graffy <toni@links2linux.de> - 0.52-0.pm.1
- update to 0.52
* Fri Feb 16 2007 Toni Graffy <toni@links2linux.de> - 0.51-0.pm.1
- update to 0.51
* Sat Nov 11 2006 Toni Graffy <toni@links2linux.de> - 0.50-0.pm.1
- initial package 0.50
openSUSE Build Service is sponsored by