# -*- 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 106722 2013-06-06 12:44:21Z stromnov@macports.org $

PortSystem          1.0

name                phantomjs

version             1.9.1
categories          www
license             BSD
platforms           darwin
maintainers         stromnov openmaintainer

homepage            http://www.phantomjs.org/
master_sites        googlecode

description         minimalistic headless WebKit
long_description \
    PhantomJS is a minimalistic headless WebKit. \
    \
    It has fast and native support for various web standards: \
    DOM handling, CSS selector, JSON, Canvas, and SVG. \
    \
    PhantomJS can be fully scripted using JavaScript. It is an optimal \
    solution for headless testing of web-based applications, site \
    scraping, pages capture, SVG renderer, PDF converter and many other \
    usages.

use_zip             yes
distname            ${name}-${version}-source
worksrcdir          ${name}-${version}

checksums           rmd160  5fc74f51e945d421e18efe670fcad6888e193e0e \
                    sha256  0c5ece9ea7f721bbefbf3b3db1ffaf910897298bf968c66638c924f1225bd4a5

patchfiles          patch-build.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
}
