summaryrefslogtreecommitdiff
blob: 414aad32fe7ab5fe66c8876ab88649be92d05dab (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-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-ml/camlimages/camlimages-4.0.1.ebuild,v 1.1 2012/04/10 12:22:14 aballier Exp $

EAPI=4

inherit eutils vcs-snapshot findlib multilib

DESCRIPTION="An image manipulation library for ocaml"
HOMEPAGE="http://gallium.inria.fr/camlimages/"
SRC_URI="http://bitbucket.org/camlspotter/camlimages/get/v4.0.1.tar.bz2 -> ${P}.tar.bz2"

LICENSE="LGPL-2.1"
SLOT="0"
KEYWORDS="~amd64 ~ppc ~x86"
IUSE="doc gif gs gtk jpeg png tiff truetype X xpm zlib"

RDEPEND=">=dev-lang/ocaml-3.10.2[X?,ocamlopt]
	gif? ( media-libs/giflib )
	gtk? ( dev-ml/lablgtk )
	gs? ( app-text/ghostscript-gpl )
	jpeg? ( virtual/jpeg )
	tiff? ( media-libs/tiff )
	png? ( >=media-libs/libpng-1.4 )
	truetype? ( >=media-libs/freetype-2 )
	xpm? ( x11-libs/libXpm )
	X? ( x11-apps/rgb )
	zlib? ( sys-libs/zlib )
	"
DEPEND="${DEPEND}
	doc? ( dev-python/sphinx[latex] )
	dev-util/omake
	dev-ml/findlib"

REQUIRED_USE="png? ( zlib )"

src_prepare() {
	epatch "${FILESDIR}/${P}-libpng15.patch"
}

camlimages_disable_have() {
	if ! use $1 ; then
		sed -i -e "s/^[[:space:]]*HAVE_$2.*\$/  HAVE_$2 = false/" OMakefile || die
		sed -i -e "s/^[[:space:]]*SUPPORT_$2.*\$/\0\n  SUPPORT_$2 = false/" OMakefile || die
	fi
}

src_configure() {
	camlimages_disable_have gif      GIF
	camlimages_disable_have zlib     Z
	camlimages_disable_have png      PNG
	camlimages_disable_have jpeg     JPEG
	camlimages_disable_have tiff     TIFF
	camlimages_disable_have xpm      XPM
	camlimages_disable_have gs       PS
	camlimages_disable_have gtk      LABLGTK2
	camlimages_disable_have X        GRAPHICS
	camlimages_disable_have X        RGB_TXT
	camlimages_disable_have truetype FREETYPE
}

src_compile() {
	omake --force-dotomake || die
	if use doc ; then
		sphinx-build doc/sphinx sphinxdoc || die
	fi
}

src_install() {
	findlib_src_preinst
	omake --force-dotomake DESTDIR="${D}" install || die
	dodoc README
	use doc && dohtml -r sphinxdoc/*
}