# $Id$

PortSystem			1.0

name				camlimages
version				4.0.1
revision            7
categories			devel graphics
license             {LGPL-2 Permissive}
maintainers			loria.fr:reilles
description			Objective Caml interface to image manipulation functions.
long_description		Camlimages provides basic functions for image processing \
				and loading/saving various image file formats, an \
				interface to display images, and a Freetype interface \
				to render TrueType fonts.
homepage			http://gallium.inria.fr/camlimages/

patchfiles			patch-src-jpegread.c.diff patch-png.diff

platforms			darwin

master_sites			https://bitbucket.org/camlspotter/camlimages/get/

distname            v${version}
checksums			rmd160 dd3a1aeb43bc7459781958a93db23ce32d0ca6e6 \
                    sha256 b40237c1505487049799a7af296eb3996b3fa08eab94415546f46d61355747c4

depends_build       port:ocaml-findlib port:omake
depends_lib			port:ocaml port:jpeg \
				port:tiff port:giflib \
				port:libpng port:ghostscript port:xpm

worksrcdir      camlspotter-${name}-c803efa9d5d3

use_configure   no
if {$build_arch == "i386" || $build_arch == "ppc"} {
    configure.ld_archflags -m32
} else {
    configure.ld_archflags -m64
}

build.cmd       omake
build.args      --verbose INCLUDES="${prefix}/include" \
                LDFLAGS='${configure.ldflags} ${configure.ld_archflags}' \
                CFLAGS='${configure.cflags} ${configure.cc_archflags}' \
                CC=${configure.cc} CXX=${configure.cxx} \
                SUPPORT_LABLGTK2=false
destroot.args   ${build.args}
pre-destroot {
    set ocaml_destdir "${destroot}[exec ocamlfind printconf destdir]"
    xinstall -d ${ocaml_destdir}
    destroot.env OCAMLFIND_DESTDIR="${ocaml_destdir}" \
                 OCAMLFIND_LDCONF=ignore
}

variant lablgtk2 {
        build.args-delete SUPPORT_LABLGTK2=false
        destroot.args-delete SUPPORT_LABLGTK2=false
		build.args-append SUPPORT_LABLGTK2=true
		destroot.args-append SUPPORT_LABLGTK2=true
		depends_lib-append port:lablgtk2
}