# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4

PortSystem          1.0
PortGroup           gobject_introspection 1.0

name                clutter
version             1.26.4
revision            2
license             LGPL-2.1
set branch          [join [lrange [split ${version} .] 0 1] .]
categories          graphics
maintainers         {devans @dbevans} openmaintainer
platforms           darwin macosx
description         A generic high-level canvas library.
long_description    Clutter is an open source software library for \
                    creating fast, compelling, portable, and dynamic graphical \
                    user interfaces.
homepage            https://wiki.gnome.org/Projects/Clutter
master_sites        gnome:sources/${name}/${branch}/

use_xz              yes

checksums           rmd160  3180b7cbf08223e7bd1ae07d8bbfc3a1fd3bec32 \
                    sha256  8b48fac159843f556d0a6be3dbfc6b083fc6d9c58a20a49a6b4919ab4263c4e6 \
                    size    5403168

depends_build       port:pkgconfig

depends_lib         port:atk \
                    path:lib/pkgconfig/gtk+-3.0.pc:gtk3 \
                    path:lib/pkgconfig/cairo.pc:cairo \
                    path:lib/pkgconfig/pango.pc:pango \
                    port:json-glib \
                    port:cogl

gobject_introspection yes

patchfiles          patch-use-x11-backend-as-default.diff

variant x11 conflicts quartz {
    depends_lib-append path:lib/pkgconfig/gdk-pixbuf-2.0.pc:gdk-pixbuf2 \
                       port:xorg-libXcomposite \
                       port:xorg-libXdamage \
                       port:xorg-libXext \
                       port:xorg-libXfixes

    configure.args     --with-x \
                       --x-includes=${prefix}/include \
                       --x-libraries=${prefix}/lib \
                       --enable-gdk-backend=yes \
                       --enable-x11-backend=yes \
                       --enable-gdk-pixbuf=yes \
                       --enable-quartz-backend=no \
                       --disable-examples \
                       --disable-silent-rules \
                       --disable-gtk-doc

    # https://trac.macports.org/ticket/71653
    configure.args-append \
                       --enable-egl-backend=no \
                       --enable-wayland-backend=no
}

variant quartz conflicts x11 {

    # https://trac.macports.org/ticket/65862
    patchfiles-append clutter-fix-quartz-headers.diff

    configure.args  --without-x \
                    --enable-x11-backend=no \
                    --enable-gdk-backend=yes \
                    --enable-gdk-pixbuf=no \
                    --enable-quartz-backend=yes \
                    --disable-silent-rules \
                    --disable-gtk-doc

    # https://trac.macports.org/ticket/71653
    configure.args-append \
                    --enable-egl-backend=no \
                    --enable-wayland-backend=no
}

variant debug description {Enable full debugging} {
    configure.args-append --enable-debug=yes
}

if {![variant_isset quartz]} {
    default_variants +x11
}

livecheck.type      gnome
