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

name                    php-imagick
categories-append       graphics
maintainers             {ryandesign @ryandesign} openmaintainer
license                 PHP-3.01

php.branches            5.3 5.4 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3
php.pecl                yes

description             PHP extension to create and modify images with \
                        ImageMagick

long_description        Imagick is a native PHP extension for creating and \
                        modifying images using the ImageMagick API

if {[vercmp ${php.branch} >= 5.4]} {
    epoch               1
    version             3.7.0
    revision            1
    checksums           rmd160  60d5c6cc154b65bdfd31be6980633ff1e659bc73 \
                        sha256  5a364354109029d224bcbb2e82e15b248be9b641227f45e63425c06531792d3e \
                        size    360138
} else {
    # imagick 3.4.0RC1 dropped support for PHP 5.3.
    # https://pecl.php.net/package-info.php?package=imagick&version=3.4.0RC1
    epoch               2
    version             3.3.0
    revision            1
    checksums           rmd160  5746dc20ed455049a6eb5cea8dfe2b6c702c8f7c \
                        sha256  bd69ebadcedda1d87592325b893fa78a5710a0ca7307f8e18c5e593949b1db2d \
                        size    179978
}

if {${name} ne ${subport}} {
    depends_build-append \
                        path:bin/pkg-config:pkgconfig

    depends_lib-append  port:ImageMagick

    configure.args      --with-imagick=${prefix}

    post-destroot {
        set docdir ${prefix}/share/doc/${subport}
        xinstall -d ${destroot}${docdir} ${destroot}${prefix}/share/examples
        xinstall -m 0644 -W ${worksrcpath} CREDITS ${destroot}${subport}
        copy ${worksrcpath}/examples ${destroot}${prefix}/share/examples/${subport}
    }
}
