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

deprecated.eol_version yes

name                dotnet-sdk-3.1
version             3.1.426
revision            2
categories          dotnet devel
license             MIT
maintainers         {@judaew judaew} openmaintainer

description         Core functionality needed to create .NET Core projects, that is \
                    shared between Visual Studio and CLI

long_description    .NET is a free, cross-platform, open source developer platform \
                    for building many different types of applications. \
                    \
                    With .NET, you can use multiple languages, editors, and libraries \
                    to build for web, mobile, desktop, games, and IoT.

homepage            https://dotnet.microsoft.com/
platforms           {darwin any} {darwin >= 19}
supported_archs     x86_64
distname            dotnet-sdk-${version}-osx-x64
master_sites        https://builds.dotnet.microsoft.com/dotnet/Sdk/${version}/

checksums           rmd160  1b0a834ae33a55f14721b53121f05b1b336d0e6c \
                    sha256  6b0792f2be40a279ebbee284b6bc4e955c8242401f2b254a9a975ff477c7e535 \
                    size    122566567

worksrcdir          ${name}-${version}
extract.mkdir       yes

use_configure       no

depends_run         port:dotnet-cli \
                    port:dotnet-runtime-3.1 \
                    port:aspnetcore-runtime-3.1

build {}

destroot {
    set dotnet_home ${prefix}/share/dotnet

    # AspNetCore Targeting Pack
    set aspnet_target_dir /packs/Microsoft.AspNetCore.App.Ref
    set aspnet_target_version 3.1.10
    xinstall -d ${destroot}${dotnet_home}${aspnet_target_dir}
    move ${worksrcpath}${aspnet_target_dir}/${aspnet_target_version} ${destroot}${dotnet_home}${aspnet_target_dir}

    # DotNetCore AppHost
    set dotnet_apphost_dir /packs/Microsoft.NETCore.App.Host.osx-x64
    set dotnet_apphost_version 3.1.32
    xinstall -d ${destroot}${dotnet_home}${dotnet_apphost_dir}
    move ${worksrcpath}${dotnet_apphost_dir}/${dotnet_apphost_version} ${destroot}${dotnet_home}${dotnet_apphost_dir}

    # DotNetCore Targeting Pack
    set dotnet_target_dir /packs/Microsoft.NETCore.App.Ref
    set dotnet_target_version 3.1.0
    xinstall -d ${destroot}${dotnet_home}${dotnet_target_dir}
    move ${worksrcpath}${dotnet_target_dir}/${dotnet_target_version} ${destroot}${dotnet_home}${dotnet_target_dir}

    # SDK
    xinstall -d ${destroot}${dotnet_home}/sdk
    move ${worksrcpath}/sdk/${version} ${destroot}${dotnet_home}/sdk

    # Templates
    set dotnet_templates_version 3.1.33
    xinstall -d ${destroot}${dotnet_home}/templates
    move ${worksrcpath}/templates/${dotnet_templates_version} ${destroot}${dotnet_home}/templates
}

livecheck.type      regex
livecheck.url       https://dotnet.microsoft.com/download/dotnet/3.1
livecheck.regex     "SDK (\\d+(?:\\.\\d+)*)"
