File pioneer.spec of Package pioneer

#
# spec file for package pioneer
#
# Copyright (c) 2024 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/
#


%define use_external_lua 0
%define app_id net.pioneerspacesim.Pioneer
%if 0%{?suse_version} < 1650
%define gcc_ver 11
%endif
Name:           pioneer
Version:        20240710
Release:        0
Summary:        A game of lonely space adventure
License:        GPL-3.0-only
Group:          Amusements/Games/3D/Simulation
URL:            https://pioneerspacesim.net/
Source:         https://github.com/pioneerspacesim/pioneer/archive/%{version}.tar.gz
Patch0:         use_system_fmt.patch
BuildRequires:  cmake
BuildRequires:  fdupes
# https://github.com/pioneerspacesim/pioneer/issues/5810 - gcc9 is minimum
BuildRequires:  gcc%{?gcc_ver}-c++
BuildRequires:  hicolor-icon-theme
BuildRequires:  pkgconfig
BuildRequires:  update-desktop-files
BuildRequires:  cmake(fmt) >= 10
BuildRequires:  pkgconfig(SDL2_image)
BuildRequires:  pkgconfig(assimp) >= 5.0.1
BuildRequires:  pkgconfig(freetype2)
BuildRequires:  pkgconfig(gl)
BuildRequires:  pkgconfig(glew)
BuildRequires:  pkgconfig(libpng)
BuildRequires:  pkgconfig(sdl2)
BuildRequires:  pkgconfig(sigc++-2.0)
BuildRequires:  pkgconfig(vorbis)
Requires:       %{name}-data = %{version}
%if %{use_external_lua}
BuildRequires:  Lua(devel) = 5.2
%endif

%description
Pioneer is a space adventure game set in our galaxy at the turn of the 31st century.

The game is open-ended, and you are free to eke out whatever kind of space-faring
existence you can think of. Look for fame or fortune by exploring the millions of
star systems. Turn to a life of crime as a pirate, smuggler or bounty hunter. Forge
and break alliances with the various factions fighting for power, freedom or self-
determination. The universe is whatever you make of it.

%package data
Summary:        Pioneer: art and other architecture independent data
Group:          Amusements/Games/3D/Simulation
Requires:       %{name} = %{version}
BuildArch:      noarch

%description data
Pioneer is a space adventure game set in our galaxy at the turn of the 31st century.

%prep
%autosetup -p1

%build
export CXXFLAGS="%{optflags} -Wno-error=return-type"
%cmake \
    -DCMAKE_C_COMPILER=gcc%{?gcc_ver:-%{gcc_ver}} \
    -DCMAKE_CXX_COMPILER=g++%{?gcc_ver:-%{gcc_ver}} \
%if %{use_external_lua}
    -DUSE_SYSTEM_LIBLUA=ON \
%endif
    -DUSE_SYSTEM_LIBGLEW=ON
%cmake_build
%cmake_build build-data

%install
%cmake_install
rm -r %{buildroot}%{_datadir}/icons/hicolor/40x40
find "%{buildroot}%{_datadir}/%{name}" -type f -name ".gitignore" -exec rm {} \;
for i in editor modelcompiler savegamedump; do
    mv %{buildroot}%{_bindir}/{,%{name}_}$i
done

%fdupes %{buildroot}%{_datadir}/%{name}

%files
%{_bindir}/%{name}*
%{_datadir}/applications/%{app_id}.desktop
%{_datadir}/metainfo/%{app_id}.metainfo.xml
%{_datadir}/icons/hicolor/*/apps/%{app_id}.png
%doc AUTHORS.txt Changelog.txt Quickstart.txt README.md

%files data
%{_datadir}/%{name}

%changelog
openSUSE Build Service is sponsored by