# -*- 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           github 1.0
PortGroup           muniversal 1.0

github.setup        dlang druntime 2.071.0 v
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  7ed028441170847a782bf4190db410c3e1a3f2a3 \
                    sha256  fab224d31c68b34fd036e9c1d508547fe95ad191b66b966946f337c9943cc480

depends_lib         port:dmd

patchfiles          patch-posix.diff

use_configure       no

post-extract {
    xinstall -m 0644 ${filespath}/makefile_macports_install ${build.dir}
}

post-patch {
    reinplace \
        "s|__MACPORTS_CFLAGS__|${configure.cflags}|g" \
        ${worksrcpath}/posix.mak
}

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

if { ![variant_isset universal] } {
    if { ${build_arch} eq "x86_64" || ${build_arch} eq "ppc64" } {
        build.args-append MODEL=64
    } else {
        build.args-append MODEL=32
    }
} else {
    lappend merger_build_args(x86_64) MODEL=64
    lappend merger_build_args(i386)   MODEL=32
    lappend merger_build_args(ppc64)  MODEL=64
    lappend merger_build_args(ppc)    MODEL=32
}

destroot.args \
    -f makefile_macports_install \
    PREFIX=${prefix}

livecheck.regex     archive/[join ${github.tag_prefix} ""](\[^"-\]+)${extract.suffix}