# -*- 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 117569 2014-03-04 00:16:55Z takeshi@macports.org $

PortSystem          1.0
PortGroup           github 1.0

github.setup        D-Programming-Language druntime 2.065
categories          lang
platforms           darwin
license             Boost-1
maintainers         takeshi openmaintainer
description         Low level runtime library for the D programming language
long_description \
    Druntime is the minimum library required to support the D programming \
    language. It includes the system code required to support the garbage \
    collector, associative arrays, exception handling, array vector operations, \
    startup/shutdown, etc.
homepage            http://dlang.org/

checksums           rmd160  bf4b341287b6fa13c060b82856ba2065d5722a26 \
                    sha256  3140edaac0f48ec995a69d3cf615bcb0f209640380a9f9e6acd7b5480c489bfe

depends_lib         port:dmd

use_configure       no

if {${build_arch} eq "x86_64"} {
    set model 64
} else {
    set model 32
}

build.args          -f posix.mak \
                    CC=${configure.cc} \
                    DMD=${prefix}/bin/dmd \
                    MODEL=${model} \
                    DRUNTIME_BASE=${name} \
                    CFLAGS=\"${configure.cflags}\"
build.target        ""

destroot {
    xinstall -m 644 ${worksrcpath}/lib/lib${name}.a ${destroot}${prefix}/lib
    xinstall -m 755 -d ${destroot}${prefix}/include
    file copy ${worksrcpath}/import ${destroot}${prefix}/include/${name}
    xinstall -m 755 -d ${destroot}${prefix}/include/${name}/src
    file copy ${worksrcpath}/src/test_runner.d ${destroot}${prefix}/include/${name}/src
    xinstall -m 755 -d ${destroot}${prefix}/share/doc
    xinstall -m 755 -d ${destroot}${prefix}/share/doc/${name}
    file copy ${worksrcpath}/LICENSE ${destroot}${prefix}/share/doc/${name}
    foreach f [glob ${worksrcpath}/doc/*] {
        file copy ${f} ${destroot}${prefix}/share/doc/${name}
    }
}
