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

github.setup        jcupitt libvips 8.6.4 v
revision            1
name                vips
distname            vips-${version}
description         VIPS is an image processing library.
long_description    VIPS is an image processing library. It is good for \
                    large images and for colour.
maintainers         {bgilbert @bgilbert} {gmail.com:jcupitt @jcupitt}
categories          graphics
platforms           darwin
license             LGPL-2.1+
homepage            https://jcupitt.github.io/libvips/
github.tarball_from releases

checksums           rmd160  80770fe6e1a52c9d334736597b749fea60e043f0 \
                    sha256  4631a080c92b2b371379252e451818604858942b754c924b09843a7f528a8af4

depends_build       port:gtk-doc \
                    port:pkgconfig

depends_lib         path:lib/pkgconfig/glib-2.0.pc:glib2 \
                    path:lib/pkgconfig/pango.pc:pango \
                    port:cfitsio \
                    port:expat \
                    port:fftw-3 \
                    port:giflib \
                    port:ImageMagick \
                    port:jpeg \
                    port:lcms2 \
                    port:libexif \
                    port:libgsf \
                    port:libpng \
                    port:librsvg \
                    port:libtool \
                    port:matio \
                    port:openexr \
                    port:openslide \
                    port:orc \
                    port:poppler \
                    port:tiff \
                    port:webp \
                    port:zlib

gobject_introspection   yes

configure.args      --enable-gtk-doc

proc install_pygi {pyver} {
    global destroot frameworks_dir prefix worksrcpath
    set destdir ${destroot}${frameworks_dir}/Python.framework/Versions/${pyver}/lib/python${pyver}/site-packages/gi/overrides
    xinstall -d ${destdir}
    xinstall ${worksrcpath}/python/packages/gi/overrides/Vips.py ${destdir}
    system "${prefix}/bin/python${pyver} -m compileall ${destdir}"
}
variant python27 description {Install Python 2.7 interface} {
    depends_lib-append      port:py27-gobject3
    post-destroot {
        install_pygi        2.7
    }
    # Include vips7 legacy API
    configure.args-append   --enable-pyvips7 \
                            am_cv_python_pyexecdir='${frameworks_dir}/Python.framework/Versions/2.7/lib/python2.7/site-packages'
    configure.env-append    PYTHON='${prefix}/bin/python2.7'
}
variant python34 description {Install Python 3.4 interface} {
    depends_lib-append      port:py34-gobject3
    post-destroot {
        install_pygi        3.4
    }
}
variant python35 description {Install Python 3.5 interface} {
    depends_lib-append      port:py35-gobject3
    post-destroot {
        install_pygi        3.5
    }
}
variant python36 description {Install Python 3.6 interface} {
    depends_lib-append      port:py36-gobject3
    post-destroot {
        install_pygi        3.6
    }
}
default_variants    +python27