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

name                aspnetcore-runtime-7
version             7.0.20
revision            0
categories          dotnet
license             MIT
maintainers         {@judaew judaew} openmaintainer

description         ASP.NET Core is a cross-platform .NET framework for building modern \
                    cloud-based web applications on Windows, Mac, or Linux.

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 arm64

switch ${build_arch} {
    x86_64 {
        distname            aspnetcore-runtime-${version}-osx-x64
        checksums           rmd160  3d4748945ead60e1599f10c1a193d6dd5f8120a4 \
                            sha256  121651b2f1693dd6788b97b6b7add947340a5789ee54b007c1325c469ba997ac \
                            size    40585609
    }
    arm64 {
        distname            aspnetcore-runtime-${version}-osx-arm64
        checksums           rmd160  3d0128b50fcf35557df6afebfad1f20ec2804fe2 \
                            sha256  d51b63897bf785b6a511dc2fc1c9f7e580a4ab3ed401b482c7859b1ab0da0f09 \
                            size    38659431
    }
    default {
        known_fail yes
        pre-fetch {
            ui_error "${subport} @ ${version} only supported for architectures ${supported_archs}"
            return -code error "Unsupported architecture: ${build_arch}"
        }
    }
}

master_sites        https://builds.dotnet.microsoft.com/dotnet/aspnetcore/Runtime/${version}/

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

use_configure       no

depends_run         port:dotnet-cli \
                    port:dotnet-runtime-7

build {}

destroot {
    set dotnet_home ${prefix}/share/dotnet
    set runtime_dir /shared/Microsoft.AspNetCore.App
    xinstall -d ${destroot}${dotnet_home}${runtime_dir}

    move ${worksrcpath}${runtime_dir}/${version} ${destroot}${dotnet_home}${runtime_dir}
}

livecheck.type      regex
livecheck.url       https://dotnet.microsoft.com/download/dotnet/7.0
livecheck.regex     "ASP.NET Core Runtime (\\d+(?:\\.\\d+)*)"
