summaryrefslogtreecommitdiff
blob: 84fa894f6cb752dc903aca475eace917d2ea9873 (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
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI="2"

inherit eutils multilib toolchain-funcs

DESCRIPTION="plant modeling software package"
HOMEPAGE="http://ngplant.sourceforge.net"
SRC_URI="mirror://sourceforge/${PN}/${PN}/${PV}/${P}.tar.gz"

SLOT="0"
KEYWORDS="~amd64 ~x86"
LICENSE="GPL-3 BSD"
IUSE="doc examples"

RDEPEND="
	media-libs/glew
	virtual/glut
	x11-libs/wxGTK:2.8
	dev-lang/lua"
DEPEND="${RDEPEND}
	dev-util/scons
	dev-util/pkgconfig
	dev-libs/libxslt"

src_prepare() {
	epatch "${FILESDIR}"/${PV}-gcc4.3.patch
	rm -rf extern

	sed \
		-e "s:CC_OPT_FLAGS=.*$:CC_OPT_FLAGS=\'${CFLAGS}\':g" \
		-i SConstruct \
		|| die "failed to correct CFLAGS"

	sed \
		-e "s:LINKFLAGS='-s':LINKFLAGS=\'${LDFLAGS}\':g" \
		-i ngpview/SConscript ${PN}/SConscript devtools/SConscript ngpshot/SConscript \
		|| die "failed to correct LDFLAGS"
}

src_compile() {
	scons \
		CC=$(tc-getCC) \
		CXX=$(tc-getCXX)\
		LINKFLAGS="${LDFLAGS}" \
		GLEW_INC="/usr/include/" \
		GLEW_LIBPATH="/usr/$(get_libdir)/" \
		GLEW_LIBS="GLEW GL GLU glut" \
		LUA_INC="/usr/include/" \
		LUA_LIBPATH="/usr/$(get_libdir)/" \
		LUA_LIBS="$(pkg-config lua --libs)" \
		|| die
}

src_install() {
	dobin ${PN}/${PN} ngpview/ngpview devtools/ngpbench ngpshot/ngpshot scripts/ngp2obj.py || die
	dolib.a ngpcore/libngpcore.a ngput/libngput.a || die
	insinto /usr/share/${PN}/
	doins -r plugins shaders || die

	dodoc ReleaseNotes || die

	if use examples; then
		doins -r samples || die
	fi

	if use doc; then
		dohtml -r docapi || die
	fi
}