File vegastrike.spec of Package vegastrike

#
# spec file for package vegastrike
#
# Copyright (c) 2023 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 srcname Vega-Strike-Engine-Source
Name:           vegastrike
Version:        0.8.0
Release:        0
Summary:        3D OpenGL spaceflight simulator
License:        GPL-2.0-or-later
Group:          Amusements/Games/3D/Simulation
URL:            https://www.vega-strike.org/
Source0:        https://github.com/vegastrike/%{srcname}/archive/refs/tags/v%{version}.tar.gz#/%{srcname}-%{version}.tar.gz
# PATCH-FIX-UPSTREAM -- https://github.com/vegastrike/Vega-Strike-Engine-Source/pull/445
Patch0:         0001-cmake-Install-man-pages-into-matching-sub-directory.patch
# PATCH-FIX-UPSTREAM -- https://github.com/vegastrike/Vega-Strike-Engine-Source/issues/777 - part of pull/774
Patch1:         fix-consider-include-eval_h.patch
BuildRequires:  cmake
BuildRequires:  fdupes
BuildRequires:  libboost_atomic-devel
BuildRequires:  libboost_filesystem-devel
BuildRequires:  libboost_log-devel
BuildRequires:  libboost_python3-devel
BuildRequires:  libboost_system-devel
BuildRequires:  libboost_thread-devel
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(expat)
BuildRequires:  pkgconfig(glu)
BuildRequires:  pkgconfig(glut)
BuildRequires:  pkgconfig(gtk+-3.0)
BuildRequires:  pkgconfig(libjpeg)
BuildRequires:  pkgconfig(libpng)
BuildRequires:  pkgconfig(openal)
BuildRequires:  pkgconfig(opengl)
BuildRequires:  pkgconfig(python3)
BuildRequires:  pkgconfig(sdl)
BuildRequires:  pkgconfig(vorbis)
Requires:       hicolor-icon-theme
Requires:       xdg-utils
Recommends:     %{name}-data >= %{version}
# aarch64 build will be done in version 0.9.0 - https://github.com/vegastrike/Vega-Strike-Engine-Source/pull/670
ExcludeArch:    aarch64
%if 0%{?sle_version} >= 150400 && 0%{?sle_version} < 160000 && 0%{?is_opensuse}
BuildRequires:  gcc11
BuildRequires:  gcc11-PIE
BuildRequires:  gcc11-c++
%else
BuildRequires:  gcc12
BuildRequires:  gcc12-PIE
BuildRequires:  gcc12-c++
%endif

%description
Vega Strike is a GPL 3D OpenGL Action RPG space sim that allows a player to
trade and bounty hunt. You start in an old beat up Wayfarer cargo ship, with
endless possibility before you and just enough cash to scrape together a life.
Yet danger lurks in the space beyond.

%prep
%autosetup -p1 -n %{srcname}-%{version}
%if 0%{?suse_version} < 1550
sed -ie 's/Boost COMPONENTS python/Boost COMPONENTS python3/' engine/CMakeLists.txt
%endif

%build
%cmake \
%if 0%{?sle_version} >= 150400 && 0%{?sle_version} < 160000 && 0%{?is_opensuse}
  -DCMAKE_C_COMPILER=gcc-11 \
  -DCMAKE_CXX_COMPILER=g++-11 \
%else
  -DCMAKE_C_COMPILER=gcc-12 \
  -DCMAKE_CXX_COMPILER=g++-12 \
%endif
  -DDATADIR=%{_datadir}/%{name} \
  -DUSE_PYTHON_3:BOOL=ON \
  -DUSE_SYSTEM_BOOST:BOOL=ON \
  -DBUILD_STATIC_LIBS:BOOL=ON \
  -DBUILD_SHARED_LIBS:BOOL=OFF \
  -DCMAKE_BUILD_TYPE="Release" \
  -DENABLE_PIE:BOOL=ON \
  ../engine
%make_build

%install
%cmake_install

# We let RPM install it correctly itself - only needed for openSUSE Leap 15.5 because of older cmake version
rm -rfv %{buildroot}%{_datadir}/doc/Vega_Strike

# Remove duplicates
%fdupes %{buildroot}%{_mandir}
%fdupes %{buildroot}%{_bindir}

%files
%if 0%{?sle_version} == 150500 && 0%{?sle_version} < 160000 && 0%{?is_opensuse}
%doc AUTHORS README.md
%else
%doc AUTHORS AUTHORS.GITHUB AUTHORS.SF ChangeLog README.md
%endif
%license LICENSE
%{_bindir}/vega*
%{_mandir}/man1/*

%changelog
openSUSE Build Service is sponsored by