File ja2-stracciatella.spec of Package ja2-stracciatella

#
# spec file for package ja2-stracciatella
#
# 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/
#


Name:           ja2-stracciatella
Version:        0.21.0
Release:        0
Summary:        Jagged Alliance 2 Stracciatella
# SFI-SCLA to be specific
License:        SUSE-Freeware
Group:          Amusements/Games/RPG
URL:            https://ja2-stracciatella.github.io/
Source0:        https://github.com/ja2-stracciatella/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1:        ja2-autodetect
Source2:        vendor.tar.xz
# bundled libs
Source3:        https://www.lua.org/ftp/lua-5.3.6.tar.gz
Source4:        https://github.com/ThePhD/sol2/archive/v3.2.2.zip
Source5:        https://github.com/zrax/string_theory/archive/3.8.tar.gz
Source6:        https://github.com/mackron/miniaudio/archive/4dfe7c4c31df46e78d9a1cc0d2d6f1aef5a5d58c.zip
Source7:        https://github.com/Neargye/magic_enum/archive/v0.8.2.zip
BuildRequires:  cargo >= 1.63.0
BuildRequires:  cmake >= 3.18.1
BuildRequires:  desktop-file-utils
BuildRequires:  fdupes
BuildRequires:  fltk-devel
BuildRequires:  gcc-c++
BuildRequires:  git
BuildRequires:  hicolor-icon-theme
BuildRequires:  libboost_filesystem-devel
BuildRequires:  libboost_system-devel
BuildRequires:  pkgconfig
BuildRequires:  rust >= 1.1.5.0
BuildRequires:  rust-std
BuildRequires:  pkgconfig(sdl2)

%description
This is continuation of venerable JA2-Stracciatella project.
The goal of the project was to make Jagged Alliance 2 available on a wide range of platforms,
improve its stability, fix bugs and provide a stable platform for mod development.
At the moment the goal mostly to fix bugs.

To get in touch with the developers you can use the #ja2-stracciatella IRC channel on freenode.

Data files from the original game will be used by JA2-Stracciatella

How to start the game with the optional launcher
Start the launcher and use it to configure the game. It will automatically create the configuration file.
Set “JA2 Data Directory” to point to the directory where the original game was installed during step 1.
You can manually enter the directory or use the “...” button to browse your computer.
If you haven't installed the English version of the original game,
you have to select the correct “Game Version” i.e. localization.
Note that the game supports two different Russian localizations:
RUSSIAN for the “BUKA Agonia Vlasty” release and RUSSIAN_GOLD for the “Gold” release.

How to start the game without the optional launcher
Start the game the first time. It will create the configuration file ~/.ja2/ja2.json on Unix-like systems.
Edit the configuration file and set parameter data_dir to point to the directory where the
original game was installed during step 1. For example /home/user/games/ja2-installed (on Linux).
If you installed not English version of the original game, but one of the localized varieties
(e.g. French or Russian), you need to start ja2.exe with parameter telling which version of the game
you are using. For example: ja2.exe -resversion FRENCH

Supported localizations are DUTCH, ENGLISH, FRENCH, GERMAN, ITALIAN, POLISH, RUSSIAN, RUSSIAN_GOLD.
Use RUSSIAN for the “BUKA Agonia Vlasty” release and RUSSIAN_GOLD for the “Gold” release.

%prep
%setup -qa2
# lua
mkdir -p build/dependencies/lib-lua/getter/get-lua-prefix/src/
cp %{SOURCE3} build/dependencies/lib-lua/getter/get-lua-prefix/src/
# sol2
mkdir -p build/dependencies/lib-sol2/getter/get-sol2-prefix/src/
cp %{SOURCE4} build/dependencies/lib-sol2/getter/get-sol2-prefix/src/
# string_theory
mkdir -p build/dependencies/lib-string_theory/builder/string_theory-prefix/src/
cp %{SOURCE5} build/dependencies/lib-string_theory/builder/string_theory-prefix/src/
# miniaudio
mkdir -p build/dependencies/lib-miniaudio/getter/get-miniaudio-prefix/src/
cp %{SOURCE6} build/dependencies/lib-miniaudio/getter/get-miniaudio-prefix/src/
# magic_enum
mkdir -p build/dependencies/lib-magic_enum/getter/get-magic_enum-prefix/src/
cp %{SOURCE7} build/dependencies/lib-magic_enum/getter/get-magic_enum-prefix/src/

mkdir cargo-home
cat >cargo-home/config <<EOF
[source.crates-io]
registry = 'https://github.com/rust-lang/crates.io-index'
replace-with = 'vendored-sources'
[source."https://github.com/selaux/android-ndk-rs"]
git = "https://github.com/selaux/android-ndk-rs"
replace-with = "vendored-sources"

[source.vendored-sources]
directory = './vendor'
EOF

%build
export CARGO_HOME=`pwd`/cargo-home/
mkdir -p build && cd build
# NOTE that %%cmake macro breaks linking.
cmake .. \
    -DLOCAL_FLTK_LIB=OFF \
    -DLOCAL_BOOST_LIB=OFF \
    -DLOCAL_GTEST_LIB=OFF \
    -DWITH_UNITTESTS=OFF \
    -DCMAKE_INSTALL_PREFIX="%{_prefix}" \
    -DINSTALL_LIB_DIR=%{_libdir} \
    -DEXTRA_DATA_DIR=%{_datadir}/ja2
make %{?_smp_mflags} \
     OPTFLAGS="%{optflags}"

%install
export CARGO_HOME=`pwd`/cargo-home/
%cmake_install
mv %{buildroot}%{_bindir}/ja2 %{buildroot}%{_bindir}/ja2.bin
install -m 755 -p %{SOURCE1} %{buildroot}%{_bindir}/ja2
%fdupes -s %{buildroot}

%files
%license "SFI Source Code license agreement.txt"
%doc README.md
%{_bindir}/ja2*
%{_datadir}/ja2/
%{_datadir}/applications/ja2-stracciatella.desktop
%{_datadir}/icons/hicolor/scalable/apps/ja2-stracciatella.svg
%{_mandir}/man6/ja2.6%{?ext_man}

%changelog
openSUSE Build Service is sponsored by