# -*- 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           ocaml 1.0
PortGroup           active_variants 1.1
PortGroup           github 1.0

github.setup        garrigue lablgtk 2.18.11
revision            1
checksums           rmd160  f119068f330f0c481a5e9ea3ef4014d04e10141d \
                    sha256  ff3c551df4e220b0c0fb9a3da6429413bff14f8fc93f4dd6807a35463982c863 \
                    size    1068587

name                lablgtk2
categories          x11 ocaml
platforms           darwin
maintainers         {pmetzger @pmetzger} openmaintainer
# the apps have a much more restrictive license than the library code
license             {LGPL-2 Restrictive/Distributable}

description         OCaml interface to gtk+ 2.x

long_description    LablGTK2 is is an OCaml interface to gtk+ 2.x. \
                    It uses the rich type system of OCaml to provide a \
                    strongly typed, yet very comfortable, object-oriented \
                    interface to gtk+.

github.tarball_from archive

homepage            https://garrigue.github.io/lablgtk/

depends_build       port:pkgconfig

depends_lib         port:ocaml \
                    port:ocaml-findlib \
                    port:gtk2 \
                    port:libglade2 \
                    port:libgnomecanvas \
                    port:libgnomeui

configure.args      --with-libdir=${ocamlfind_dir} \
                    --without-gl \
                    --with-glade \
                    --with-gnomecanvas \
                    --with-gnomeui \
                    --without-panel \
                    --without-rsvg \
                    --without-gtkspell \
                    --without-gtksourceview \
                    --without-gtksourceview2

build.target        world
# Temporarily disable installation of docs until the docs
# no longer depend on camlp4
#build.target        world doc
use_parallel_build  no

pre-destroot { xinstall -m 755 -d "${destroot}${prefix}/lib/ocaml/site-libs/stublibs" }

destroot.target     old-install

post-destroot {
    xinstall -m 755 -d ${ocamlfind_destdir}/lablgtk2 \
        ${destroot}${prefix}/share/doc/${name}
    # Temporarily disable installation of docs until the docs
    # no longer depend on camlp4
    #file copy ${worksrcpath}/doc/html ${destroot}${prefix}/share/doc/${name}/
}

variant gl description "enable gtkglarea support" {
    configure.args-delete   --without-gl
    configure.args-append   --with-gl
    depends_lib-append      port:lablgl port:gtkglarea2
}

variant rsvg description "enable rsvg support" {
    configure.args-delete   --without-rsvg
    configure.args-append   --with-rsvg
    depends_lib-append      port:librsvg
}

variant gtksourceview description "enable gtksourceview support" {
    configure.args-delete   --without-gtksourceview
    configure.args-append   --with-gtksourceview
    depends_lib-append      port:gtksourceview
}

variant gtksourceview2 description "enable gtksourceview2 support" {
    configure.args-delete   --without-gtksourceview2
    configure.args-append   --with-gtksourceview2
    depends_lib-append      port:gtksourceview2
}

variant x11 conflicts quartz {
    configure.args-append   --without-quartz
}

variant quartz conflicts x11 {
    configure.args-append   --with-quartz

    # for now, libgnomeui does not install if gtk2 was installed with +quartz
    depends_lib-delete      port:libgnomeui
    configure.args-replace  --with-gnomeui --without-gnomeui
}

if {![variant_isset quartz]} {
    default_variants +x11
    require_active_variants gtk2 x11 quartz
} else {
    require_active_variants gtk2 quartz x11
}

github.livecheck.regex     {(\d+(?:\.\d+)+)}
