# $Id: Portfile 65202 2010-03-23 16:17:04Z nox@macports.org $

PortSystem      1.0
PortGroup       haskell 1.0

set rev         413
haskell.setup   HOC 0.7-r${rev}
name            hs-HOC
revision        1
license         BSD-4
platforms       darwin
categories      devel
maintainers     nox openmaintainer
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:hs-binary \
    port:hs-parsec \
    port:hs-platform-fgl \
    port:libffi \
    port:pkgconfig

depends_lib-append \
    port:gmp

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

universal_variant no
