# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4

PortSystem          1.0
PortGroup           github 1.0
PortGroup           xcode 1.0

github.setup        acidanthera MaciASL 1.6.5
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
revision            0
categories          devel aqua
maintainers         {i0ntempest @i0ntempest} openmaintainer
license             GPL-3

description         A native AML compiler and IDE for macOS
long_description    {*}${description}, with syntax coloring, tree navigation, automated patching, \
                    online patch file repositories, and iASL binary updates. Written entirely \
                    in Cocoa, conforms to macOS guidelines.

checksums           rmd160  ffce73fc05ee8b7d4587e528e42820dc12f9db52 \
                    sha256  e6cdd7d75431ccadd9db29217863191668801c733a6291aadd26e388351d3420 \
                    size    5698920

depends_run-append  port:acpica

xcode.target        MaciASL
xcode.configuration Release

if {${os.major} >= 22} {
    xcode.build.settings-append \
        CODE_SIGN_IDENTITY=-
} else {
    xcode.build.settings-append \
        CODE_SIGN_IDENTITY= CODE_SIGNING_REQUIRED=NO
}

destroot {
    file copy ${worksrcpath}/build/${xcode.configuration}/MaciASL.app ${destroot}${applications_dir}
    ln -fs ${prefix}/bin/iasl ${destroot}${applications_dir}/MaciASL.app/Contents/MacOS/iasl-dev
    if {${os.major} >= 22} {
        # Manually fix signature after messing with iasl-dev binary
        system -W ${destroot}${applications_dir} "/usr/bin/codesign --sign - --deep --force MaciASL.app"
    }
}
