summaryrefslogtreecommitdiff
blob: 52d5f38b0e039eb27b03ac5b29304e4a087175d2 (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-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI=5

inherit eutils vcs-snapshot findlib multilib

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

LICENSE="LGPL-2.1"
SLOT="0/${PV}"
KEYWORDS="~amd64 ppc x86"
IUSE="doc gif gtk jpeg png postscript tiff truetype X xpm zlib"

RDEPEND=">=dev-lang/ocaml-3.10.2:=[X?,ocamlopt]
	gif? ( media-libs/giflib )
	gtk? ( dev-ml/lablgtk )
	jpeg? ( virtual/jpeg )
	tiff? ( media-libs/tiff )
	png? ( >=media-libs/libpng-1.4:0 )
	postscript? ( app-text/ghostscript-gpl )
	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 postscript  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/*
}