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

name                cogl
version             1.22.8
revision            1
set branch          [join [lrange [split ${version} .] 0 1] .]
categories          graphics
description         A hardware accelerated 3D graphics API
long_description    Cogl is a small open source library for using 3D graphics hardware \
                    for rendering. The API departs from the flat state machine style \
                    of OpenGL and is designed to make it easy to write orthogonal \
                    components that can render without stepping on each others toes.
license             LGPL-2+
maintainers         {devans @dbevans} openmaintainer
platforms           darwin
homepage            https://wiki.gnome.org/Projects/Clutter
master_sites        gnome:sources/${name}/${branch}

use_xz              yes

checksums           rmd160  33d19594df65c330bd56f53578d832e7c358ab9d \
                    sha256  a805b2b019184710ff53d0496f9f0ce6dcca420c141a0f4f6fcc02131581d759 \
                    size    1742632

# Pulling in port:grep due to this error observed on the Lion buildbot:
# libtool: link: /usr/bin/grep -E -e "^(cogl|_cogl_debug_flags|_cogl_atlas_new|_cogl_atlas_add_reorganize_callback|_cogl_atlas_reserve_space|_cogl_callback|_cogl_util_get_eye_planes_for_screen_poly|_cogl_atlas_texture_remove_reorganize_callback|_cogl_atlas_texture_add_reorganize_callback|_cogl_texture_foreach_sub_texture_in_region|_cogl_profile_trace_message|_cogl_context_get_default|_cogl_framebuffer_get_stencil_bits|_cogl_clip_stack_push_rectangle|_cogl_framebuffer_get_modelview_stack|_cogl_object_default_unref|_cogl_pipeline_foreach_layer_internal|_cogl_clip_stack_push_primitive|_cogl_buffer_unmap_for_fill_or_fallback|_cogl_framebuffer_draw_primitive|_cogl_debug_instances|_cogl_framebuffer_get_projection_stack|_cogl_pipeline_layer_get_texture|_cogl_buffer_map_for_fill_or_fallback|_cogl_framebuffer_get_clip_state|_cogl_texture_can_hardware_repeat|_cogl_pipeline_prune_to_n_layers|_cogl_primitive_draw|test_|unit_test_).*" ".libs/libcogl.exp" > ".libs/libcogl.expT"
# grep: Regular expression too big

depends_build-append port:gtk-doc \
                     port:pkgconfig \
                     port:grep

depends_lib-append   path:lib/pkgconfig/cairo.pc:cairo \
                     path:lib/pkgconfig/pango.pc:pango

patchfiles          leopard.patch 

gobject_introspection yes

use_autoreconf      yes
autoreconf.args     -fvi

configure.args      --enable-cogl-pango=yes \
                    --disable-maintainer-flags \
                    --disable-silent-rules

use_parallel_build  no

variant x11 conflicts quartz {
    patchfiles-append     patch-disable-quartz.diff
    depends_lib-append    path:lib/pkgconfig/gdk-pixbuf-2.0.pc:gdk-pixbuf2 \
                          port:mesa \
                          port:xorg-libXcomposite \
                          port:xorg-libXdamage \
                          port:xorg-libXext \
                          port:xorg-libXfixes \
                          port:xorg-libXrandr
    configure.args-append --with-x \
                          --x-includes=${prefix}/include \
                          --x-libraries=${prefix}/lib \
                          --enable-glx=yes \
                          --enable-gdk-pixbuf=yes \
                          --enable-quartz-image=no
}

variant quartz conflicts x11 {
    configure.args-append --enable-glx=no \
                          --enable-gdk-pixbuf=no \
                          --enable-quartz-image=yes \
                          --without-x
    configure.ldflags-append    \
                          -framework ApplicationServices \
                          -framework QuartzCore
}

variant debug description {Enable debugging} {
    configure.optflags -g -O0
    configure.args-append --enable-debug=yes
}

variant examples description {Install simple example applications} {
    configure.args-append --enable-examples-install=yes
}

variant gstreamer description {Enable GStreamer support} {
    configure.args-append --enable-cogl-gst

    depends_lib-append    port:gstreamer1
}

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

livecheck.type      gnome
