File simutrans-extended.spec of Package simutrans-extended

#
# spec file for package simutrans-extended
#
# 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/
#


Name:           simutrans-extended
# Version will be set by "set_version" service, but if I don't set this(↓), build will fail. Therefore, I have included a meaningless string, but don't worry.
Version:        nightly
Release:        0
Summary:        Transport and Economic Simulation Game
License:        Artistic-1.0
Group:          Amusements/Games/Strategy/Real Time
URL:            https://github.com/jamespetts/simutrans-extended.git
Source0:        simutrans-extended-%{version}.tar.gz
Source1:        http://www.simutrans.com/images/resources/simutrans-square.svg
Patch0:         simctrl-path.diff
BuildRequires:  pkgconfig(freetype2)
BuildRequires:  pkgconfig(libzstd)
BuildRequires:  pkgconfig(bzip2)
BuildRequires:  pkgconfig(libpng)
BuildRequires:  pkgconfig(sdl2)
BuildRequires:  pkgconfig(zlib)
BuildRequires:  pkgconfig(fluidsynth)
Requires:       fluid-soundfont-gm
BuildRequires:  pkgconfig(SDL2_mixer)
BuildRequires:  pkgconfig(alsa)
BuildRequires:  pkgconfig(tslib)
BuildRequires:  autoconf
BuildRequires:  dos2unix
BuildRequires:  gcc
BuildRequires:  gcc-c++
BuildRequires:  hicolor-icon-theme
BuildRequires:  pkgconfig(miniupnpc)
BuildRequires:  unzip
%if 0%{?suse_version}
BuildRequires:  fdupes
BuildRequires:  update-desktop-files
%endif
Suggests:       %{name}-makeobj

%description
Simutrans-Extended (formerly Simutrans-Experimental) is a fork of the popular open source transport simulation game, Simutrans.
Your goal is to establish a successful transport company. Transport passengers, mail and goods by rail, road, ship, and even air.
Interconnect districts, cities, public buildings, industries and tourist attractions by building a transport network you always dreamed of.

%package makeobj
Summary:        Tool for compiling simutrans data packages
Group:          Development/Tools/Other
# Package was called simutrans previously
Obsoletes:      makeobj < %{version}-%{release}

%description makeobj
Makeobj-extended is a easy to use software used to compile .dat files and .png pictures
to simutrans-extended .pak files.

%prep
%autosetup -p1
dos2unix simutrans/*.txt

%build
autoconf
./configure
%make_build
%make_build makeobj

%install
# Create starter-wrapper script (not a source so we can use directory macros):
mkdir -vp %{buildroot}%{_bindir}
cat > %{buildroot}%{_bindir}/%{name} << EOF
#!/bin/sh
cd %{_datadir}/%{name}
exec %{_libexecdir}/%{name}/sim -use_workdir \$@
EOF
chmod 755 %{buildroot}%{_bindir}/%{name}

# Install the executable "sim":
install -vDm755 simutrans-extended %{buildroot}%{_libexecdir}/%{name}/sim

# Install makeobj, avoid conflict with makeobj from kdesdk-scripts
mkdir -vp %{buildroot}%{_libexecdir}/%{name}
install -vm755 makeobj/makeobj-extended %{buildroot}%{_libexecdir}/%{name}/makeobj-extended
ln -s %{_libexecdir}/%{name}/makeobj-extended %{buildroot}%{_bindir}/makeobj-extended

# Install data
mkdir -vp %{buildroot}%{_datadir}/%{name}
cp -va simutrans/* %{buildroot}%{_datadir}/%{name}
chmod 755 %{buildroot}%{_datadir}/%{name}/envvars
chmod 755 %{buildroot}%{_datadir}/%{name}/simctrl

# Create dummy directories addons
mkdir -vp %{buildroot}%{_datadir}/%{name}/addons

# Move docs to the correct place
mkdir -vp %{buildroot}%{_docdir}/%{name}
mv -v %{buildroot}%{_datadir}/%{name}/*.txt %{buildroot}%{_docdir}/%{name}

# Install icon and .desktop file
install -vDm644 %{SOURCE1} %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg
%if 0%{?suse_version}
%suse_update_desktop_file -c simutrans-extended "Simutrans Extended" "Transportation Simulation Game" "simutrans-extended" simutrans-extended Game StrategyGame
%fdupes %{buildroot}%{_datadir}/%{name}
%endif

%files
%doc %{_docdir}/%{name}
%{_bindir}/%{name}
%{_datadir}/%{name}
%dir %{_libexecdir}/%{name}
%{_libexecdir}/%{name}/sim
%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg
%{_datadir}/applications/%{name}.desktop

%files makeobj
%{_bindir}/makeobj-extended
%dir %{_libexecdir}/%{name}
%{_libexecdir}/%{name}/makeobj-extended

%changelog
openSUSE Build Service is sponsored by