# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
# $Id$

PortSystem          1.0
PortGroup           haskell 1.0

set rev 416
haskell.setup       HOC 0.7-r${rev}
revision            2
platforms           darwin
license             MIT
maintainers         nomaintainer

description         A Haskell to Objective-C binding
long_description    HOC is a Haskell to Objective-C binding. In \
                    a nutshell, it enables you to use Objective-C \
                    objects and frameworks from Haskell, and also \
                    enables you to write Objective-C objects in Haskell.

homepage            http://code.google.com/p/hoc/
fetch.type          svn
svn.url             http://hoc.googlecode.com/svn/trunk/hoc
svn.revision        ${rev}

worksrcdir          hoc

patchfiles          patch-InterfaceGenerator2-Parser.hs.diff

post-patch {
    reinplace "s:\"HOC-\" ++ fn ++ \"/\":\"${prefix}/share/HOC/\":" \
        ${worksrcpath}/InterfaceGenerator2/Main.hs
}

pre-configure {
    reinplace s:/usr/include/ffi:[exec pkg-config libffi --variable includedir]: \
        ${worksrcpath}/HOC.cabal
    reinplace "s:gcc -m32:${configure.cc} ${configure.cc_archflags}:" \
        ${worksrcpath}/Setup.hs
}

depends_build-append    port:libffi \
                        port:pkgconfig

depends_lib-append      port:gmp \
                        port:hs-parsec \
                        port:hs-fgl

configure.args-append   --docdir=${prefix}/share/doc/${name} \
                        --extra-lib-dirs=${prefix}/lib \
                        --flags="BinaryInterfaces ObjCv2"