File openmohaa.spec of Package openmohaa

#
# spec file for package openmohaa
#
# Copyright (c) 2025 SUSE LLC and contributors
# Copyright (c) 2024-2025, Martin Hauke <mardnh@gmx.de>
#
# 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:           openmohaa
Version:        0.82.1
Release:        0
Summary:        A game engine compatible with Medal of Honor: Allied Assault
License:        GPL-2.0-only
Group:          Amusements/Games/3D/Shoot
URL:            https://www.openmohaa.org/
Source:         https://github.com/openmoh/openmohaa/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1:        wrapper.sh
BuildRequires:  bison >= 3.5.1
BuildRequires:  chrpath
BuildRequires:  cmake
BuildRequires:  flex >= 2.6.4
BuildRequires:  gcc-c++
BuildRequires:  hicolor-icon-theme
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(libcurl)
BuildRequires:  pkgconfig(mad)
BuildRequires:  pkgconfig(openal)
BuildRequires:  pkgconfig(sdl2)
BuildRequires:  pkgconfig(zlib)
Provides:       bundled(gamespy)
Provides:       bundled(jpeg-8c)
ExclusiveArch:  x86_64

%description
An open-source game engine compatible with Medal of Honor: Allied Assault
and its expansions (Spearhead and Breakthrough).

NOTE:
To play the Medal of Honor games with with openmohh you need the original
game data file files! (~/.openmohaa/)

see https://github.com/openmoh/openmohaa/blob/main/docs/getting_started_installation.md

%prep
%autosetup

%build
#FIXME:
# - manually write version info - we don't have a git repo here
# - don't write build-time timestamps into the binaries/libs
%define _lto_cflags %nil
%cmake \
  -DUSE_INTERNAL_LIBS=OFF \
  -DUSE_SYSTEM_LIBS=ON \
  -DUSE_INTERNAL_JPEG=ON \
  -DBUILD_SHARED_LIBS:BOOL=OFF \
  -DBUILD_STATIC_LIBS:BOOL=ON
%cmake_build

%install
openmohaadir=%{buildroot}%{_prefix}/lib/openmohaa
install -d -m 755 $openmohaadir
pushd build
install -m 755 openmohaa $openmohaadir/
install -m 755 omohaaded $openmohaadir/
install -m 755 code/client/cgame/cgame.so $openmohaadir/
install -m 755 code/server/fgame/game.so $openmohaadir/
install -m 755 code/Launcher/launch_openmohaa_* $openmohaadir/
install -d %{buildroot}%{_datadir}/applications/
install -m 644 misc/linux/org.openmoh.openmohaas.desktop %{buildroot}%{_datadir}/applications/org.openmoh.openmohaas.desktop
install -m 644 misc/linux/org.openmoh.openmohaab.desktop %{buildroot}%{_datadir}/applications/org.openmoh.openmohaab.desktop
install -m 644 misc/linux/org.openmoh.openmohaa.desktop %{buildroot}%{_datadir}/applications/org.openmoh.openmohaa.desktop
popd
install -Dm 644 misc/linux/org.openmoh.openmohaa.metainfo.xml %{buildroot}%{_datadir}/metainfo/org.openmoh.openmohaa.metainfo.xml
install -Dm 644 misc/openmohaa.svg %{buildroot}%{_datadir}/icons/hicolor/symbolic/apps/org.openmoh.openmohaa.svg

# install wrappers
install -d %{buildroot}/%{_bindir}/
for bin in openmohaa omohaaded launch_openmohaa_base launch_openmohaa_breakthrough launch_openmohaa_spearhead; do
  install -m 755 %{SOURCE1} %{buildroot}/%{_bindir}/$bin
done

# HACK: fix RPATH
chrpath --delete $openmohaadir/game.so

%files
%license COPYING.txt
%doc README.md
%{_bindir}/launch_openmohaa_base
%{_bindir}/launch_openmohaa_breakthrough
%{_bindir}/launch_openmohaa_spearhead
%{_bindir}/omohaaded
%{_bindir}/openmohaa
%{_prefix}/lib/openmohaa
%{_datadir}/icons/hicolor/symbolic/apps/org.openmoh.openmohaa.svg
%{_datadir}/metainfo/org.openmoh.openmohaa.metainfo.xml
%{_datadir}/applications/org.openmoh.openmohaa.desktop
%{_datadir}/applications/org.openmoh.openmohaab.desktop
%{_datadir}/applications/org.openmoh.openmohaas.desktop

%changelog
openSUSE Build Service is sponsored by