# -*- 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
# $Id: Portfile 104822 2013-04-03 06:38:39Z ryandesign@macports.org $

PortSystem              1.0
PortGroup               github 1.0
PortGroup               xcode 1.0

github.setup            quicksilver Quicksilver 1.0.0 v
platforms               darwin
maintainers             nomaintainer
categories              aqua sysutils
license                 Apache-2

description             OS X launcher utility app

long_description        Quicksilver is a launcher utility app for OS X which \
                        lets you access applications, documents, contacts, \
                        music and more\; browse your Mac’s filesystem using \
                        keywords and fuzzy matching\; manage content through \
                        drag and drop, or grabbing selected content \
                        directly\; and interact with installed applications \
                        through plugins.

homepage                http://qsapp.com/

# Fetch from git instead of distfile because it needs submodules
fetch.type              git

post-fetch {
    system -W ${worksrcpath} "git submodule update --init"
}

set config_root         ${prefix}/share/QS

post-extract {
    file mkdir ${workpath}${config_root}
}

patchfiles              patch-Quicksilver-Quicksilver.xcodeproj-project.pbxproj.diff

post-patch {
    reinplace -E "s|/tmp/QS|${workpath}${config_root}|" ${build.dir}/Configuration/Common.xcconfig
}

build.dir               ${worksrcpath}/${name}

xcode.project           ${name}.xcodeproj
xcode.configuration     Release

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

destroot {
    move ${workpath}${config_root} ${destroot}${config_root}
    eval move [glob ${build.dir}/build/${xcode.configuration}/*.app] ${destroot}${applications_dir}
}

if {${os.major} < 10} {
    pre-fetch {
        ui_error "${name} ${version} requires OS X 10.6 or greater."
        return -code error "incompatible OS X version"
    }
}
