# -*- 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
# $Id: Portfile 88758 2012-01-10 21:16:08Z ryandesign@macports.org $

PortSystem                  1.0
PortGroup                   app 1.0

name                        MyPaint
set my_name                 mypaint
version                     1.0.0
revision                    1
homepage                    http://mypaint.info/
categories                  graphics
maintainers                 ryandesign
license                     GPL-2 LGPL
use_xz                      yes
platforms                   darwin
use_parallel_build          yes
distname                    ${my_name}-${version}

description                 a fast and easy graphics application for digital painters

long_description            ${name} is ${description}. It lets you focus on the art \
                            instead of the program. You work on your canvas with \
                            minimum distractions, bringing up the interface only \
                            when you need it.

master_sites                http://download.gna.org/mypaint/

checksums                   rmd160  ca53e03adb1ec3a37e8c8528a03698f892584625 \
                            sha256  1cf196c0f8a528325b19dc1908bb057d299020c10ac32f407e27b0de8b0a5e9c

depends_build               port:pkgconfig \
                            port:scons \
                            port:swig-python

depends_lib                 port:libpng \
                            port:protobuf-python27 \
                            port:py27-gtk \
                            port:py27-numpy

depends_run                 port:hicolor-icon-theme

patchfiles                  patch-SConstruct.diff

post-patch {
    reinplace "s|@PREFIX@|${prefix}|g" ${worksrcpath}/SConstruct
}

use_configure               no

variant universal {}

build.cmd                   scons
build.target
build.args                  prefix=${prefix}
build.env                   CXX="${configure.cxx} [get_canonical_archflags]"

destroot.destdir            prefix=${destroot}${prefix}
destroot.env                CXX="${configure.cxx} [get_canonical_archflags]"

post-destroot {
    set docdir ${destroot}${prefix}/share/doc/${name}
    xinstall -d ${docdir}
    xinstall -m 644 -W ${worksrcpath} \
        COPYING \
        LICENSE \
        README \
        ${docdir}
}

post-activate {
    system "${prefix}/bin/gtk-update-icon-cache -tf ${prefix}/share/icons/hicolor"
}

app.executable              ${workpath}/${name}
app.icon                    pixmaps/mypaint_logo.png

platform macosx {
    post-extract {
        xinstall -m 755 ${filespath}/${name}.in ${workpath}/${name}
    }
    post-patch {
        reinplace "s|@PREFIX@|${prefix}|g" ${workpath}/${name}
    }
}

livecheck.type              regex
livecheck.url               [lindex ${master_sites} 0]
livecheck.regex             ${my_name}-(\[0-9.\]+)\\.tar
