summaryrefslogtreecommitdiff
blob: b62d08cd16c54bc42979d5fff5ff0830217ae8c9 (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
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI=5

CMAKE_IN_SOURCE_BUILD=1
WX_GTK_VER="3.0"
inherit eutils cmake-utils gnome2-utils wxwidgets games

MY_P="CorsixTH-${PV}-Source"

DESCRIPTION="Open source clone of Theme Hospital"
HOMEPAGE="https://github.com/CorsixTH/CorsixTH"
SRC_URI="https://github.com/CorsixTH/CorsixTH/archive/v${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="+ffmpeg mapeditor truetype opengl +sound"

RDEPEND=">=dev-lang/lua-5.1
	media-libs/libsdl[X]
	ffmpeg? ( virtual/ffmpeg )
	mapeditor? ( x11-libs/wxGTK:${WX_GTK_VER}[X] )
	truetype? ( media-libs/freetype:2 )
	opengl? ( virtual/opengl )
	sound? ( media-libs/sdl-mixer )"
DEPEND="${RDEPEND}
	virtual/pkgconfig"

S=${WORKDIR}/CorsixTH-${PV}

pkg_setup() {
	games_pkg_setup

	if use mapeditor && use !opengl ; then
		eerror "need opengl enabled for mapeditor to work!"
		die "need opengl enabled for mapeditor to work!"
	fi
}

src_prepare() {
	epatch "${FILESDIR}"/${P}-install.patch
}

src_configure() {
	local mycmakeargs=(
		$(cmake-utils_use_with opengl OPENGL)
		$(cmake-utils_use_with sound AUDIO)
		$(cmake-utils_use_with truetype FREETYPE2)
		$(cmake-utils_use_with ffmpeg MOVIES)
		$(cmake-utils_use_build mapeditor MAPEDITOR)
		-DCMAKE_INSTALL_PREFIX="${GAMES_DATADIR}"
		-DBINDIR="$(games_get_libdir)/${PN}"
	)
	cmake-utils_src_configure
}

src_compile() {
	cmake-utils_src_compile
}

src_install() {
	cmake-utils_src_install

	DOCS="CorsixTH/changelog.txt" cmake-utils_src_install
	games_make_wrapper ${PN} "$(games_get_libdir)/${PN}/CorsixTH" \
		"${GAMES_DATADIR}/CorsixTH"
	games_make_wrapper ${PN}-mapedit "$(games_get_libdir)/${PN}/MapEdit" \
		"${GAMES_DATADIR}/CorsixTH"
	newicon -s scalable CorsixTH/Original_Logo.svg ${PN}.svg
	make_desktop_entry ${PN}
	prepgamesdirs
}

pkg_preinst() {
	games_pkg_preinst
	gnome2_icon_savelist
}

pkg_postinst() {
	elog "optional dependencies:"
	elog "  media-libs/sdl-mixer[timidity] (MIDI sound support)"

	games_pkg_postinst
	gnome2_icon_cache_update
}

pkg_postrm() {
	gnome2_icon_cache_update
}