# -*- 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    headkaze Hackintool 4.0.3
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
revision        0
categories      sysutils aqua
maintainers     {i0ntempest @i0ntempest} openmaintainer
license         MIT

description     The Swiss army knife of vanilla Hackintoshing
long_description \
                {*}${description}

checksums       rmd160  6797adb703fbcd0d0e83044243951f62d7b9914c \
                sha256  e6f6b1df87176b7131fb2c85f0fb6bf086a15377fe9fce5b72261a09d199bac1 \
                size    15524101

platforms       macosx
compiler.cxx_standard \
                2017

depends_lib-append \
                port:pciids

xcode.target    Hackintool
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
}

post-configure {
    ln -sf ${prefix}/share/pci.ids ${worksrcpath}/Resources/PCI/pci.ids
}

post-patch {
    # Disable Sparkle without messing with xib files
    system -W ${worksrcpath}/Hackintool/ "/usr/libexec/PlistBuddy -c \"Delete :SUFeedURL\" Hackintool-Info.plist"
    system -W ${worksrcpath}/Hackintool/ "/usr/libexec/PlistBuddy -c \"Add :SUEnableAutomaticChecks bool false\" Hackintool-Info.plist"
}

destroot {
    file copy ${worksrcpath}/build/${xcode.configuration}/Hackintool.app ${destroot}${applications_dir}
}