# -*- 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 tools 2.088.0 v
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
name                dmd-${github.project}
categories          lang
license             Boost-1
maintainers         nomaintainer
description         Ancilliary tools for the D programming language compiler
long_description \
    D is a language with C-like syntax and static typing. \
    It pragmatically combines efficiency, control, \
    and modeling power, with safety and programmer productivity. \
    This port provides the ancilliary tools for the D programming language compiler.
homepage            http://dlang.org/

checksums           rmd160  a31d052f8ab6ba46561a7395f8e9ed2a88475b57 \
                    sha256  831bd25e8bda904e5a940baf0d5a19f13e78026d6c9d556cbbeb26d7bec1f324 \
                    size    117130

depends_lib         port:phobos \
                    port:curl

use_configure       no

build.args          -f posix.mak \
                    DMD_DIR=${prefix}/share/dmd \
                    DRUNTIME=${prefix}/lib/libdruntime.a \
                    DRUNTIME_PATH=${prefix}/include/druntime \
                    CC=${configure.cc} \
                    DMD=${prefix}/bin/dmd \
                    DFLAGS=\"-w -de -O -release\"

destroot.args       -f posix.mak \
                    DMD_DIR=${prefix}/share/dmd \
                    INSTALL_DIR=${destroot}${prefix} \
                    PREFIX=${prefix}

if {!${universal_possible} || ![variant_isset universal]} {
    if { ${build_arch} eq "x86_64" || ${build_arch} eq "ppc64" } {
        build.args-append    MODEL=64
        destroot.args-append MODEL=64
    } else {
        build.args-append    MODEL=32
        destroot.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

    lappend merger_destroot_args(x86_64) MODEL=64
    lappend merger_destroot_args(i386)   MODEL=32
    lappend merger_destroot_args(ppc64)  MODEL=64
    lappend merger_destroot_args(ppc)    MODEL=32
}

post-destroot {
    xinstall -W ${worksrcpath} -m 644 man/man1/rdmd.1 ${destroot}${prefix}/share/man/man1
}

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