summaryrefslogtreecommitdiff
blob: 92e1be224baf707878466a75f20003892622360a (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
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/games-strategy/freecraft/freecraft-1.18-r3.ebuild,v 1.15 2007/04/04 19:55:13 nyhm Exp $

inherit eutils games

MY_P=${PN}-030311
DESCRIPTION="realtime strategy game engine for games like Warcraft/Starcraft/etc."
HOMEPAGE="http://www.math.sfu.ca/~cbm/cd/"
SRC_URI="${MY_P}-src.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~ppc x86"
IUSE=""
RESTRICT="fetch"

DEPEND="media-libs/libpng
	media-libs/libsdl"

S=${WORKDIR}/${MY_P}

pkg_nofetch() {
	einfo "Due to a Cease and Desist given by Blizzard,"
	einfo "you must obtain the sources for this game yourself."
	einfo "For more information, please visit: ${HOMEPAGE}"
	einfo "Also, you'll have to place the files ${A}"
	einfo "into ${DISTDIR}"
}

src_unpack() {
	unpack ${A}
	cd "${S}"
	sed -e "s:GENTOO_DATADIR:${GAMES_DATADIR}/${PN}:" \
		-e "s:GENTOO_LIBDIR:$(games_get_libdir)/${PN}:" \
		"${FILESDIR}"/${PN} > "${T}"/${PN} \
		|| die "sed failed"
	epatch \
		"${FILESDIR}"/${PV}-setup.patch \
		"${FILESDIR}"/${P}-gcc41.patch \
		"${FILESDIR}"/${P}-Makefile.patch
	env GENTOO_CFLAGS="${CFLAGS}" ./setup || die
}

src_compile() {
	emake depend || die "depend generation failed"
	emake -j1 || die "emake failed"
}

src_install() {
	exeinto "$(games_get_libdir)"/${PN}
	doexe freecraft || die "doexe failed"
	dogamesbin "${T}"/${PN} || die "dogamesbin failed"

	exeinto "${GAMES_DATADIR}"/${PN}/tools
	doexe tools/{build.sh,aledoc,startool,wartool} || die "doexe failed"

	insinto "${GAMES_DATADIR}"/${PN}
	doins -r contrib data || die "doins failed"

	dohtml -r doc
	dodoc README
	prepgamesdirs
}

pkg_postinst() {
	games_pkg_postinst
	elog "Freecraft is now installed but in order to actually play"
	elog "you will need to either use a Warcraft CD or install the"
	elog "freecraft-fcmp ebuild.  To use a Warcraft CD:"
	elog " 1 mount the cd as /mnt/cdrom"
	elog " 2 cd ${GAMES_DATADIR}/${PN}"
	elog " 3 run tools/build.sh"
	elog "This will extract the data files to the correct place."
	elog "Note that the CD is still needed for the music.  To"
	elog "start a game just run \"playfreecraft\"."
	elog "For more info, review \"freecraft --help\"."
}