summaryrefslogtreecommitdiff
blob: 60803bf4b9a596ed3ae49e33a5b61211f8a38550 (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
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit autotools desktop flag-o-matic toolchain-funcs xdg

MY_PV=${PV//./-}
MY_PAK_64="simupak64-${MY_PV}.zip"
# Required for network games, published in release announcement on the forums
MY_SVN_REVISION="11164"

DESCRIPTION="A free Transport Tycoon clone"
HOMEPAGE="https://www.simutrans.com/"
SRC_URI="
	https://downloads.sourceforge.net/simutrans/simutrans-src-${MY_PV}.zip
	!minimal? ( https://downloads.sourceforge.net/simutrans/${MY_PAK_64} -> simutrans_${MY_PAK_64} )
	https://tastytea.de/files/gentoo/simutrans_language_pack-Base+texts-${PV}.zip
"
S="${WORKDIR}"

# NOTE: get the latest language pack from:
# https://simutrans-germany.com/translator/data/tab/language_pack-Base+texts.zip

LICENSE="Artistic"
SLOT="0"
KEYWORDS="~amd64 ~arm64 ~x86"
IUSE="minimal +midi fontconfig upnp zstd"

DEPEND="
	app-arch/bzip2
	media-libs/freetype
	media-libs/libpng:0=
	media-libs/libsdl2[sound,video]
	sys-libs/zlib
	midi? ( media-sound/fluidsynth:=[sdl] )
	fontconfig? ( media-libs/fontconfig )
	upnp? ( net-libs/miniupnpc:= )
	zstd? ( app-arch/zstd )
"
# miniupnpc restriction: bug #935134
RDEPEND="
	${DEPEND}
	midi? ( media-sound/fluid-soundfont )
	!<games-simulation/simutrans-paksets-${PV}
"
BDEPEND="
	app-arch/unzip
	virtual/pkgconfig
"
RESTRICT="test" # Opens the program and doesn't close it.

PATCHES=(
	"${FILESDIR}"/${PN}-124.0-disable-svn-check.patch
	"${FILESDIR}"/${P}-fix-miniupnpc-api.patch
)

src_unpack() {
	unpack "simutrans-src-${MY_PV}.zip"
	cd simutrans || die "could not cd to ‘simutrans’"
	use minimal || unpack "simutrans_${MY_PAK_64}"

	# Bundled text files are incomplete, bug #580948
	cd text || die "could not cd to ‘simutrans/text’"
	unpack "simutrans_language_pack-Base+texts-${PV}.zip"
}

src_prepare() {
	default
	xdg_environment_reset

	strip-flags # bug #293927
	append-flags -fno-strict-aliasing # bug #859229

	eautoreconf
}

src_configure() {
	default

	# NOTE: some flags need to be 0, some need to be empty to turn them off
	cat > config.default <<-EOF || die
		BACKEND=sdl2
		OSTYPE=linux
		OPTIMISE=0
		STATIC=0
		WITH_REVISION=${MY_SVN_REVISION}
		MULTI_THREAD=1
		USE_UPNP=$(usex upnp 1 '')
		USE_FREETYPE=1
		USE_ZSTD=$(usex zstd 1 '')
		USE_FONTCONFIG=$(usex fontconfig 1 '')
		USE_FLUIDSYNTH_MIDI=$(usex midi 1 '')
		VERBOSE=1

		HOSTCC = $(tc-getCC)
		HOSTCXX = $(tc-getCXX)
	EOF
}

src_install() {
	newbin build/default/sim ${PN}
	insinto usr/share/${PN}
	doins -r simutrans/*
	doicon src/simutrans/${PN}.svg
	domenu src/linux/simutrans.desktop
}

pkg_postinst() {
	xdg_pkg_postinst

	elog "Since 124.0 simutrans allows you to download PakSets to your home directory,"
	elog "therefore games-simulation/simutrans-paksets has been deprecated."
}