# -*- 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 64763 2010-03-15 16:31:33Z nox@macports.org $

PortSystem 1.0

name            gimp-jp2
version         2.2.0
revision        3
maintainers     devans
description     GIMP Wavelet/JPEG 2000 plug-in.
long_description \
                GIMP Wavelet/JPEG 2000 plug-in, written by Divyanshu Vats, from \
                the 2006 GIMP Google Summer of Code wavelet project, mentored by Simon Budig.

universal_variant no

categories      graphics
platforms       darwin
homepage        http://registry.gimp.org/node/9899

distname        jp2
master_sites    http://registry.gimp.org/files/

checksums       md5     dfe378981796eaeefde35874d175c9e0 \
                sha1    6caab9ebb067b44659d59bced3da5bb54634b690 \
                rmd160  6694475d690824feb4a1cb8b4cb232857700694c

depends_lib     lib:libgimp-2.0:gimp2 \
                port:openjpeg

post-patch {
    reinplace "s|#include <malloc.h>||" ${worksrcpath}/src/main.c
    reinplace "s|#include \"openjpeg.h\"|#include <openjpeg.h>|" ${worksrcpath}/src/interface.h \
              ${worksrcpath}/src/jp2read.c ${worksrcpath}/src/jp2write.c ${worksrcpath}/src/main.c \
              ${worksrcpath}/src/main_back.c
    reinplace "s|MAX_PATH|OPJ_PATH_LEN|" \
              ${worksrcpath}/src/jp2read.c ${worksrcpath}/src/jp2write.c \
              ${worksrcpath}/src/main_back.c
    file delete ${worksrcpath}/src/openjpeg.h
}

post-destroot {
    delete  ${destroot}${prefix}/share/gimp-plugin-template
}

livecheck.type  moddate
livecheck.url   ${master_sites}${distname}${extract.suffix}
