summaryrefslogtreecommitdiff
blob: 08851cac199e058e3dc1d96692798f7c3f9f2334 (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
79
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-games/ode/ode-0.6.ebuild,v 1.1 2006/06/19 21:30:01 tupone Exp $

inherit eutils autotools

DESCRIPTION="Open Dynamics Engine SDK"
HOMEPAGE="http://ode.org/"
SRC_URI="mirror://sourceforge/opende/${PN}-src-${PV}.zip"

LICENSE="LGPL-2.1"
SLOT="0"
KEYWORDS="~amd64 ~ia64 ~ppc ~sparc ~x86"
IUSE="double-precision examples nogyroscopic noopcode"

RDEPEND="examples? (
		virtual/opengl
		virtual/glu
		|| (
			(
				x11-libs/libXmu
				x11-libs/libXi
			)
			virtual/x11
		)
	)"

DEPEND="${RDEPEND}"

src_unpack() {
	unpack ${A}
	cd "${S}"

	# Fix C*FLAGS being set on configure
	epatch "${FILESDIR}/${P}"-flags.patch

	eautoreconf

	sed -i -e "s/..\/..\/drawstuff\/textures/\/usr\/share\/${PF}\/examples/" ode/test/*.c*
	sed -i -e "s/fn.path_to_textures = 0/fn.path_to_textures = \"\/usr\/share\/${PF}\/examples\"/" drawstuff/dstest/dstest.cpp
	sed -i -e "s/inline_[\t]*void[\t*]ResetCountDown/void ResetCountDown/" OPCODE/OPC_TreeCollider.h
}

src_compile() {
	econf \
		$(use_enable double-precision) \
		$(use_enable !noopcode opcode) \
		$(use_enable !nogyroscopic gyroscopic) \
		--enable-release \
		|| die "ODE configuration failed"

	emake || die "ODE compile failed"
}

src_install() {
	make DESTDIR="${D}" install || die "Install failed!"
	dodoc CHANGELOG.txt README.txt
	# Install API docs
	dohtml docs/*

	if use examples; then
		# install examples
		dodir /usr/share/${PF}/examples
		exeinto /usr/share/${PF}/examples
		cd ode/test
		doexe test_basket test_boxstack test_buggy test_chain1 test_chain2 \
			test_collision test_crash test_cyl test_cylvssphere test_friction \
			test_hinge test_I test_joints test_motor test_moving_trimesh \
			test_ode test_slider test_space test_space_stress test_step \
			test_trimesh
		cd ../..
		doexe drawstuff/dstest/dstest
		insinto /usr/share/${PF}/examples
		doins ode/test/*.{c,cpp,h}
		doins drawstuff/textures/*.ppm
		doins drawstuff/dstest/dstest.cpp
		doins drawstuff/src/{drawstuff.cpp,internal.h,x11.cpp}
	fi
}