File d2x-rebirth.spec of Package d2x-rebirth

#
# spec file for package d2x-rebirth
#
# Copyright (c) 2025 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#


%if 0%{?sle_version} && 0%{?sle_version} < 160000
%global force_gcc_version 13
%endif
Name:           d2x-rebirth
Version:        0.61+git.20250112
Release:        0
Summary:        Descent 2 eXtended Rebirth
License:        SUSE-Freeware
Group:          Amusements/Games/Action/Shoot
URL:            https://www.dxx-rebirth.com/
Source:         %{name}-%{version}.tar.xz
Source2:        https://www.dxx-rebirth.com/download/dxx/content/descent2-pc-demo.zip
Source3:        https://www.dxx-rebirth.com/download/dxx/res/d2xr-briefings-ger.dxa
BuildRequires:  dos2unix
BuildRequires:  gcc%{?force_gcc_version}-c++
BuildRequires:  nasm
BuildRequires:  pkgconfig
BuildRequires:  scons >= 4.2
BuildRequires:  unzip
BuildRequires:  pkgconfig(SDL2_image)
BuildRequires:  pkgconfig(SDL2_mixer)
BuildRequires:  pkgconfig(gl)
BuildRequires:  pkgconfig(glu)
BuildRequires:  pkgconfig(libpng)
BuildRequires:  pkgconfig(physfs)
BuildRequires:  pkgconfig(sdl2)
Recommends:     %{name}-data
ExclusiveArch:  x86_64 aarch64

%description
D2X-Rebirth is a Source Port of the Descent ][ Engine and provides
classical gameplay combined with OpenGL graphics and effects,
a bunch of improvements and new features.

%package data
Summary:        Descent 2 - PC Interactive Demo game content
Group:          Amusements/Games/Action/Shoot
BuildArch:      noarch

%description data
D2X-Rebirth is a Source Port of the Descent ][ Engine and provides
classical gameplay combined with OpenGL graphics and effects,
a bunch of improvements and new features.

This package contains the game data from the demo version.

%prep
%setup -q -a2
dos2unix -c ascii d2x-rebirth/d2x.ini d2x-rebirth/*.txt
chmod 644 d2x-rebirth/d2x.ini d2x-rebirth/*.txt

%build
%if 0%{?force_gcc_version}
export CXX="g++-%{force_gcc_version}"
%endif

scons %{?_smp_mflags} \
      sharepath=%{_datadir}/games/descent2 \
      sdlmixer=yes \
      opengl=yes \
      sdl2=yes \
      d2x=1

%install
# binaries
install -dm 755 %{buildroot}%{_bindir}
install -m 755 build/d2x-rebirth/d2x-rebirth %{buildroot}%{_bindir}

# game data
install -dm 755 %{buildroot}%{_datadir}/games/descent2/Data
install -m 644 D2DEMO.* %{buildroot}%{_datadir}/games/descent2/Data

# german translations
install -m 644 %{SOURCE3} %{buildroot}%{_datadir}/games/descent2

# man-pages
install -dm 755 %{buildroot}%{_mandir}/man1/
install -m 644 d2x-rebirth/libmve/*.1 %{buildroot}%{_mandir}/man1/

# icon
install -dm 755 %{buildroot}%{_datadir}/pixmaps
install -m 644 d2x-rebirth/d2x-rebirth.xpm %{buildroot}%{_datadir}/pixmaps

# menu
install -dm 755 %{buildroot}%{_datadir}/applications
install -m 644 d2x-rebirth/%{name}.desktop %{buildroot}%{_datadir}/applications

%files
%license COPYING.txt GPL-3.txt
%doc README.md d2x-rebirth/*.txt
%{_bindir}/d2x-rebirth
%{_datadir}/applications/%{name}.desktop
%{_mandir}/man1/*
%{_datadir}/pixmaps/%{name}.xpm

%files data
%{_datadir}/games/descent2/
%{_datadir}/games/descent2/Data

%changelog
openSUSE Build Service is sponsored by