# -*- 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
# $Id: Portfile 119364 2014-04-23 17:45:00Z devans@macports.org $

PortSystem      1.0

name            gedit
version         3.12.1
license         GPL-2
set branch      [join [lrange [split ${version} .] 0 1] .]
description     GNOME editor.
long_description \
                ${description}
maintainers     devans openmaintainer
categories      gnome editors
platforms       darwin
homepage        https://wiki.gnome.org/Apps/Gedit
master_sites    gnome:sources/${name}/${branch}/

use_xz          yes

checksums       rmd160  4921a61f3dc6ba8bac09d323e8ad5ce1dc0b9549 \
                sha256  8e3edc62102934a8be708b0fdf27b86368fa9ede885628283bf8e91b26bbb67f

depends_build   port:pkgconfig \
                port:intltool \
                port:itstool \
                port:yelp-tools \
                port:gnome-common \
                port:gtk-doc

depends_lib     port:desktop-file-utils \
                port:gnome-icon-theme \
                port:gnome-icon-theme-symbolic \
                port:gsettings-desktop-schemas \
                port:gtk3 \
                port:gvfs \
                port:gtksourceview3 \
                port:libpeas \
                port:libsoup \
                port:libxml2 \
                port:enchant \
                port:iso-codes \
                port:zeitgeist \
                port:vala

depends_run     port:gnome-settings-daemon \
                port:yelp

patchfiles      patch-configure.ac.diff

# update m4/intltool.m4 and autoreconf

pre-configure {
    copy -force ${prefix}/share/aclocal/intltool.m4 ${worksrcpath}/m4
}

use_autoreconf  yes
autoreconf.args -fvi

configure.cflags-append \
                -Wno-error=format-nonliteral

configure.args  --enable-zeitgeist \
                --disable-python \
                --disable-schemas-compile \
                --disable-silent-rules

# minimum python version is 3.2.3

variant python32 conflicts python33 python34 description {Use python 3.2} {
    depends_lib-append        port:py32-gobject3
    configure.python          ${prefix}/bin/python3.2
    set python_framework      ${frameworks_dir}/Python.framework/Versions/3.2
    configure.pkg_config_path ${python_framework}/lib/pkgconfig
    configure.args-replace    --disable-python --enable-python
}

variant python33 conflicts python32 python34 description {Use python 3.3} {
    depends_lib-append        port:py33-gobject3
    configure.python          ${prefix}/bin/python3.3
    set python_framework      ${frameworks_dir}/Python.framework/Versions/3.3
    configure.pkg_config_path ${python_framework}/lib/pkgconfig
    configure.args-replace    --disable-python --enable-python
}

variant python34 conflicts python32 python33 description {Use python 3.3} {
    depends_lib-append        port:py34-gobject3
    configure.python          ${prefix}/bin/python3.4
    set python_framework      ${frameworks_dir}/Python.framework/Versions/3.4
    configure.pkg_config_path ${python_framework}/lib/pkgconfig
    configure.args-replace    --disable-python --enable-python
}

if {![variant_isset python32] && ![variant_isset python34]} {
    default_variants +python33
}

notes           "For extra functionality install gedit-plugins"

post-activate    {
    system "${prefix}/bin/update-desktop-database ${prefix}/share/applications"
    system "${prefix}/bin/glib-compile-schemas ${prefix}/share/glib-2.0/schemas"
}

livecheck.type  gnome
