File d1x-rebirth.spec of Package d1x-rebirth

#
# spec file for package d1x-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:           d1x-rebirth
Version:        0.61+git.20250112
Release:        0
Summary:        Port of the 1995 classic game Descent 1: First Strike
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/descent-pc-shareware.zip
Source3:        https://www.dxx-rebirth.com/download/dxx/res/d1xr-hires.dxa
Source4:        https://www.dxx-rebirth.com/download/dxx/res/d1xr-briefings-ger.dxa
BuildRequires:  dos2unix
BuildRequires:  gcc%{?force_gcc_version}-c++
BuildRequires:  nasm
BuildRequires:  pkgconfig
BuildRequires:  scons >= 4.2
BuildRequires:  unzip
BuildRequires:  update-desktop-files
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
D1X-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 - PC Shareware game content
Group:          Amusements/Games/Action/Shoot
Requires:       %{name} = %{version}
BuildArch:      noarch

%description data
D1X-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 shareware version.

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

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

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

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

# game data
install -dm 755 %{buildroot}%{_datadir}/games/descent
install -m 644 descent.pig %{buildroot}%{_datadir}/games/descent
install -m 644 descent.hog %{buildroot}%{_datadir}/games/descent
install -m 644 %{SOURCE3} %{buildroot}%{_datadir}/games/descent
install -m 644 %{SOURCE4} %{buildroot}%{_datadir}/games/descent

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

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

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

%files data
%{_datadir}/games/descent/

%changelog
openSUSE Build Service is sponsored by