summaryrefslogtreecommitdiff
blob: deb7f4fa340483eb17211a18abbf6e345904244f (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
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-python/pythonmagick/pythonmagick-0.7.ebuild,v 1.2 2008/05/29 16:33:34 hawking Exp $

inherit eutils python multilib toolchain-funcs

MY_PN=PythonMagick
MY_P=${MY_PN}-${PV}

DESCRIPTION="Python bindings for ImageMagick"
HOMEPAGE="http://www.imagemagick.org/script/api.php"
SRC_URI="http://www.imagemagick.org/download/python/${MY_P}.tar.gz"

SLOT="0"
LICENSE="as-is"
KEYWORDS="~x86"
IUSE=""

RDEPEND=">=media-gfx/imagemagick-1.1.7
		>=dev-libs/boost-1.34.0"
DEPEND="${RDEPEND}
		dev-util/scons"

S=${WORKDIR}/${MY_P}

src_unpack() {
	unpack ${A}
	cd "${S}"
	epatch "${FILESDIR}/${PN}-0.6-gentoo_misc_fixes.patch"
}

src_compile() {
	python_version
	sed -i \
		-e "s#\(BOOST\)=.*#\1='/usr/include/boost'#" \
		-e "s#\(BOOSTLIBPATH\)=.*#\1='/usr/lib'#" \
		-e "s#\(PYTHON_INCLUDE\)=.*#\1='/usr/include/python${PYVER}'#" \
		-e "s#\(Environment(\)#\1 CXX='$(tc-getCXX)',#" \
		-e "s#\(CPPFLAGS\)=#\1='${CXXFLAGS}'.split()+#" \
		SConstruct || die "sed failed"

	# FIXME: Until we have a var or function for it
	numjobs=$(sed -e 's/.*\(\-j[ 0-9]\+\) .*/\1/' <<< ${MAKEOPTS})

	scons mode=release ${numjobs} || die "scons failed"
}

src_install() {
	insinto /usr/$(get_libdir)/python${PYVER}/site-packages
	doins -r PythonMagick
}

pkg_postinst() {
	python_version
	python_mod_optimize /usr/$(get_libdir)/python${PYVER}/site-packages/${MY_PN}
}

pkg_postrm() {
	python_mod_cleanup
}