Files
haikuports/games-simulation/openrct2/openrct2-0.4.31.recipe
2026-02-03 07:26:51 +01:00

129 lines
4.7 KiB
Bash

SUMMARY="Open source re-implementation of RollerCoaster Tycoon 2"
DESCRIPTION="OpenRCT2 is an open-source re-implementation of RollerCoaster Tycoon 2 by Chris Sawyer.
The gameplay revolves around building and maintaining an amusement park containing attractions, shops and facilities.
OpenRCT2 requires the original files from RollerCoaster Tycoon 2 in order to play.
If you have the original RollerCoaster Tycoon and its expansion packs, you can point \
OpenRCT2 to these in order to play the original scenarios.
Multithreaded rendering is disabled by default as it crashes on Haiku in certain maps and title sequences."
HOMEPAGE="https://openrct2.io/"
COPYRIGHT="2015-2025 OpenRCT2 team"
LICENSE="GNU GPL v3"
REVISION="1"
SOURCE_URI="https://github.com/OpenRCT2/OpenRCT2/archive/refs/tags/v$portVersion.tar.gz"
CHECKSUM_SHA256="89f35c764b8dcdb9519b17c24bb5aff8f8106c8cc1158c6a3604448168f4fa60"
SOURCE_DIR="OpenRCT2-$portVersion"
SOURCE_URI_2="https://github.com/OpenRCT2/title-sequences/releases/download/v0.4.26/title-sequences.zip"
CHECKSUM_SHA256_2="dabb9787b1576342fca4dd9f64b3f8cfa04a7e6ce9c2bb9610f47b762905c858"
SOURCE_URI_3="https://github.com/OpenRCT2/objects/releases/download/v1.7.5/objects.zip"
CHECKSUM_SHA256_3="c8b9d3039a920f67caf15b09e8312cc4f80d59ed7fe0288625b9ccedef606797"
SOURCE_URI_4="https://github.com/OpenRCT2/OpenSoundEffects/releases/download/v1.0.6/opensound.zip"
CHECKSUM_SHA256_4="06b90f3e19c216752df441d551b26a9e3e1ba7755bdd2102504b73bf993608be"
SOURCE_URI_5="https://github.com/OpenRCT2/OpenMusic/releases/download/v1.6.1/openmusic.zip"
CHECKSUM_SHA256_5="994b350d3b180ee1cb9619fe27f7ebae3a1a5232840c4bd47a89f33fa89de1a1"
PATCHES="openrct2-$portVersion.patchset"
ADDITIONAL_FILES="openrct2.rdef.in"
ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"
PROVIDES="
openrct2$secondaryArchSuffix = $portVersion
cmd:openrct2
cmd:openrct2_cli
lib:libopenrct2$secondaryArchSuffix
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libcrypto$secondaryArchSuffix
lib:libcurl$secondaryArchSuffix
lib:libflac$secondaryArchSuffix
lib:libfontconfig$secondaryArchSuffix
lib:libfreetype$secondaryArchSuffix
lib:libGL$secondaryArchSuffix
lib:libicuuc$secondaryArchSuffix
lib:libogg$secondaryArchSuffix
lib:libpng16$secondaryArchSuffix
lib:libSDL2_2.0$secondaryArchSuffix
lib:libspeexdsp$secondaryArchSuffix
lib:libssl$secondaryArchSuffix
lib:libvorbisfile$secondaryArchSuffix
lib:libz$secondaryArchSuffix
lib:libzip$secondaryArchSuffix
lib:libzstd$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
nlohmann_json
devel:libcurl$secondaryArchSuffix
devel:libflac$secondaryArchSuffix
devel:libfontconfig$secondaryArchSuffix
devel:libfreetype$secondaryArchSuffix
devel:libGL$secondaryArchSuffix
devel:libicuuc$secondaryArchSuffix
devel:libogg$secondaryArchSuffix
devel:libpng16$secondaryArchSuffix
devel:libpsl$secondaryArchSuffix
devel:libSDL2_2.0$secondaryArchSuffix
devel:libspeexdsp$secondaryArchSuffix
devel:libssh2$secondaryArchSuffix
devel:libssl$secondaryArchSuffix
devel:libvorbisfile$secondaryArchSuffix
devel:libz$secondaryArchSuffix
devel:libzip$secondaryArchSuffix
devel:libzstd$secondaryArchSuffix
"
BUILD_PREREQUIRES="
#cmd:ccache # Optional, to enable ccache during build
#cmd:clang >= 19 # Needed to build with clang, 12 is too old, 19 is known to work
cmd:cmake
cmd:gcc$secondaryArchSuffix
cmd:make
cmd:pkg_config$secondaryArchSuffix
"
BUILD()
{
export CXXFLAGS="-D_DEFAULT_SOURCE -D_BSD_SOURCE" LDFLAGS="-lbsd -lnetwork"
# Setup game assets
mkdir -p $sourceDir/data/sequence && cp -r $sourceDir2/* $sourceDir/data/sequence
mkdir -p $sourceDir/data/object && cp -r $sourceDir3/* $sourceDir/data/object
cp -rt $sourceDir/data $sourceDir4/* $sourceDir5/*
# Add "-DCMAKE_CXX_COMPILER=clang++" to build with clang
# korli suggests adding "-DDISABLE_OPENGL=1" to disable OpenGL-related
# linker warnings when using gcc (OpenGL renderer is experimental anyway)
cmake -Bbuild -S. $cmakeDirArgs \
-DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON
make -C build $jobArgs
}
INSTALL()
{
# Needed to generate g2.dat
make -C build install
# Generate the rdef
local MAJOR="`echo "$portVersion" | cut -d. -f1`"
local MIDDLE="`echo "$portVersion" | cut -d. -f2`"
local MINOR="`echo "$portVersion" | cut -d. -f3`"
local LONG_INFO="$SUMMARY"
sed \
-e "s|@MAJOR@|$MAJOR|" \
-e "s|@MIDDLE@|$MIDDLE|" \
-e "s|@MINOR@|$MINOR|" \
-e "s|@LONG_INFO@|$LONG_INFO|" \
$portDir/additional-files/openrct2.rdef.in > openrct2.rdef
addResourcesToBinaries openrct2.rdef $prefix/bin/openrct2
# Make the app name uppercase
mkdir -p $appsDir && mv $prefix/bin/openrct2 $appsDir/OpenRCT2
# Then link it back in lowercase for cmdline and to have man make sense
ln -s $appsDir/OpenRCT2 $prefix/bin/openrct2
addAppDeskbarSymlink $appsDir/OpenRCT2
}