# -*- 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

PortSystem          1.0
PortGroup           github 1.0
set qt5.custom_qt_name phantomjs-qt
PortGroup           qmake5 1.0
PortGroup           deprecated 1.0

# please update version of phantomjs-qt and qt5 PG
github.setup        ariya phantomjs 2.1.1
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
revision            0
categories          www
license             BSD
maintainers         nomaintainer

homepage            http://www.phantomjs.org/

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.

checksums           rmd160  939bbfa143f0140c74bf8f04fb905357d61e95d9 \
                    sha256  c58b6e8e8dc96683262cfb287dc0c854f619eacf58fe6ae46457439786c5fc1f \
                    size    1881703

# see https://github.com/ariya/phantomjs/issues/15344
deprecated.upstream_support no

depends_build-append \
                    port:python38

depends_lib-append  port:phantomjs-qt

# add printer support
patchfiles-append   patch-printer_support.diff

use_configure       no
use_xcode           yes

build.cmd           ${prefix}/bin/python3.8 build.py
build.target
build.args          --confirm \
                    --jobs ${build.jobs} \
                    --skip-git \
                    --skip-qtbase \
                    --skip-qtwebkit

post-extract {
    delete ${worksrcpath}/src/qt/qtbase
    ln -s ${qt_dir} ${worksrcpath}/src/qt/qtbase
}

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.regex     {phantomjs-(\d+(?:\.\d+)*)-source\.zip}
