void-packages/srcpkgs/OpenRCT2/template

114 lines
4.0 KiB
Bash

# Template file for 'OpenRCT2'
# based on https://raw.githubusercontent.com/AluisioASG/void-packages/openrct2/srcpkgs/OpenRCT2/template
# and https://github.com/void-linux/void-packages/issues/1014#issuecomment-417372421
pkgname=OpenRCT2
version=0.4.5
revision=3
# versions pulled from https://raw.githubusercontent.com/OpenRCT2/OpenRCT2/v${version}/CMakeLists.txt
_objects_version=1.3.11
_titles_version=0.4.0
_replays_version=0.0.78
build_style=cmake
configure_args="
-DOPENRCT2_VERSION_TAG=${version}
-DDOWNLOAD_TITLE_SEQUENCES=0
-DDOWNLOAD_OBJECTS=0
-DDOWNLOAD_REPLAYS=0
-DDISABLE_DISCORD_RPC=1
-DDISABLE_GOOGLE_BENCHMARK=1
$(vopt_if multiplayer '' '-DDISABLE_NETWORK=1')
$(vopt_if scripting '-DENABLE_SCRIPTING=1' '')"
make_build_target="all g2"
hostmakedepends="pkg-config unzip"
makedepends="SDL2-devel fontconfig-devel freetype-devel libzip-devel
libpng-devel speexdsp-devel icu-devel zlib-devel json-c++ libxml2-devel
$(vopt_if multiplayer 'libcurl-devel openssl-devel')
$(vopt_if scripting duktape-devel)"
depends="zenity"
checkdepends="gtest-devel"
short_desc="Open source re-implementation of RollerCoaster Tycoon 2"
maintainer="klardotsh <josh@klar.sh>"
license="GPL-3.0-or-later, CC-BY-SA-4.0"
homepage="https://openrct2.io"
changelog="https://openrct2.org/changelog"
# download objects and title sequences ourselves, instead of letting cmake do it
distfiles="https://github.com/OpenRCT2/OpenRCT2/archive/v${version}.tar.gz
https://github.com/OpenRCT2/objects/releases/download/v${_objects_version}/objects.zip
https://github.com/OpenRCT2/OpenSoundEffects/releases/download/v1.0.3/opensound.zip
https://github.com/OpenRCT2/OpenMusic/releases/download/v1.3.0/openmusic.zip
https://github.com/OpenRCT2/replays/releases/download/v${_replays_version}/replays.zip
https://github.com/OpenRCT2/title-sequences/releases/download/v${_titles_version}/title-sequences.zip"
checksum="eb9e20dc0dcbf10b02b5f334a029983a0a2b43d931f95a2088a64e8b2657bab1
bf85d88e4fb11ca2e5915567390898747dc2459b3c7a057bdc32b829c91780b4
70be1b6ff8cc24ad8031a2e0cdd445b5dd3c52c886a8e5f70401f75152e4ae6c
b3423f574a969479d51dfa54f04edbe2557f37812409a9b5e5e52e59f71f4fb8
a6bdfdcc7d916ce060961c5fe7beaf43679fbfad9838cfdbd067617ae0ac0ddf
6e7c7b554717072bfc7acb96fd0101dc8e7f0ea0ea316367a05c2e92950c9029"
skip_extraction="objects.zip
opensound.zip
openmusic.zip
replays.zip
title-sequences.zip"
replaces="OpenRCT2-data>=0"
CXXFLAGS="-DNDEBUG"
build_options="multiplayer scripting"
build_options_default="multiplayer scripting"
desc_option_multiplayer="Enable multiplayer support"
desc_option_scripting="Enable script / plugin support"
if [ "$XBPS_TARGET_ENDIAN" = "be" ]; then
broken="not yet implemented"
fi
case "$XBPS_TARGET_MACHINE" in
ppc*)
CFLAGS+=" -mlong-double-64"
CXXFLAGS+=" -mlong-double-64"
;;
esac
if [ "$CROSS_BUILD" ]; then
hostmakedepends+=" OpenRCT2"
# for icu mass-rebuild
hostmakedepends+=" enchant2 libxml2 webkit2gtk libharfbuzz"
hostmakedepends+=" libnuspell libpsl"
CXXFLAGS+=" -DHAVE_IMMINTRIN_H=false -DSDL_DISABLE_IMMINTRIN_H=1"
fi
if [ "$XBPS_CHECK_PKGS" ]; then
configure_args+=" -DWITH_TESTS=1 -DSYSTEM_GTEST=1"
fi
if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
configure_args+=" -DCMAKE_CXX_STANDARD_LIBRARIES=-latomic"
fi
post_extract() {
_builddir="${build_wrksrc:+$build_wrksrc/}${cmake_builddir:=build}"
vsrcextract --no-strip-components -C data/object objects.zip
vsrcextract --no-strip-components -C data/sequence title-sequences.zip
vsrcextract --no-strip-components -C data opensound.zip
vsrcextract --no-strip-components -C data openmusic.zip
vsrcextract --no-strip-components -C test/tests/testdata/replays replays.zip
# CMakeLists seems to assume `install` is run before `check`, and so
# doesn't actually make the `data`/`testdata` symlinks in time
mkdir -p "${_builddir}"
ln -rs data testdata "${_builddir}/"
vsed -i CMakeLists.txt -e "s; -Werror;;"
}
post_patch() {
if [ "$CROSS_BUILD" ]; then
sed -i -e 's#COMMAND ./openrct2#COMMAND openrct2#g' CMakeLists.txt
fi
}
post_install() {
# remove useless static lib
rm "${DESTDIR}/usr/lib/libopenrct2.a"
}