# -*- 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
PortGroup           perl5 1.0

# Keep relevant lines in sync between ImageMagick and p5-perlmagick.

epoch               1
perl5.branches      5.28 5.30 5.32 5.34
perl5.setup         PerlMagick 6.9.13-52
github.setup        ImageMagick ImageMagick6 6.9.13-52
revision            0

set my_name         ImageMagick
github.tarball_from releases
distname            ${my_name}-${version}
use_xz              yes

checksums           rmd160  d255f948705898e3d63afd0c26a8ed534b8402f5 \
                    sha256  0e313e1a4d3bcac8bdce22fcaa31589ccb5450a17966e7ce8d22c407b04b437b \
                    size    9727724

maintainers         {ryandesign @ryandesign} \
                    openmaintainer
description         Perl extension for calling ImageMagick's libMagick methods
long_description    {*}${description}
license             Apache-2

# We use the ImageMagick distribution version of PerlMagick to
# ensure it will always match the ImageMagick version.

homepage            https://legacy.imagemagick.org/script/perl-magick.php
master_sites        https://imagemagick.org/archive/ \
                    https://imagemagick.org/archive/releases/ \
                    https://mirror.aarnet.edu.au/pub/imagemagick/ \
                    https://ftp.icm.edu.pl/pub/unix/graphics/ImageMagick/ \
                    https://mirror.accum.se/mirror/imagemagick.org/ftp/ \
                    https://mirror.metanet.ch/imagemagick/ \
                    http://mirror.checkdomain.de/imagemagick/releases/ \
                    ftp://sunsite.icm.edu.pl/packages/ImageMagick/releases/

dist_subdir         ImageMagick

if {${perl5.major} != ""} {
depends_lib-append  port:ImageMagick

patchfiles          no-usr-include-ImageMagick.patch

# https://trac.macports.org/wiki/WimplicitFunctionDeclaration#strchr
configure.checks.implicit_function_declaration.whitelist-append strchr

configure.dir       ${worksrcpath}/PerlMagick
build.dir           ${configure.dir}

pre-configure {
    system -W ${worksrcpath} "CC=${configure.cc} CXX=${configure.cxx} ./configure --prefix=${prefix} --disable-openmp --with-quantum-depth=16 --with-perl=${perl5.bin} --without-gcc-arch"
    system -W ${worksrcpath} "make perl-sources"
}

use_parallel_build  no

livecheck.type      none
} else {
livecheck.url       ${github.homepage}/tags
livecheck.regex     archive/refs/tags/[join ${github.livecheck.regex}]\\.tar\\.gz
}
