summaryrefslogtreecommitdiff
blob: be76bde6bb20094edc28ae8eb6f56ab7552c5948 (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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/media-libs/libsfml/libsfml-1.6.ebuild,v 1.1 2011/02/05 05:38:21 radhermit Exp $

EAPI=3
PYTHON_DEPEND="python? 2:2.6 3"
PYTHON_MODNAME="PySFML"

inherit eutils multilib toolchain-funcs distutils

MY_P="SFML-${PV}"
DESCRIPTION="Simple and fast multimedia library"
HOMEPAGE="http://sfml.sourceforge.net/"
SRC_URI="mirror://sourceforge/sfml/${MY_P}-sdk-linux-32.tar.gz
	csfml? ( mirror://sourceforge/sfml/${MY_P}-c-sdk-linux-32.tar.gz )
	python? ( mirror://sourceforge/sfml/${MY_P}-python-sdk.zip )"

LICENSE="as-is"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="csfml debug doc examples python static-libs"

DEPEND="media-libs/freetype:2
	media-libs/glew
	media-libs/libpng
	media-libs/libsndfile
	media-libs/mesa
	media-libs/openal
	sys-libs/zlib
	virtual/jpeg
	x11-libs/libX11
	x11-libs/libXrandr"
RDEPEND="${DEPEND}"

S="${WORKDIR}/${MY_P}"

src_prepare() {
	epatch "${FILESDIR}"/${P}-destdir.patch
	epatch "${FILESDIR}"/${P}-deps-and-flags.patch
	if use csfml ; then
		epatch "${FILESDIR}"/${P}-csfml-destdir.patch
	fi
}

src_compile() {
	local myconf

	if use debug ; then
		myconf="$myconf DEBUGBUILD=yes"
	fi

	emake $myconf CPP=$(tc-getCXX) CC=$(tc-getCC) || die "emake failed"

	if use static-libs ; then
		emake $myconf STATIC=yes CPP=$(tc-getCXX) CC=$(tc-getCC) || die "emake failed"
	fi

	if use csfml ; then
		cd "${S}/CSFML"
		emake CPP=$(tc-getCXX) || die "emake failed"
	fi

	if use python ; then
		cd "${S}/python"
		distutils_src_compile
	fi
}

src_install() {
	emake DESTDIR="${D}" prefix=/usr libdir=/usr/$(get_libdir) install || die "emake install failed"

	if use csfml ; then
		pushd "${S}/CSFML" >/dev/null
		emake DESTDIR="${D}" prefix=/usr libdir=/usr/$(get_libdir) install || die "emake install failed"
		popd >/dev/null
	fi

	if use python ; then
		pushd "${S}/python" >/dev/null
		distutils_src_install
		popd >/dev/null
	fi

	if use static-libs ; then
		dolib.a lib/*.a || die "dolib.a failed"
	fi

	if use doc ; then
		dohtml doc/html/*
		if use csfml ; then
			docinto csfml/html
			dohtml CSFML/doc/html/*
		fi
		if use python ; then
			docinto python/html
			dohtml python/doc/*
		fi
	fi

	if use examples ; then
		for i in ftp opengl pong post-fx qt sockets sound sound_capture voip window wxwidgets X11 ; do
			insinto /usr/share/doc/${PF}/examples/$i
			doins samples/$i/* || die "doins failed"
		done

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

pkg_postinst() {
	use python && distutils_pkg_postinst
}

pkg_postrm() {
	use python && distutils_pkg_postrm
}