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

EAPI=6

inherit desktop eutils gnome2-utils unpacker

DESCRIPTION="A physics-based action game with character-dependent solutions to challenges"
HOMEPAGE="https://www.frozenbyte.com/games/trine-enchanted-edition"
SRC_URI="TrineUpdate4.64.run"
LICENSE="frozenbyte-eula"
SLOT="0"
KEYWORDS="-* ~amd64 ~x86"
IUSE="+launcher"
RESTRICT="bindist fetch strip"

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

DEPEND="
	app-admin/chrpath
	app-arch/unzip
"

RDEPEND="
	media-gfx/nvidia-cg-toolkit
	>=media-libs/libsdl-1.2[opengl,video]
	>=media-libs/sdl-image-1.2
	>=media-libs/sdl-ttf-2.0
	>=media-libs/libvorbis-1.3
	>=media-libs/openal-1.15
	>=sys-devel/gcc-4.3.0
	>=sys-libs/glibc-2.4
	sys-libs/zlib
	x11-libs/gtk+:2
	launcher? (
		dev-libs/glib:2
		gnome-base/libglade:2.0
	)"

S="${WORKDIR}"
dir="/opt/${PN}"

pkg_nofetch() {
	einfo "Fetch ${SRC_URI} and put it into your distfiles directory."
	einfo "It is no longer available to purchase but you can still download it"
	einfo "from https://www.humblebundle.com if you bought it previously."
	einfo "Otherwise install ${CATEGORY}/trine-enchanted-edition instead."
}

src_unpack() {
	unpack_zip ${A}
}

src_prepare() {
	default
	use launcher || rm -v lib*/lib{boost*,icu*}.* || die
	rm -v lib*/lib{Cg*,direct*,fusion*,gcc_s,jpeg,m,ogg,openal,png*,rt,SDL*,selinux,stdc++,tiff,vga,vorbis*}.* || die
	chrpath --replace "${EPREFIX}${dir}"/lib trine-{bin,launcher}$(usex x86 32 64) || die
}

src_install() {
	local sfx=$(usex x86 32 64)

	insinto "${dir}"
	doins -r binds config data dev profiles *.fbz *.glade trine-logo.png

	exeinto "${dir}/lib"
	doexe lib${sfx}/*

	exeinto "${dir}"
	newexe trine-bin${sfx} ${PN}

	make_wrapper ${PN} ./${PN} "${dir}"
	make_desktop_entry ${PN} "Trine"

	# Compatibility with trine-bin.
	dosym ${PN} /usr/bin/${PN}-bin

	if use launcher ; then
		exeinto "${dir}"
		newexe trine-launcher${sfx} ${PN}-launcher

		dosym {"../..${dir}",/usr/bin}/${PN}-launcher
		make_desktop_entry ${PN}-launcher "Trine (launcher)"

		# Launcher binary has hardcoded the game path.
		dosym ${PN} "${dir}"/${PN}-bin
	fi

	newicon -s 512 Trine.xpm ${PN}.xpm
	dodoc Trine_Manual_linux.pdf Trine_updates.txt
}

pkg_preinst() { gnome2_icon_savelist; }
pkg_postinst() { gnome2_icon_cache_update; }
pkg_postrm() { gnome2_icon_cache_update; }