summaryrefslogtreecommitdiff
blob: 937125092ac85885e3579f06e51025e2895b7d1b (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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/games-rpg/penumbra-collection/penumbra-collection-1.1.ebuild,v 1.7 2013/02/25 12:16:48 ago Exp $

EAPI=5

inherit eutils unpacker gnome2-utils games

MY_PN="PenumbraCollection"

DESCRIPTION="Scary first-person adventure game trilogy which focuses on story, immersion and puzzles"
HOMEPAGE="http://www.penumbragame.com/"
SRC_URI="${MY_PN}-${PV}.sh"

LICENSE="PENUMBRA-COLLECTION"
SLOT="0"
KEYWORDS="-* amd64 x86"
IUSE=""
RESTRICT="fetch"

RDEPEND="
	virtual/glu
	virtual/opengl
	x86? (
		media-libs/fontconfig
		media-libs/freealut
		media-libs/freetype
		media-libs/libogg
		media-libs/libsdl[X,audio,video,opengl]
		media-libs/libvorbis
		media-libs/sdl-image[gif,jpeg,png]
		media-libs/sdl-ttf
		media-gfx/nvidia-cg-toolkit
		x11-libs/fltk:1
		x11-libs/libX11
		x11-libs/libXext
		x11-libs/libXft
		x11-libs/libXrender
	)
	amd64? (
		app-emulation/emul-linux-x86-opengl
		app-emulation/emul-linux-x86-sdl
		app-emulation/emul-linux-x86-soundlibs
		app-emulation/emul-linux-x86-xlibs
	)"
DEPEND="app-arch/xz-utils"

gamedir=${GAMES_PREFIX_OPT}/${MY_PN}
INSTALL_KEY_FILE=${gamedir}/collectionkey

QA_PREBUILT="${gamedir}/Overture/penumbra.bin
	${gamedir}/BlackPlague/requiem.bin
	${gamedir}/BlackPlague/blackplague.bin"

if [[ $ARCH == amd64 ]] ; then
	QA_PREBUILT="${QA_PREBUILT}
		${gamedir}/BlackPlague/lib/libfltk.so.1.1
		${gamedir}/BlackPlague/lib/libCgGL.so
		${gamedir}/BlackPlague/lib/libCg.so
		${gamedir}/Overture/lib/libfltk.so.1.1
		${gamedir}/Overture/lib/libCgGL.so
		${gamedir}/Overture/lib/libCg.so"
fi

S=${WORKDIR}/${MY_PN}

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

src_unpack() {
	unpack_makeself

	mv subarch subarch.tar.lzma || die
	unpack ./subarch.tar.lzma

	mv instarchive_all instarchive_all.tar.lzma || die
	unpack ./instarchive_all.tar.lzma
}

src_install() {
	local destDir episodeDir library directory
	# perform instalation for each episode; note that Requiem is extension of
	# Black Plague so it has no dedicated directory at this level
	for episodeDir in Overture BlackPlague; do
		destDir="${gamedir}/${episodeDir}"

		insinto "${destDir}"

		# install every directory recursively except lib
		for directory in \
			$(find ${episodeDir}/* -maxdepth 0 -type d ! -name lib); do
			doins -r "${directory}"
		done

		# amd64 does not provide some libs, use bundled ones
		if use amd64 ; then
			exeinto "${gamedir}/${episodeDir}/lib"
			for library in \
				libfltk.so.1.1 \
				libCgGL.so \
				libCg.so; do
				doexe ${episodeDir}/lib/${library}
			done
		fi

		doins ${episodeDir}/*.cfg

		exeinto "${destDir}"
		doexe ${episodeDir}/openurl.sh ${episodeDir}/*.bin

		# make sure that cache files are newer than models otherwise the game
		# tries to regenerate them which sometimes causes a crash (as reported
		# in bug #278326 comment #6)
		touch "${D}/${destDir}"/core/*cache/*
	done

	newicon -s 64 Overture/penumbra.png penumbra-overture.png
	newicon -s 64 BlackPlague/penumbra.png penumbra-blackplague.png
	newicon -s 64 BlackPlague/requiem.png penumbra-requiem.png

	games_make_wrapper penumbra-overture ./penumbra.bin \
		"${gamedir}/Overture" "${gamedir}/Overture/lib"
	games_make_wrapper penumbra-blackplague ./blackplague.bin \
		"${gamedir}/BlackPlague" "${gamedir}/BlackPlague/lib"
	games_make_wrapper penumbra-requiem ./requiem.bin \
		"${gamedir}/BlackPlague" "${gamedir}/BlackPlague/lib"

	make_desktop_entry penumbra-overture "Penumbra: Overture" \
		penumbra-overture
	make_desktop_entry penumbra-blackplague "Penumbra: Black Plague" \
		penumbra-blackplague
	make_desktop_entry penumbra-requiem "Penumbra: Requiem" \
		penumbra-requiem

	docinto Overture
	dodoc Overture/CHANGELOG.txt Overture/Manual.pdf Overture/README.linux
	docinto BlackPlague
	dodoc BlackPlague/Manual.pdf BlackPlague/README.linux

	prepgamesdirs
}

pkg_preinst() {
	games_pkg_preinst
	gnome2_icon_savelist
}

pkg_postinst() {
	games_pkg_postinst
	gnome2_icon_cache_update

	if [[ -f "${INSTALL_KEY_FILE}" ]] ; then
		einfo "The installation key file already exists: ${INSTALL_KEY_FILE}"
	else
		ewarn "You MUST run this before playing the game:"
		ewarn "  emerge --config ${PN}"
		ewarn "To enter your installation key."
	fi
}

pkg_postrm() {
	gnome2_icon_cache_update
	einfo "If you uninstalled ${PN} you might want to remove the keyfile as well in"
	einfo "  ${INSTALL_KEY_FILE}"
}

pkg_config() {
	local key1 key2

	ewarn "Your installation key is NOT checked for validity here."
	ewarn "Make sure you type it in correctly."
	ewarn "If you CTRL+C out of this, the game will not run!"
	echo
	einfo "The key format is: XXXX-XXXX-XXXX-XXXX"
	while true ; do
		einfo "Please enter your key:"
		read key1
		if [[ -z "${key1}" ]] ; then
			echo "You entered a blank key. Try again."
			continue
		fi
		einfo "Please re-enter your key:"
		read key2
		if [[ -z "${key2}" ]] ; then
			echo "You entered a blank key. Try again."
			continue
		fi

		if [[ "${key1}" == "${key2}" ]] ; then
			echo "${key1}" | tr '[:lower:]' '[:upper:]' > "${INSTALL_KEY_FILE}"
			echo -e "// Do not give this file to ANYONE.\n// Frictional Games Support will NEVER ask for this file" \
				>> "${INSTALL_KEY_FILE}"
			einfo "Created ${INSTALL_KEY_FILE}"
			break
		else
			eerror "Your installation key entries do not match. Try again."
		fi
	done
}