summaryrefslogtreecommitdiff
blob: 71cd439ff6363b64cd06c0cca100c883c092d743 (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
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=5

inherit toolchain-funcs findlib

MY_P="${P/_alpha/a}"

DESCRIPTION="OCaml interface to the GD graphics library"
HOMEPAGE="https://sourceforge.net/projects/gd4o/"
SRC_URI="mirror://sourceforge/gd4o/${MY_P}.tar.gz"

LICENSE="LGPL-2.1"
SLOT="0/${PV}"
KEYWORDS="~amd64"
IUSE="doc +ocamlopt"

DEPEND=">=dev-lang/ocaml-3.10.2:=[ocamlopt?]
	media-libs/gd
	virtual/jpeg:0
	sys-libs/zlib
	media-libs/libpng:0=
	media-libs/freetype:2"
RDEPEND="${DEPEND}"

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

src_prepare() {
	sed -i 's/CFLAGS =/CFLAGS += -fPIC/' Makefile || die
}

src_compile() {
	emake CC="$(tc-getCC)"
	if use ocamlopt ; then
		emake CC="$(tc-getCC)" opt
	fi
	if use doc ; then
		emake docs
	fi
}

src_test() {
	emake test
	if use ocamlopt ; then
		emake test.opt
	fi
}

src_install() {
	findlib_src_install
	dodoc BUGS CHANGES README* TODO doc/manual.txt
	use doc && dohtml -r doc
}