summaryrefslogtreecommitdiff
path: root/games-rpg/grimrock/grimrock-20130515.ebuild
blob: ad48b03d9a6543b5a7a67f029b35a8ec440327d3 (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
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=5
inherit eutils multilib gnome2-utils unpacker games

TIMESTAMP="${PV:0:4}-${PV:4:2}-${PV:6:2}"
MY_PN="Grimrock"
DESCRIPTION="Legend of Grimrock: The Ultimate dungeon crawling RPG + modding engine"
HOMEPAGE="http://www.grimrock.net/"
SRC_URI="LegendOfGrimrock-Linux-${TIMESTAMP}.sh"

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

QA_PREBUILT="${GAMES_PREFIX_OPT}/${PN}/${MY_PN}.bin.*
	${GAMES_PREFIX_OPT}/${PN}/lib.*"

RDEPEND="
	app-arch/bzip2
	media-libs/freetype:2
	media-libs/ilmbase
	media-libs/lcms
	=media-libs/libpng-1.6*
	media-libs/libraw
	media-libs/jasper:=
	media-libs/openexr
	media-libs/tiff
	sys-libs/zlib
	virtual/jpeg:62
	virtual/opengl
	x11-libs/libX11
	x11-libs/libXau
	x11-libs/libxcb
	x11-libs/libXdmcp
	x11-libs/libXext
	!bundled-libs? (
		media-libs/freeimage[png]
		media-libs/libogg
		media-libs/libvorbis
		media-libs/openal
		sys-libs/zlib[minizip]
	)"
DEPEND="app-arch/xz-utils"

S=${WORKDIR}

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

src_unpack() {
	use amd64 && myarch=x86_64 || myarch=x86

	local archivelist=(
		subarch
		instarchive_all
		instarchive_linux_${myarch}
		deps/SDL2/SDL2_files_linux_${myarch}
		deps/FreeImage/FreeImage_files_linux_${myarch}
		deps/libogg/libogg_files_linux_${myarch}
		deps/minizip/minizip_files_linux_${myarch}
		deps/openal/openal_files_linux_${myarch}
		deps/vorbis/vorbis_files_linux_${myarch}
	)

	unpack_makeself

	local i
	for i in $(if use bundled-libs ; then echo ${archivelist[@]} ; else echo ${archivelist[@]:0:4} ; fi) ; do
		mv "${i}" "${i}.tar.xz" || die
		unpack ./"${i}.tar.xz"
	done
}

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

	insinto "${dir}"
	doins ${PN}.{dat,png}

	exeinto "${dir}"
	doexe "${MY_PN}.bin.${myarch}"

	exeinto "${dir}"/lib
	doexe $(get_libdir)/libSDL2-2.0.so.0
	use bundled-libs && {
		doexe $(get_libdir)/lib{freeimage.so.3,minizip.so.1,ogg.so.0,openal.so.1,vorbisfile.so.3,vorbis.so.0}
	}

	games_make_wrapper "${PN}" "./${MY_PN}.bin.${myarch}" "${dir}" "${dir}"/lib
	doicon -s 256 ${PN}.png
	newicon -s 64 ${MY_PN}.png ${PN}.png
	make_desktop_entry "${PN}" "Legend of ${MY_PN}"

	dodoc README.linux
	prepgamesdirs
}

pkg_preinst() {
	games_pkg_preinst
	gnome2_icon_savelist
}

pkg_postinst() {
	games_pkg_postinst

	elog "If you are using opensource drivers you should consider installing:"
	elog "    media-libs/libtxc_dxtn"

	gnome2_icon_cache_update
}

pkg_postrm() {
	gnome2_icon_cache_update
}