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

EAPI=5

LIVE=""
[[ ${PV} = 9999* ]] && LIVE=yes
MY_PN=${PN##*-}
if [[ -n ${LIVE} ]]; then
	inherit eutils subversion games
	ESVN_REPO_URI="http://svn.code.sf.net/p/simutrans/code/${MY_PN}"
else
	inherit eutils games
	MY_PV=${PV##0.}
	MY_PV=${MY_PV//./-}
	SRC_URI="mirror://sourceforge/simutrans/simupak64-${MY_PV}.zip"
	KEYWORDS="-* ~amd64 ~x86"
fi
DESCRIPTION="Official Simutrans pakset"
HOMEPAGE="http://www.simutrans.com/
	http://sourceforge.net/p/simutrans/code/HEAD/tree/pak64/"

LICENSE="Artistic"
SLOT="0"
IUSE=""

RDEPEND="
	>=games-simulation/simutrans-0.120
	"
if [[ -n ${LIVE} ]]; then
	DEPEND="|| (
			games-util/makeobj
			games-simulation/simutrans[makeobj(-)]
			)"
else
	DEPEND="app-arch/unzip"
fi

S=${WORKDIR}

src_unpack() {
	if [[ -n ${LIVE} ]]; then
		subversion_src_unpack
	else
		default
	fi
}

src_prepare() {
	if [[ -n ${LIVE} ]]; then
		# we don't need to generate the zip and tarballs
		echo '.PHONY: gentoo' >> Makefile
		echo 'gentoo: copy $(DIRS)' >> Makefile
	fi
}

src_compile() {
	if [[ -n ${LIVE} ]]; then
		mkdir build
		MAKEOBJ=$(which makeobj) \
			emake -j1 gentoo
	fi
}

src_install() {
	insinto "${GAMES_DATADIR}"/${PN}
	doins -r simutrans/pak

	games_make_wrapper ${PN} "simutrans -objects ../${PN}/pak"
	make_desktop_entry ${PN} "Simutrans (${MY_PN})" simutrans.ico

	prepgamesdirs
}

pkg_postinst() {
	games_pkg_postinst
	elog
	elog "To run Simutrans with ${MY_PN} pakset, execute:"
	elog "    ${PN}"
}