PortSystem 1.0
PortGroup xcode 1.0

name                    Pallet
version                 1.1
revision                2
categories              sysutils aqua macports
license                 BSD
maintainers             nomaintainer
description             Aqua application to control a MacPorts installation.
long_description        \
    Pallet is an aqua application that controls a MacPorts installation, including the \
    installation, upgrading, and removal of individual ports.
homepage                https://www.macports.org/
#master_sites
#distname               ${name}
#checksums              md5 c586fd603d9978b306aee428ea39e329

# svn fetch does not work on Catalina, at least, without MacPorts subversion
# % /usr/bin/svn
# svn: error: Failed to locate 'svn'.
# svn: error: The subversion command line tools are no longer provided by Xcode.
depends_fetch-append    port:subversion

fetch.type              svn
svn.url                 https://svn.macports.org/repository/macports/contrib/Pallet
svn.revision            86930

worksrcdir              Pallet

xcode.target            Pallet
xcode.configuration     Release

if {${os.major} > 9} {
    patchfiles-append       patch-pallet-system-target.diff
}

patchfiles-append       patch-pallet-open-save-panel.diff
patchfiles-append       patch-preferences-lib-location.diff

post-patch {
    if {${prefix} ne "/opt/local"} {
        reinplace "s|/opt/local|${prefix}|g" ${worksrcpath}/PreferencesController.m
        reinplace "s|/opt/local|${prefix}|g" ${worksrcpath}/Preferences.xib
    }
}


platform darwin 8 {
       pre-fetch {
               ui_error "${name} requires Mac OS X 10.5 or greater."
       }
}

platform darwin 14 {
    # see https://trac.macports.org/ticket/43581

    build.pre_args         GCC_ENABLE_OBJC_GC=NO
    destroot.pre_args      GCC_ENABLE_OBJC_GC=NO
}

# this port does not build with the new xcode build system at present
if {[vercmp ${xcodeversion} 10.0] >= 0} {
    build.pre_args      -UseNewBuildSystem=NO
    destroot.pre_args   -UseNewBuildSystem=NO
}

# the Growl framework should be removed, but until that is done, it has to be signed
# or the build will fail
pre-configure {
    # I'm not sure what system versions need to be signed
    if { ${os.major} > 14 } {
        system -W ${worksrcpath} "/usr/bin/codesign --sign - Growl-1.2.1-Framework/Growl.framework"
    }
}


xcode.build.settings       FRAMEWORK_SEARCH_PATHS='${frameworks_dir} Growl-1.2.1-Framework'
xcode.destroot.settings    FRAMEWORK_SEARCH_PATHS='${frameworks_dir} Growl-1.2.1-Framework'

depends_lib-append      port:MacPorts_Framework
