blob: fef1b3e584514235b77f770526d109d6e14f6410 (
plain)
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
|
# Copyright 2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
LUA_COMPAT=( lua5-{1,3,4} luajit )
inherit cmake edo lua-single xdg
MY_PN="CorsixTH"
MY_PV="${PV/_/-}"
MY_P="${MY_PN}-${MY_PV}"
DESCRIPTION="Open source clone of Theme Hospital"
HOMEPAGE="https://corsixth.com"
if [[ ${PV} == 9999 ]] ; then
EGIT_REPO_URI="https://github.com/${MY_PN}/${MY_PN}"
inherit git-r3
else
SRC_URI="https://github.com/${MY_PN}/${MY_PN}/archive/v${MY_PV}.tar.gz -> ${P}.tar.gz"
S="${WORKDIR}/${MY_P}"
if [[ ${PV} != *_beta* && ${PV} != *_rc* ]] ; then
KEYWORDS="~amd64 ~arm64 ~ppc64 ~x86"
fi
fi
LICENSE="MIT"
SLOT="0"
IUSE="doc +midi test tools +videos"
RESTRICT="!test? ( test )"
REQUIRED_USE="${LUA_REQUIRED_USE}"
RDEPEND="
${LUA_DEPS}
$(lua_gen_cond_dep '
>=dev-lua/luafilesystem-1.5[${LUA_USEDEP}]
>=dev-lua/lpeg-0.9[${LUA_USEDEP}]
>=dev-lua/luasocket-3.0_rc1-r4[${LUA_USEDEP}]
')
media-libs/libsdl3[opengl]
media-libs/libpng:=
>=media-libs/freetype-2.5.3:2
media-libs/sdl3-mixer[midi?]
virtual/zlib:=
midi? (
media-libs/rtmidi
)
videos? ( >=media-video/ffmpeg-2.2.3:0= )
"
DEPEND="${RDEPEND}"
# Although the docs could potentially be built with nearly any Lua version,
# we need to ensure the necessary Lua modules are installed, so pin to the
# same single version as runtime.
BDEPEND="
virtual/pkgconfig
doc? (
app-text/doxygen[dot]
${LUA_DEPS}
$(lua_gen_cond_dep '
>=dev-lua/luafilesystem-1.5[${LUA_USEDEP}]
>=dev-lua/lpeg-0.9[${LUA_USEDEP}]
')
)
test? (
>=dev-cpp/catch-3:0
)
"
PATCHES=(
"${FILESDIR}"/${PN}-9999-cmake_lua_detection.patch
)
lua_enable_tests busted
src_configure() {
local mycmakeargs=(
-DBUILD_TOOLS=$(usex tools)
-DENABLE_UNIT_TESTS=$(usex test)
-DFETCH_SDL_MIXER=OFF
-DFETCH_SOUNDFONT=OFF
-DFETCH_UNICODE_FONT=OFF
-DWITH_MIDI_DEVICE=$(usex midi)
-DWITH_MOVIES=$(usex videos)
-DWITH_UPDATE_CHECK=OFF
)
if use lua_single_target_luajit ; then
mycmakeargs+=(
-DLUA_VERSION=5.1
-DLUA_LIBRARY=$(lua_get_shared_lib)
-DWITH_LUAJIT=ON
)
else
mycmakeargs+=(
-DLUA_VERSION=$(lua_get_version)
)
fi
if use test ; then
mycmakeargs+=(
-DFETCH_CATCH2=OFF
)
fi
cmake_src_configure
}
src_compile() {
cmake_src_compile
use doc && cmake_src_compile doc
}
src_test() {
# https://github.com/CorsixTH/CorsixTH/blob/master/.github/workflows/Linux.yml#L88
# C++ tests
BUILD_DIR="${BUILD_DIR}"/CorsixTH cmake_src_test
# Lua tests
# vip_spec.lua fails with luajit
edo busted \
--lua="${ELUA}" \
--output="TAP" \
--verbose \
--directory=CorsixTH/Luatest \
--filter-out='VIP.*rating'
}
src_install() {
cmake_src_install
dodoc changelog.txt CONTRIBUTING.md
docinto html
use doc && dodoc -r "${BUILD_DIR}"/doc/*
}
|