summaryrefslogtreecommitdiff
blob: 7cd6bf1fd4e37190bb5e8d7d976314f4dbb167d3 (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
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/games-strategy/widelands/widelands-0.0.12.ebuild,v 1.2 2008/04/13 10:18:33 genstef Exp $

inherit eutils flag-o-matic toolchain-funcs versionator games

MY_PV=$(get_version_component_range 3)
DESCRIPTION="A game similar to Settlers 2"
HOMEPAGE="http://www.widelands.org/"
SRC_URI="mirror://sourceforge/${PN}/${PN}-build-${MY_PV}-source.tar.bz2"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~ppc ~x86"
IUSE="nls"

RDEPEND="media-libs/libsdl
	media-libs/sdl-image
	media-libs/sdl-mixer
	media-libs/sdl-net
	media-libs/sdl-ttf
	media-libs/sdl-gfx
	media-libs/libpng
	dev-libs/boost
	nls? ( virtual/libintl )"
DEPEND="${RDEPEND}
	nls? ( sys-devel/gettext )"

S=${WORKDIR}/${PN}

src_unpack() {
	unpack ${A}
	cd "${S}"
	rm -f $(find . -name SConscript)

	epatch "${FILESDIR}"/widelands-0.0.11-build.patch

	sed -i 's:__ppc__:__PPC__:' src/s2map.cc \
		|| die "sed s2map.cc failed"
	sed -i "s:/usr/share/games:${GAMES_DATADIR}:" src/wlapplication.cc \
		|| die "sed wlapplication.cc failed"
	sed -i "s:/l/WiLa/Setup:${GAMES_DATADIR}/${PN}:" src/config.h.default \
		|| die "sed config.h.default failed"
}

src_compile() {
	filter-flags -fomit-frame-pointer
	emake CXX=$(tc-getCXX) all || die "emake failed"

	if use nls ; then
		utils/buildlocale.py || die "buildlocale.py failed"
	fi
}

src_install() {
	dogamesbin ${PN} || die "dogamesbin failed"

	insinto "${GAMES_DATADIR}"/${PN}
	doins -r campaigns fonts maps music pics sound tribes txts worlds \
		|| die "doins failed"

	insinto "${GAMES_DATADIR}"/${PN}/locale
	local d
	for d in locale/* ; do
		if [[ -d ${d} ]] ; then
			doins -r ${d} || die "doins ${d} failed"
		fi
	done

	newicon pics/wl-ico-48.png ${PN}.png
	make_desktop_entry ${PN} Widelands

	dodoc ChangeLog CREDITS
	prepgamesdirs
}