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

EAPI=5
inherit eutils unpacker gnome2-utils games

MY_PN="Trine 2"
DESCRIPTION="A sidescrolling game of action, puzzles and platforming"
HOMEPAGE="http://www.trine2.com/"
SRC_URI="${PN}_linux_installer.run"

LICENSE="all-rights-reserved"
SLOT="0"
KEYWORDS="-* amd64 x86"
IUSE="bundled-libs +launcher"
RESTRICT="fetch bindist splitdebug"

QA_PREBUILT="${GAMES_PREFIX_OPT}/${PN}/${PN}*
	${GAMES_PREFIX_OPT}/${PN}/lib/*"

# TODO: bundled-libs: no libsdl-1.3, no physx
RDEPEND="
	amd64? (
		>=dev-libs/glib-2.34.3:2[abi_x86_32(-)]
		>=sys-libs/zlib-1.2.8-r1[abi_x86_32(-)]
		>=virtual/glu-9.0-r1[abi_x86_32(-)]
		>=virtual/opengl-7.0-r1[abi_x86_32(-)]
		>=media-libs/openal-1.15.1[abi_x86_32(-)]
		>=media-libs/libogg-1.3.0[abi_x86_32(-)]
		>=media-libs/libvorbis-1.3.3-r1[abi_x86_32(-)]
		>=media-libs/freetype-2.5.0.1[abi_x86_32(-)]
		launcher? (
			>=media-libs/fontconfig-2.10.92[abi_x86_32(-)]
			>=media-libs/libpng-1.5.18:1.5[abi_x86_32(-)]
			>=x11-libs/gtk+-2.24.23:2[abi_x86_32(-)]
			>=x11-libs/libSM-1.2.1-r1[abi_x86_32(-)]
			>=x11-libs/libX11-1.6.2[abi_x86_32(-)]
			>=x11-libs/libXinerama-1.1.3[abi_x86_32(-)]
			>=x11-libs/libXxf86vm-1.1.3[abi_x86_32(-)]
		)
		!bundled-libs? (
			media-gfx/nvidia-cg-toolkit[multilib]
		)
	)
	x86? (
		dev-libs/glib:2
		media-libs/freetype
		media-libs/libogg
		media-libs/libvorbis
		media-libs/openal
		sys-libs/zlib
		virtual/glu
		virtual/opengl
		launcher? (
			media-libs/fontconfig
			media-libs/libpng:1.5
			x11-libs/gtk+:2
			x11-libs/libSM
			x11-libs/libX11
			x11-libs/libXinerama
			x11-libs/libXxf86vm
		)
		!bundled-libs? ( media-gfx/nvidia-cg-toolkit )
	)"

S=${WORKDIR}

pkg_nofetch() {
	einfo
	einfo "Please buy & download \"${SRC_URI}\" from:"
	einfo "  ${HOMEPAGE}"
	einfo "and move/link it to \"${DISTDIR}\""
	einfo
}

src_unpack() {
	local offset="$(( $(grep -a -h -n -m 1 -F -e THIS_IS_THE_LAST_SCRIPT_LINE_ARCHIVE_DATA_FOLLOWS "${DISTDIR}"/${A} | cut -d':' -f1) + 1 ))"
	unpack_makeself ${A} "${offset}" "tail"
}

src_install() {
	local dir=${GAMES_PREFIX_OPT}/${PN}

	insinto "${dir}"
	doins -r data*

	exeinto "${dir}"
	newexe "bin/trine2_linux_32bit" ${PN}

	exeinto "${dir}/lib"
	use bundled-libs || { find lib/lib32 -type f -name "libCg*.so*" -delete || die ;}
	doexe lib/lib32/*

	games_make_wrapper ${PN} "./${PN}" "${dir}" "${dir}/lib"
	doicon -s 64 ${PN}.png
	make_desktop_entry ${PN} "${MY_PN}"

	if use launcher ; then
		exeinto "${dir}"
		newexe bin/trine2_linux_launcher_32bit ${PN}-launcher

		games_make_wrapper ${PN}-launcher "./${PN}-launcher" "${dir}" "${dir}/lib"
		make_desktop_entry ${PN}-launcher "${MY_PN} (launcher)"

		# launcher binary has hardcoded the script path
		dodir "${dir}"/bin
		dosym "${GAMES_BINDIR}"/trine2 "${dir}"/bin/trine2_bin_starter.sh
	fi

	dodoc KNOWN_LINUX_ISSUES README

	prepgamesdirs
}

pkg_preinst() {
	games_pkg_preinst
	gnome2_icon_savelist
}

pkg_postinst() {
	games_pkg_postinst

	einfo
	elog "${MY_PN} savegames and configurations are stored in:"
	elog "   \${HOME}/.frozenbyte/${MY_PN//\ /}"
	einfo

	gnome2_icon_cache_update
}

pkg_postrm() {
	gnome2_icon_cache_update
}