-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Expand file tree
/
Copy pathtemplate
More file actions
139 lines (123 loc) · 5.17 KB
/
template
File metadata and controls
139 lines (123 loc) · 5.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# 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.5.0
revision=1
# versions pulled from https://raw.githubusercontent.com/OpenRCT2/OpenRCT2/v${version}/CMakeLists.txt
_objects_version=1.7.9
_titles_version=0.4.26
_replays_version=0.0.92
_opensfx_version=1.0.6
_openmsx_version=1.6.1
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' '')"
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>objects-${_objects_version}.zip
https://github.com/OpenRCT2/OpenSoundEffects/releases/download/v${_opensfx_version}/opensound.zip>opensound-${_opensfx_version}.zip
https://github.com/OpenRCT2/OpenMusic/releases/download/v${_openmsx_version}/openmusic.zip>openmusic-${_openmsx_version}.zip
https://github.com/OpenRCT2/replays/releases/download/v${_replays_version}/replays.zip>replays-${_replays_version}.zip
https://github.com/OpenRCT2/title-sequences/releases/download/v${_titles_version}/title-sequences.zip>title-sequences-${_titles_version}.zip"
checksum="d9b2f34205c3fddc127be0623eae13c3e970917fa69714c861ec564c2d54d6d0
55461ed20c6e82f14e9a279cd844654b0264999bb94034d58fa912fdee26ead6
06b90f3e19c216752df441d551b26a9e3e1ba7755bdd2102504b73bf993608be
994b350d3b180ee1cb9619fe27f7ebae3a1a5232840c4bd47a89f33fa89de1a1
455a19172a8df81b935a942bbbda20167b4740b34653fdb74127740686bf4cbe
dabb9787b1576342fca4dd9f64b3f8cfa04a7e6ce9c2bb9610f47b762905c858"
skip_extraction="objects-${_objects_version}.zip
opensound-${_opensfx_version}.zip
openmusic-${_openmsx_version}.zip
replays-${_replays_version}.zip
title-sequences-${_titles_version}.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 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
post_extract() {
_builddir="${build_wrksrc:+$build_wrksrc/}${cmake_builddir:=build}"
vsrcextract --no-strip-components -C data/object objects-${_objects_version}.zip
vsrcextract --no-strip-components -C data/sequence title-sequences-${_titles_version}.zip
vsrcextract --no-strip-components -C data opensound-${_opensfx_version}.zip
vsrcextract --no-strip-components -C data openmusic-${_openmsx_version}.zip
vsrcextract --no-strip-components -C test/tests/testdata/replays replays-${_replays_version}.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
}
_check_versions() {
local version_var="$1"
local expected_version="$2"
local actual_version=$(grep "http.*$version_var" assets.json | sed -E 's,.*/v([0-9.]+)/.*,\1,')
if [ "$actual_version" != "$expected_version" ]; then
echo "Warning: ${version_var} mismatch"
echo "Expected: $expected_version"
echo "Actual: $actual_version"
return 1
fi
return 0
}
pre_configure() {
local mismatch=0
_check_versions "objects" "$_objects_version" || mismatch=1
_check_versions "title-sequences" "$_titles_version" || mismatch=1
_check_versions "replays" "$_replays_version" || mismatch=1
_check_versions "OpenSoundEffects" "$_opensfx_version" || mismatch=1
_check_versions "OpenMusic" "$_openmsx_version" || mismatch=1
if [ $mismatch -eq 1 ]; then
echo "Version mismatch detected. Please update the template with the correct versions."
return 1
fi
}
post_install() {
# remove useless static lib
rm "${DESTDIR}/usr/lib/libopenrct2.a"
}