# -*- 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

PortSystem          1.0
PortGroup           github 1.0
PortGroup           muniversal 1.0

github.setup        dlang druntime 2.088.0 v
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
categories          lang
license             Boost-1
maintainers         nomaintainer
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  9160745938e63b1ac9ca2cfa0bfe7cad7d649c0e \
                    sha256  2cbb5b78a8fb218b1bc687e2338c35626d199752ab2fba0ad17f65eba65f1bff \
                    size    1735461

depends_lib         port:dmd

patchfiles          patch-posix.mak.diff

use_configure       no

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

if {!${universal_possible} || ![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 {
    xinstall -m 644 {*}[glob ${worksrcpath}/generated/osx/release/*/*] ${destroot}${prefix}/lib
    xinstall -d -m 755 ${destroot}${prefix}/include/${name}
    file copy ${worksrcpath}/import ${destroot}${prefix}/include/${name}
    xinstall -d -m 755 ${destroot}${prefix}/share/doc
    xinstall -d -m 755 ${destroot}${prefix}/share/doc/${name}
    xinstall -m 644 -W ${worksrcpath} LICENSE.txt ${destroot}${prefix}/share/doc/${name}
    xinstall -d -m 755 ${destroot}${prefix}/share/${name}
    file copy ${worksrcpath}/benchmark ${destroot}${prefix}/share/${name}
}


github.livecheck.regex  {([^"-]+)}
