]> Pileus Git - ~andy/sunrise/blob - games-rpg/penumbra-collection/penumbra-collection-1.1.ebuild
b0e1b3806dbfb90ded41bc68960aeebe991a12f2
[~andy/sunrise] / games-rpg / penumbra-collection / penumbra-collection-1.1.ebuild
1 # Copyright 1999-2010 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
4
5 EAPI=1
6
7 inherit eutils games
8
9 # define own package name
10 MY_PN="PenumbraCollection"
11
12 DESCRIPTION="Scary first-person adventure game trilogy which focuses on story, immersion and puzzles"
13 HOMEPAGE="http://www.penumbragame.com/"
14 SRC_URI="${MY_PN}-${PV}.sh"
15
16 LICENSE="PENUMBRA-COLLECTION"
17 SLOT="0"
18 KEYWORDS="~amd64"
19 IUSE=""
20 PROPERTIES="interactive"
21 RESTRICT="fetch strip"
22
23 DEPEND="|| ( app-arch/xz-utils app-arch/lzma-utils )"
24 RDEPEND="virtual/opengl
25         x86? (
26                 x11-libs/libXft
27                 media-libs/freealut
28                 media-gfx/nvidia-cg-toolkit
29                 x11-libs/fltk:1.1
30                 media-libs/sdl-image
31                 media-libs/sdl-ttf
32                 media-libs/libvorbis )
33         amd64? (
34                 app-emulation/emul-linux-x86-sdl )"
35
36 GAMES_CHECK_LICENSE="yes"
37 dir=${GAMES_PREFIX_OPT}/${MY_PN}
38 INSTALL_KEY_FILE=${dir}/collectionkey
39
40 S=${WORKDIR}/${MY_PN}
41
42 pkg_nofetch() {
43         einfo "Please buy & download ${SRC_URI} from:"
44         einfo "  ${HOMEPAGE}"
45         einfo "and move it to ${DISTDIR}"
46         einfo
47 }
48
49 src_unpack() {
50         unpack_makeself || die "unpack installator"
51
52         # give proper extension to subarchive so unpack recognizes it
53         mv subarch subarch.tar.lzma || die "rename subarch"
54
55         unpack ./subarch.tar.lzma || die "unpack install archive"
56
57         # give proper extension to install archive so unpack recognizes it
58         mv instarchive_all instarchive_all.tar.lzma || \
59                 die "rename instarchive_all"
60
61         unpack ./instarchive_all.tar.lzma || die "unpack install archive"
62 }
63
64 src_install() {
65
66         # perform instalation for each episode; note that Requiem is extension of
67         # Black Plague so it has no dedicated directory at this level
68         for episodeDir in Overture BlackPlague; do
69                 local destDir="${dir}/${episodeDir}"
70
71                 # install game data files
72                 insinto ${destDir}
73
74                 # >install every directory recursively except lib
75                 for directory in \
76                         $(find ${episodeDir}/* -maxdepth 0 -type d ! -name lib); do
77                         doins -r ${directory} || die "doins game data files"
78                 done
79
80                 # >install .cfg files
81                 doins ${episodeDir}/*.cfg || die "doins .cfg files"
82
83                 # install libraries and executables
84                 exeinto ${destDir}
85                 doexe ${episodeDir}/openurl.sh ${episodeDir}/*.bin || \
86                         die "doexe binaries"
87
88                 # >amd64 does not provide some libs, use bundled ones
89                 if use amd64 ; then
90                         exeinto "${dir}/${episodeDir}/lib"
91                         for library in \
92                                 libfltk.so.1.1 \
93                                 libCgGL.so \
94                                 libCg.so; do
95                                 doexe ${episodeDir}/lib/${library} || die "doexe libraries"
96                         done
97                 fi
98
99                 # make sure that cache files are newer than models otherwise the game
100                 # tries to regenerate them which sometimes causes a crash (as reported
101                 # in bug #278326 comment #6)
102                 touch ${D}/${destDir}/core/*cache/*
103         done
104
105         # install icons
106         newicon Overture/penumbra.png penumbra-overture.png || \
107                 die "newicon overture"
108         newicon BlackPlague/penumbra.png penumbra-blackplague.png || \
109                 die "newicon black plague"
110         newicon BlackPlague/requiem.png penumbra-requiem.png || \
111                 die "newicon requiem"
112
113         # make game wrappers
114         games_make_wrapper penumbra-overture ./penumbra.bin \
115                 "${dir}/Overture" "${dir}/Overture/lib" || \
116                 die "games_make_wrapper overture"
117         games_make_wrapper penumbra-blackplague ./blackplague.bin \
118                 "${dir}/BlackPlague" "${dir}/BlackPlague/lib" || \
119                 die "games_make_wrapper black plague"
120         games_make_wrapper penumbra-requiem ./requiem.bin \
121                 "${dir}/BlackPlague" "${dir}/BlackPlague/lib" || \
122                 die "games_make_wrapper requiem"
123
124         # make desktop entries
125         make_desktop_entry penumbra-overture "Penumbra: Overture" \
126                 penumbra-overture || die "make_desktop_entry overture"
127         make_desktop_entry penumbra-blackplague "Penumbra: Black Plague" \
128                 penumbra-blackplague || die "make_desktop_entry black plague"
129         make_desktop_entry penumbra-requiem "Penumbra: Requiem" \
130                 penumbra-requiem || die "make_desktop_entry requiem"
131
132         # install documentation
133         docinto Overture
134         dodoc Overture/CHANGELOG.txt Overture/Manual.pdf Overture/README.linux || \
135                 die "dodoc overture"
136         docinto BlackPlague
137         dodoc BlackPlague/Manual.pdf BlackPlague/README.linux || \
138                 die "dodoc black plague"
139
140         prepgamesdirs
141 }
142
143 pkg_postinst() {
144         games_pkg_postinst
145
146         if [[ -f "${INSTALL_KEY_FILE}" ]] ; then
147                 einfo "The installation key file already exists: ${INSTALL_KEY_FILE}"
148         else
149                 ewarn "You MUST run this before playing the game:"
150                 ewarn "  emerge --config ${PN}"
151                 ewarn "To enter your installation key."
152         fi
153 }
154
155 pkg_config() {
156         local key1 key2
157
158         ewarn "Your installation key is NOT checked for validity here."
159         ewarn "Make sure you type it in correctly."
160         ewarn "If you CTRL+C out of this, the game will not run!"
161         echo
162         einfo "The key format is: XXXX-XXXX-XXXX-XXXX"
163         while true ; do
164                 einfo "Please enter your key:"
165                 read key1
166                 if [[ -z "${key1}" ]] ; then
167                         echo "You entered a blank key. Try again."
168                         continue
169                 fi
170                 einfo "Please re-enter your key:"
171                 read key2
172                 if [[ -z "${key2}" ]] ; then
173                         echo "You entered a blank key. Try again."
174                         continue
175                 fi
176
177                 if [[ "${key1}" == "${key2}" ]] ; then
178                         echo "${key1}" | tr a-z A-Z > "${INSTALL_KEY_FILE}"
179                         echo -e "// Do not give this file to ANYONE.\n// Frictional Games Support will NEVER ask for this file" \
180                                 >> "${INSTALL_KEY_FILE}"
181                         einfo "Thanks, created ${INSTALL_KEY_FILE}"
182                         break
183                 else
184                         eerror "Your installation key entries do not match. Try again."
185                 fi
186         done
187 }