# -*- 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 116608 2014-01-30 13:13:55Z stromnov@macports.org $

PortSystem          1.0

name                phantomjs

version             1.9.7
revision            0
categories          www
license             BSD
platforms           darwin
maintainers         stromnov openmaintainer

homepage            http://www.phantomjs.org/
master_sites        https://bitbucket.org/ariya/phantomjs/downloads/

description         PhantomJS is a minimalistic headless WebKit.

long_description    PhantomJS is a headless WebKit scriptable with a \
                    JavaScript API. It has fast and native support for \
                    various web standards: DOM handling, CSS selector, \
                    JSON, Canvas, and SVG.

use_zip             yes

distname            ${name}-${version}-source
distfiles           ${distname}${extract.suffix}

worksrcdir          ${name}-${version}

checksums           rmd160  2ed98fa736af2b9ed105a70f112ea717219aa805 \
                    sha256  0f6c50ff24c1c4a8ccd7fedef62feef5e45195c7ba5ef6c84434448544877ff3

patchfiles          patch-tools_preconfig.sh.diff \
                    patch-src_qt_preconfig.sh.diff \
                    patch-src_qt_src_corelib_global_qglobal.h.diff \
                    patch-src_qt_src_gui_kernel_qt_cocoa_helpers_mac_p.h.diff

use_configure       no

build.cmd           ./build.sh
build.target
build.args          --confirm \
                    --jobs ${build.jobs}

destroot    {
    set docdir ${prefix}/share/doc/${name}
    xinstall -d ${destroot}${docdir}

    xinstall -m 755 ${worksrcpath}/bin/${name} ${destroot}${prefix}/bin/${name}
    xinstall -W ${worksrcpath} ChangeLog README.md ${destroot}${docdir}
    move ${worksrcpath}/examples ${destroot}${docdir}/examples
}

livecheck.type      regex
livecheck.url       https://bitbucket.org/ariya/phantomjs/downloads/
livecheck.regex     {phantomjs-(\d+(?:\.\d+)*)-source\.[tz]}
