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

gitlab.instance     https://gitlab.gnome.org
gitlab.setup        GNOME gtk-mac-bundler 0.7.4 bundler-
revision            2

categories          devel
license             GPL-2
maintainers         {mascguy @mascguy} openmaintainer
platforms           {darwin any}
supported_archs     noarch

description         Mac OS X application bundle utility
long_description    A utility that aids in the creation of Mac OS X \
                    application bundles. The gtk3-demo example is \
                    patched in macports to produce a gtk3-demo \
                    without jhbuild environment. To test the demo run \
                    gtk-mac-bundler <prefix>/share/gtk-mac-bundler/examples/gtk3-demo.bundle \
                    This will create the GtkDemo bundle in ~/Desktop

checksums           rmd160  9f9ab8eb90f7430e0b850161ec616236f0f18d65 \
                    sha256  1d9bdc22aeb3447ed68d964716fe845738310c01cc9f3105173e0eea2851721c \
                    size    31943

set py_ver          2.7
set py_ver_nodot    [string map {. {}} ${py_ver}]

# Note: patch-0.7.4-to-24Feb2016.diff brings 0.7.4 to the commit dated 2016/02/24 - Remove after update
patchfiles-append   patch-0.7.4-to-24Feb2016.diff
patchfiles-append   patch-bundler_py.diff
patchfiles-append   patch-gtk3-demo-bundle.diff
patchfiles-append   patch-gtk3-launcher.diff

depends_lib-append \
                    port:python${py_ver_nodot}

use_configure       no

build {}

pre-destroot {
    set py_bin ${prefix}/bin/python${py_ver}
    set py_lib ${frameworks_dir}/Python.framework/Versions/${py_ver}/lib/python${py_ver}
    set py_pkg ${py_lib}/site-packages

    reinplace -W ${worksrcpath} "s|/usr/bin/env python|${py_bin}|g" \
                    gtk-mac-bundler.in
    reinplace -W ${worksrcpath} "s|@PATH@|${py_pkg}|g" \
                    gtk-mac-bundler.in
    reinplace -W ${worksrcpath} "s|\${env:JHBUILD_PREFIX}|${prefix}|g" \
                    examples/gtk3-demo.bundle

    xinstall -d ${destroot}${py_lib}
    copy ${worksrcpath}/bundler ${destroot}${py_lib}

    set share_dir ${prefix}/share/${name}
    xinstall -d ${destroot}${share_dir}
    copy ${worksrcpath}/examples ${destroot}${share_dir}
}

destroot.args       bindir=${destroot}${prefix}/bin
