# -*- 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: Portfile 106677 2013-06-04 23:22:21Z cal@macports.org $

PortSystem          1.0

name                ghc-bootstrap
set canonicalname   ghc
version             7.0.4
categories          lang haskell
maintainers         gmail.com:kitchen.andy cal openmaintainer
license             BSD
platforms           darwin
supported_archs     i386 x86_64
universal_variant   no

description         The Glorious Glasgow Haskell Compilation System
long_description    \
                    This is a package that installs a binary \
                    bootstrap ghc compiler.

homepage            http://haskell.org/${canonicalname}
master_sites        ${homepage}/dist/${version}/
distname            ${canonicalname}-${version}-${build_arch}-apple-darwin
worksrcdir          ${canonicalname}-${version}
use_bzip2           yes

checksums           ${canonicalname}-${version}-i386-apple-darwin${extract.suffix} \
                        rmd160  ed4cb136a30455e57ca4526d89b019fe4ce638f3 \
                        sha256  c316fcd59166f1075675d7365b06cca973aec6623254a4a7fb28e74c352c4462 \
                    ${canonicalname}-${version}-x86_64-apple-darwin${extract.suffix} \
                        rmd160  14f4c6a044eaa3d04f1645324f9255eebff9a49d \
                        sha256  74580b919b5205007901d15da88635e4b2dcc887086fb16d238eeb7011a255d4

compiler.blacklist  clang

configure.pre_args  --prefix=${prefix}/share/ghc-bootstrap

pre-configure {
    # OK so because this binary has been prebuilt for libraries
    # in /usr/lib we search these before macports stuff so (hopefully)
    # weird things don't happen
    configure.ldflags  -L/usr/lib
    configure.cppflags -I/usr/include
}

build {}

post-destroot {
    # Delete dylibs; they aren't used by the bootstrap ghc and are incorrectly
    # linked against /usr/local, causing rev-upgrade to complain.
    # This problem might only be reproducible in i386; the x86_64 version
    # apparently doesn't ship and dylibs.
    fs-traverse f ${destroot}${prefix} {
        if {[file isfile ${f}]} {
            if {[file extension ${f}] == ".dylib"} {
                delete ${f}
            }
        }
    }
}

# TODO don't install documentation
