bbe9f58dbc17282adceb55441135ea9132fdcde5
[gentoo-interactive-fiction.git] / games-engines / gargoyle / gargoyle-2011.1.ebuild
1 # Copyright 1999-2011 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
4
5 # Regarding licenses: libgarglk is licensed under the GPLv2. Bundled
6 # interpreters are licensed under GPLv2, BSD or MIT license, except:
7 #   - glulxe: custom license, see "terps/glulxle/README"
8 #   - hugo: custom license, see "licenses/HUGO License.txt"
9 # Since we don't compile or install any of the bundled fonts, their licenses
10 # don't apply. (Fonts are installed through dependencies instead.)
11
12 EAPI=3
13
14 inherit eutils games
15
16 DESCRIPTION="An Interactive Fiction (IF) player supporting all major formats"
17 HOMEPAGE="http://ccxvii.net/gargoyle/"
18 SRC_URI="http://garglk.googlecode.com/files/${P}-sources.zip"
19
20 LICENSE="BSD GPL-2 MIT Hugo Glulxe"
21 SLOT="0"
22 KEYWORDS="amd64 x86"
23
24 RDEPEND="media-libs/freetype:2
25         virtual/jpeg
26         media-libs/libpng
27         media-fonts/liberation-fonts
28         >=media-fonts/libertine-ttf-5
29         sys-libs/zlib
30         x11-libs/gtk+:2
31         media-libs/sdl-mixer
32         media-libs/sdl-sound"
33
34 DEPEND="${RDEPEND}
35         app-arch/unzip
36         dev-util/ftjam"
37
38 src_prepare() {
39         # Substitute custom CFLAGS/LDFLAGS.
40         sed -i -e \
41                 "/^\s*OPTIM = / {
42                         s/ \(-O.*\)\? ;/ ${CFLAGS} ;/
43                         a LINKFLAGS = ${LDFLAGS} ;
44                         a SHRLINKFLAGS = ${LDFLAGS} ;
45                 }" Jamrules || die
46
47         # Convert garglk.ini to UNIX format.
48         edos2unix garglk/garglk.ini
49
50         # The font name of Linux Libertine changed in version 5.
51         sed -i -e 's/Linux Libertine O/Linux Libertine/g' garglk/garglk.ini
52 }
53
54 src_compile() {
55         local jamopts=$(echo "${MAKEOPTS}" | sed -ne "/-j/ { s/.*\(-j[[:space:]]*[0-9]\+\).*/\1/; p }")
56         jam \
57                 -sGARGLKINI="${GAMES_SYSCONFDIR}/garglk.ini" \
58                 -sUSESDL=yes \
59                 -sBUNDLEFONTS=no \
60                 ${jamopts} || die
61 }
62
63 src_install() {
64         DESTDIR="${D}" \
65         _BINDIR="${GAMES_PREFIX}/libexec/${PN}" \
66         _APPDIR="${GAMES_PREFIX}/libexec/${PN}" \
67         _LIBDIR="$(games_get_libdir)" \
68         EXEMODE=755 \
69         FILEMODE=755 \
70         jam install || die
71
72         # Install config file.
73         insinto "${GAMES_SYSCONFDIR}"
74         newins garglk/garglk.ini garglk.ini || die
75
76         # Install application entry and icon.
77         insinto /usr/share/applications
78         doins garglk/${PN}.desktop || die
79         doicon garglk/${PN}-house.png || die
80
81         # Symlink binaries to avoid name clashes.
82         for terp in advsys agility alan2 alan3 frotz geas git glulxe hugo jacl \
83                 level9 magnetic nitfol scare tadsr
84         do
85                 dosym "${GAMES_PREFIX}/libexec/${PN}/${terp}" \
86                         "${GAMES_BINDIR}/${PN}-${terp}" || die
87         done
88
89         # Also symlink the main binary since it resides in libexec.
90         dosym "${GAMES_PREFIX}/libexec/${PN}/${PN}" \
91                 "${GAMES_BINDIR}/${PN}" || die
92
93         prepgamesdirs
94 }