From 837720d7979f6d70b59f78cfddb24464628c7423 Mon Sep 17 00:00:00 2001
From: Will Springer <skirmisher@protonmail.com>
Date: Jan 17 2023 19:50:51 +0000
Subject: Update openrct2 to 0.4.3


---

diff --git a/openrct2.spec b/openrct2.spec
index 3df04e8..a97cccf 100644
--- a/openrct2.spec
+++ b/openrct2.spec
@@ -2,28 +2,36 @@
 %bcond_without tests
 
 Name:		openrct2
-Version:	0.4.0
+Version:	0.4.3
 Release:	1%{?dist}
-# these should only be updated in tandem with a new version (afaict)
-%global		objects_version		1.2.7
+# these should only be updated in tandem with a new OpenRCT2 version
+%global		objects_version		1.3.7
 %global		sequences_version	0.4.0
-%global		replays_version		0.0.67
+%global		replays_version		0.0.70
 Summary:	An open source re-implementation of RollerCoaster Tycoon 2
 
-License:	GPLv3 and CC-BY-SA
-URL:		https://www.openrct2.org
+License:	GPL-3.0-only AND CC-BY-SA-4.0
+URL:		https://www.openrct2.io
 Source0:	https://github.com/OpenRCT2/OpenRCT2/archive/v%{version}.tar.gz#/OpenRCT2-%{version}.tar.gz
-Source1:	https://github.com/OpenRCT2/objects/releases/download/v%{objects_version}/objects.zip
-Source2:	https://github.com/OpenRCT2/title-sequences/releases/download/v%{sequences_version}/title-sequences.zip
+Source1:	https://github.com/OpenRCT2/objects/releases/download/v%{objects_version}/objects.zip#/objects-%{version}.zip
+Source2:	https://github.com/OpenRCT2/title-sequences/releases/download/v%{sequences_version}/title-sequences.zip#/title-sequences-%{version}.zip
 %if %{with tests}
-Source3:	https://github.com/OpenRCT2/replays/releases/download/v%{replays_version}/replays.zip
+Source3:	https://github.com/OpenRCT2/replays/releases/download/v%{replays_version}/replays.zip#/replays-%{version}.zip
 %endif
 
-BuildRequires:	gcc-c++ desktop-file-utils cmake google-benchmark-devel json-devel libicu-devel openssl-devel duktape-devel pkgconfig pkgconfig(sdl2) pkgconfig(speexdsp) pkgconfig(libcurl) pkgconfig(fontconfig) pkgconfig(freetype2) pkgconfig(libpng) pkgconfig(libzip) pkgconfig(zlib) pkgconfig(gl)
+# Move internal shared library to subdirectory of libdir
+Patch0:		move-private-lib.diff
+# Work around bogus -Wrestrict warnings (rhbz#2047428)
+Patch1:		work-around-rhbz-2047428.diff
+
+BuildRequires:	cmake gcc-c++ desktop-file-utils google-benchmark-devel json-devel libicu-devel
+BuildRequires:	pkgconfig pkgconfig(sdl2) pkgconfig(speexdsp) pkgconfig(libcurl) pkgconfig(fontconfig) pkgconfig(freetype2) pkgconfig(libpng) pkgconfig(libzip) pkgconfig(zlib) pkgconfig(gl) pkgconfig(flac) pkgconfig(ogg) pkgconfig(vorbisfile) pkgconfig(openssl)
 %if %{with tests}
 BuildRequires:	gtest-devel
 %endif
 
+Recommends:	%{name}-opensoundeffects %{name}-openmusic
+
 %description
 OpenRCT2 is an open-source re-implementation of RollerCoaster Tycoon 2 (RCT2),
 expanding the game with new features, fixing bugs and raising game limits. The
@@ -42,9 +50,7 @@ order to play OpenRCT2; visit https://openrct2.io/getting-started/ for details.
 # This gets repeated a lot, unfortunately
 %global srcdir_name OpenRCT2-%{version}
 
-%setup -q -n %{srcdir_name}
-# Fedora json package uses amalgamated header
-sed -i 's#nlohmann/json_fwd.hpp#nlohmann/json.hpp#' src/openrct2/core/JsonFwd.hpp
+%autosetup -p1 -n %{srcdir_name}
 
 # CMakeLists pulls in data/* for install, so put these there too
 %setup -q -T -a 1 -c -n %{srcdir_name}/data/object
@@ -59,11 +65,20 @@ sed -i 's#nlohmann/json_fwd.hpp#nlohmann/json.hpp#' src/openrct2/core/JsonFwd.hp
 %setup -q -T -D -n %{srcdir_name}
 
 %build
+# work around use of OpenSSL APIs depcrecated in 3.0.0
+# https://github.com/OpenRCT2/OpenRCT2/issues/16726
+export CFLAGS+=" -DOPENSSL_API_COMPAT=10101 "
+export CXXFLAGS+=" -DOPENSSL_API_COMPAT=10101 "
+
+# fail git ops even if building in subdir of package repo
+export GIT_DIR=/dev/null
+
 %if %{with tests}
 %global cmake_test_opts -DWITH_TESTS=ON -DSYSTEM_GTEST=ON
 %endif
 %cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DDOWNLOAD_TITLE_SEQUENCES=OFF \
 	-DDOWNLOAD_OBJECTS=OFF -DDOWNLOAD_REPLAYS=OFF -DDISABLE_DISCORD_RPC=ON \
+	-DDOWNLOAD_OPENSFX=OFF -DDOWNLOAD_OPENMSX=OFF \
 	%{?cmake_test_opts}
 
 %cmake_build
@@ -72,6 +87,11 @@ sed -i 's#nlohmann/json_fwd.hpp#nlohmann/json.hpp#' src/openrct2/core/JsonFwd.hp
 
 %install
 %cmake_install
+# These directories used by the add-on "sub"packages should be explicitly
+# created, so that they get cleaned up properly on uninstall(?)
+install -d -m755 \
+	%{buildroot}%{_datadir}/%{name}/assetpack \
+	%{buildroot}%{_datadir}/%{name}/object/official/{audio,music}
 
 %check
 %if %{with tests}
@@ -83,14 +103,13 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/%{name}*.desktop
 %files
 %{_bindir}/%{name}
 %{_bindir}/%{name}-cli
-%{_libdir}/lib%{name}.so
+%dir %{_libdir}/%{name}
+%{_libdir}/%{name}/lib%{name}.so
 
-%dir %{_datadir}/%{name}
-%{_datadir}/%{name}/*
+%{_datadir}/%{name}/
 
-%dir %{_docdir}/%{name}
-%doc %{_docdir}/%{name}/*
-%license %{_docdir}/%{name}/licence.txt
+%{_pkgdocdir}/
+%license %{_pkgdocdir}/licence.txt
 
 %{_datadir}/icons/hicolor/*/apps/%{name}.png
 %{_datadir}/icons/hicolor/scalable/apps/%{name}.svg
@@ -99,10 +118,16 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/%{name}*.desktop
 %{_datadir}/mime/packages/%{name}.xml
 %{_datadir}/metainfo/%{name}.appdata.xml
 
-%{_datadir}/man/man6/%{name}*.6*
+%{_mandir}/man6/%{name}*.6*
 
 %changelog
 
+* Tue Jan 17 2023 Will Springer <skirmisher@protonmail.com> - 0.4.3-1
+- Update to 0.4.3
+- Switch to SPDX identifiers for License field
+- Add OpenMusic and OpenSoundEffects weak deps
+- Move internal shared library out of global libdir
+
 * Mon Jun 6 2022 Will Springer <skirmisher@protonmail.com> - 0.4.0-1
 - Update to 0.4.0
 

