# $Id: Portfile 89184 2012-01-20 14:07:05Z singingwolfboy@macports.org $

PortSystem              1.0
PortGroup               github 1.0
PortGroup               xcode 1.0

github.setup            quicksilver Quicksilver B63
platforms               darwin
maintainers             singingwolfboy openmaintainer
categories              aqua sysutils
license                 Apache-2.0
supported_archs         i386
description             Mac OS X at your fingertips
long_description        \
    Quicksilver is a light, fast and free Mac OS X application that gives you \
    the power to control your Mac with keystrokes alone.

homepage                http://qsapp.com/
checksums               rmd160  74990efe4355488aa9ea8c0ef457ed9f41505aa9 \
                        sha256  f0bbb06b178beebae1954c54f5b1698022615c133ad091418155d261451d0b70
build.dir               ${worksrcpath}/${name}
xcode.project           ${name}.xcodeproj

patchfiles              disable-Applications-install.diff

set config_root         ${prefix}/share/QS
use_configure           yes
configure   {
    file mkdir ${workpath}${config_root}
    reinplace -E "s|/tmp/QS|${workpath}${config_root}|" \
        ${build.dir}/Configuration/Common.xcconfig ${build.dir}/${xcode.project}/project.pbxproj
    reinplace -E "s|QSHotKeyPlugin|QSHotKeyPlugIn|" \
        ${build.dir}/${xcode.project}/project.pbxproj
}

post-destroot {
    move ${workpath}${config_root} ${destroot}${config_root}
    foreach framework [glob ${destroot}${applications_dir}/*.framework] {
        move ${framework} ${destroot}${frameworks_dir}
    }
    # set plugins_dir "/Library/Application Support/${name}/PlugIns/"
    set plugins_dir "${applications_dir}/${name}.app/Contents/PlugIns/"
    xinstall -d ${destroot}${plugins_dir}
    foreach plugin [glob ${destroot}${applications_dir}/*.qsplugin] {
        move ${plugin} ${destroot}${plugins_dir}
    }

    # set Info.plist to be world-writable, so that regular users can
    # set preferences that require writing to Info.plist
    file attributes ${destroot}${applications_dir}/${name}.app/Contents/Info.plist -permissions a+w

    # not sure why this hierarchy is here, but we don't want it
    if {[file exists ${destroot}${prefix}/var/macports]} {
        delete ${destroot}${prefix}/var/macports
    }
}

# xcode.target            "${name} Distribution"
# xcode.configuration     Release
