File hheretic.spec of Package hheretic

# norootforbuild

%define _prefix	/usr

Name:			hheretic
Summary:		Hacked Heretic is a Linux port of Raven Game's old shooter, Heretic
License:		GPL-2.0-or-later
Group:			Amusements/Games/Action/Shoot
Version:		0.2.4
Release:		1
URL:			http://hhexen.sourceforge.net/
Source:			http://downloads.sourceforge.net/hhexen/%{name}-%{version}.tar.gz
Source1:		%{name}.png
Source2:		heretic1.wad
Source90:		%{name}-rpmlintrc
# taken from chocolate-heretic to fix possible crashes after loading a savegame
# https://github.com/chocolate-doom/chocolate-doom/issues/292
Patch0:         fix-crash-after-loading-savegame.patch
BuildRoot:		%{_tmppath}/%{name}-%{version}-build
BuildRequires:	Mesa-devel
BuildRequires:	SDL-devel
BuildRequires:	SDL_mixer-devel
BuildRequires:	update-desktop-files
Recommends:		timidity
# make sure at least one of the executables is installed
Requires:		%{name}-exe

%description
Hacked Heretic is a Linux port of Raven Game's old shooter, Heretic.

This is a new release of Dan Olson's excellent Hacked Heretic by the authors
of Hammer of Thyrion (Hexen II).  We're applying fixes, adding a few features,
and ensuring it runs on most *nix operating systems.

This package contains common files.

%package gl
Summary:	Hacked Heretic is a Linux port of Raven Game's old shooter, Heretic
Group:		Amusements/Games/Action/Shoot
Requires:	%{name}
Provides:	%{name}-exe

%description gl
Hacked Heretic is a Linux port of Raven Game's old shooter, Heretic.

This is a new release of Dan Olson's excellent Hacked Heretic by the authors
of Hammer of Thyrion (Hexen II).  We're applying fixes, adding a few features,
and ensuring it runs on most *nix operating systems.

This package contains the OpenGL enabled binary.

%package sdl
Summary:	Hacked Heretic is a Linux port of Raven Game's old shooter, Heretic
Group:		Amusements/Games/Action/Shoot
Requires:	%{name}
Provides:	%{name}-exe

%description sdl
Hacked Heretic is a Linux port of Raven Game's old shooter, Heretic.

This is a new release of Dan Olson's excellent Hacked Heretic by the authors
of Hammer of Thyrion (Hexen II).  We're applying fixes, adding a few features,
and ensuring it runs on most *nix operating systems.

This package contains the sdl enabled binary.

%package demo
Summary:	Hacked Heretic is a Linux port of Raven Game's old shooter, Heretic
Group:		Amusements/Games/Action/Shoot
Requires:	%{name}

%description demo
Hacked Heretic is a Linux port of Raven Game's old shooter, Heretic.

This package contains the demo wad.

Those without the full retail version of Heretic can still play the
demo.

%prep
%setup -q -n %{name}-%{version}
%patch -P 0 -p1

%build
# compile the OpenGL version (hheretic-gl)
%configure \
	--enable-fullscreen \
	--with-datapath=%{_datadir}/games/%{name} \
	--with-audio=sdlmixer
%__make %{?jobs:-j%{jobs}}

# compile the software version (hheretic-sdl)
%__make clean
%configure \
	--disable-gl \
	--enable-fullscreen \
	--with-datapath=%{_datadir}/games/%{name} \
	--with-audio=sdlmixer
%__make %{?jobs:-j%{jobs}}

%install
# install the gamedata
%__install -dm 755 %{buildroot}/%{_datadir}/games/%{name}
%__install -m 644 %{SOURCE2} \
	%{buildroot}%{_datadir}/games/%{name}

%__install -dm 755 %{buildroot}%{_bindir}/%{name}
%__install -dm 755 %{buildroot}%{_datadir}/pixmaps
for i in gl sdl; do
	# binaries
	%__install -m 755 %{name}-$i \
		%{buildroot}%{_bindir}
done

# install icon
%__install -m 644 %{SOURCE1} \
	%{buildroot}%{_datadir}/pixmaps/%{name}.png

# install menu entry
%__install -dm 755 %{buildroot}%{_datadir}/applications
%{__cat} > %{name}-gl.desktop << EOF
[Desktop Entry]
Name=Hacked Heretic (OpenGL)
GenericName=Hacked Heretic (OpenGL)
Comment=Hacked Heretic is a Linux port of Raven Game's old shooter, Heretic
Exec=%{name}-gl
Icon=%{name}
Terminal=false
Type=Application
#Encoding=UTF-8
EOF

%{__cat} > %{name}-sdl.desktop << EOF
[Desktop Entry]
Name=Hacked Heretic (SDL)
GenericName=Hacked Heretic (SDL)
Comment=Hacked Heretic is a Linux port of Raven Game's old shooter, Heretic
Exec=%{name}-sdl
Icon=%{name}
Terminal=false
Type=Application
#Encoding=UTF-8
EOF

%__install -m 644 %{name}*.desktop \
	%{buildroot}%{_datadir}/applications
%suse_update_desktop_file -i %{name}-gl Game ActionGame
%suse_update_desktop_file -i %{name}-sdl Game ActionGame

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

%files
%defattr(-,root,root)
%doc AUTHORS ChangeLog LICENSE README TODO
%{_datadir}/pixmaps/%{name}.png
%dir %{_datadir}/games/%{name}

%files gl
%defattr(-,root,root)
%{_bindir}/%{name}-gl
%{_datadir}/applications/%{name}-gl.desktop

%files sdl
%defattr(-,root,root)
%{_bindir}/%{name}-sdl
%{_datadir}/applications/%{name}-sdl.desktop

%files demo
%defattr(-,root,root)
%{_datadir}/games/%{name}/*.wad

%changelog
* Wed Mar 26 2025 Wolfgang Bauer <wbauer1@a1.net> - 0.2.4
- Update to version 0.2.4
  * fixed a heap buffer overrun which was introduced back in v0.2.0
  * fixed buffer overrun in opengl texture code leading to segfaults
  * new mus2midi converter code by Bret Curtis
  * double-buffering support and double-buffered rectangle rendering in
    software renderer, by Miro Kropacek
  * Atari (FreeMint) support, by Miro Kropacek
  * miscellaneous cleanups and build fixes
* Sat May 29 2021 Wolfgang Bauer <wbauer@tmo.at>
- Enable fullscreen by default
* Fri May 28 2021 Wolfgang Bauer <wbauer@tmo.at>
- Move executables to /usr/bin/ on older distributions as well
  (for consistency with hhexen and to simplify the .spec file)
- Require one of the executables to be installed
* Tue Jun 20 2017 Wolfgang Bauer <wbauer@tmo.at>
- install executables to /usr/bin/ instead of /usr/games/ on Tumbleweed, the latter is deprecated
* Fri Sep 20 2013 Wolfgang Bauer <wbauer@tmo.at> - 0.2.3
- update to version 0.2.3
  * verified successful compilation using gcc-4.6 to 4.8 and clang-3.x
    fixed some undefined behaviors in the C code
* Wed Jul 18 2012 Wolfgang Bauer <wbauer@tmo.at> - 0.2.2
- initial package
openSUSE Build Service is sponsored by