# -*- 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-8
version             8.0.23
revision            0
categories          dotnet
license             MIT
maintainers         @BjarneDMat {@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 >= 21}
supported_archs     x86_64 arm64

switch ${build_arch} {
    x86_64 {
        distname            aspnetcore-runtime-${version}-osx-x64
        checksums           rmd160  c2434361f23974332aa45deb91c59a9eaeeabd10 \
                            sha256  7688e87378eefa7225e2f368dab84480dfc124e52a89057b4c6600b64163febc \
                            size    41369608
    }
    arm64 {
        distname            aspnetcore-runtime-${version}-osx-arm64
        checksums           rmd160  e108b864b56e9e56cf35f8062551f5c1f30b3fbd \
                            sha256  f61baf8d91458c2e6fb97d6e5b4d61a60f164d4bc577b325ad92e5924960a404 \
                            size    39460085
    }
    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-8

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/8.0
livecheck.regex     "ASP.NET Core Runtime (\\d+(?:\\.\\d+)*)"
