summaryrefslogtreecommitdiff
blob: 4df5ddfe5c2d6b9748b052012e5eebf853ace109 (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
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-games/newton/newton-1.53.ebuild,v 1.3 2007/07/24 00:22:44 nyhm Exp $

inherit eutils

DESCRIPTION="an integrated solution for real time simulation of physics environments"
HOMEPAGE="http://www.physicsengine.com/"
SRC_URI="http://www.physicsengine.com/downloads/${PN}Linux-${PV}.tar.gz
	http://www.newtondynamics.com/downloads/${PN}Linux-${PV}.tar.gz"

LICENSE="newton"
SLOT="0"
KEYWORDS="~x86"
IUSE="doc"

DEPEND="doc? (
		virtual/opengl
		virtual/glu
		virtual/glut
	)"

S=${WORKDIR}/newtonSDK

src_unpack() {
	unpack ${A}
	cd "${S}"
	if use doc; then
		cd samples
		rm -rf gl
		sed -i \
			-e "s:-I ../gl:-I /usr/include/GL:" \
			tutorial_05_UsingJoints/makefile \
			tutorial_09_SimpleVehicle/makefile \
			tutorial_04_IntroductionToMaterials/makefile \
			tutorial_10_CustomJoints/makefile \
			tutorial_01_GettingStarted/makefile \
			tutorial_02_UsingCallbacks/makefile \
			tutorial_08_HeightFieldCollision/makefile \
			tutorial_07_CharaterController/makefile \
			tutorial_06_UtilityFuntionality/makefile \
			tutorial_03_UsingCollisionTree/makefile \
			|| die "failed fixing sample makefiles"
		sed -i \
			-e "/^FLAGS =/s:-g -O0:${CFLAGS}:" \
			makefile \
			|| die "sed makefile failed"
		epatch "${FILESDIR}"/${P}-glut.patch
	fi
}

src_compile() {
	if use doc; then
		cd samples
		emake || die "emake samples failed"
		rm -f */*.elf */*.o
	fi
}

src_install() {
	dolib.a sdk/libNewton.a || die "dolib.a failed"
	insinto /usr/include
	doins sdk/Newton.h || die "doins failed"

	if use doc; then
		insinto /usr/share/${PN}
		doins -r samples/* || die "doins samples failed"

		exeinto /usr/share/${PN}/bin
		doexe samples/bin/tutorial_* || die "doexe failed"
	fi

	dodoc doc/*
}