summaryrefslogtreecommitdiff
blob: 953d1fe38894bf5fb9d0603fa0dd30db6949d901 (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
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/games-strategy/freecnc/freecnc-0.2.1.31072003.ebuild,v 1.11 2007/03/12 18:05:57 genone Exp $

inherit flag-o-matic eutils games

DESCRIPTION="SDL-rewrite of the classical real time strategy hit Command & Conquer"
HOMEPAGE="http://www.freecnc.org/"
#mirror://sourceforge/freecnc/freecnc++-${PV}-src.tar.bz2
SRC_URI="mirror://gentoo/freecnc++-${PV}-src.tar.bz2
	nocd? ( ftp://ftp.westwood.com/pub/cc1/previews/demo/cc1demo1.zip )
	nocd? ( ftp://ftp.westwood.com/pub/cc1/previews/demo/cc1demo2.zip )"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~ppc x86"
IUSE="zlib nocd"

RDEPEND="media-libs/libsdl
	media-libs/sdl-net
	zlib? ( sys-libs/zlib )"
DEPEND="${RDEPEND}
	app-arch/unzip"

S=${WORKDIR}/freecnc++

src_unpack() {
	unpack freecnc++-${PV}-src.tar.bz2
	if use nocd ; then
		mkdir data ; cd data
		unpack cc1demo1.zip cc1demo2.zip
		for f in * ; do
			mv ${f} $(echo ${f} | awk '{print tolower($1)}') || die "moving $f"
		done
	fi
	cd "${S}"
	epatch ${FILESDIR}/${PV}-makefile-cflags.patch \
		${FILESDIR}/${PV}-remove-root.patch \
		${FILESDIR}/${PV}-gentoo-paths.patch \
		"${FILESDIR}/${P}"-gcc4.patch
	sed -i \
		-e "s:GENTOO_LOGDIR:${GAMES_LOGDIR}:" \
		-e "s:GENTOO_CONFDIR:${GAMES_SYSCONFDIR}/${PN}/:" \
		-e "s:GENTOO_DATADIR:${GAMES_DATADIR}/${PN}/:" \
		src/{freecnc,vfs/vfs}.cpp tools/audplay/audplay.cpp \
		|| die "sed failed"
}

src_compile() {
	emake linux EXTRACFLAGS="${CFLAGS}" || die "emake failed"
}

src_install() {
	exeinto "${GAMES_LIBDIR}"/${PN}
	doexe freecnc *.vfs audplay shpview tmpinied || die "doexe failed"
	dogamesbin "${FILESDIR}"/freecnc
	dosed "s:GENTOO_DIR:${GAMES_LIBDIR}/${PN}:" ${GAMES_BINDIR}/freecnc
	insinto "${GAMES_DATADIR}"/${PN}/conf
	doins conf/*
	insinto "${GAMES_SYSCONFDIR}"/${PN}
	doins conf/*
	dodoc AUTHORS ChangeLog NEWS README THANKS TODO
	if use nocd ; then
		cd "${WORKDIR}"/data
		insinto "${GAMES_DATADIR}"/${PN}
		doins *.mix *.aud || die "doins failed"
		dodoc *.txt
	fi
	prepgamesdirs
}

pkg_postinst() {
	games_pkg_postinst
	elog "If you have the C&C games, then just copy the .mix"
	elog "to ${GAMES_DATADIR}/${PN}"
	elog "Otherwise, re-emerge freecnc with 'nocd' in your USE."
}