# -*- 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 67218 2010-05-03 00:32:05Z jmr@macports.org $

PortSystem 1.0

name            xsane
version         0.996
revision        3
categories      graphics x11
maintainers     puffin.lb.shuttle.de:michael.klein openmaintainer
description     X11 frontend for SANE
homepage        http://www.xsane.org/
platforms       darwin

long_description This is an X11 frontend for the Scanner Access Now Easy \
                 Project.

master_sites    http://gd.tuwien.ac.at/api/sane/xsane/ \
                ftp://ftp.sane-project.org/pub/sane/xsane/ \
                ftp://ftp3.sane-project.org/pub/sane/xsane/ \
                ftp://gd.tuwien.ac.at/api/sane/xsane/ \
                ftp://sunsite.uio.no/pub/sane/xsane/

checksums       md5     7dcbcdf0e83322d7c0a543672d9ca2d8 \
                sha1    2f2a709b577463cc57d6dacec4a530a8c4feb8c6 \
                rmd160  c927274a1d09aa74c95fc2a55f4494b261840f23

depends_lib     lib:libgimp-2.0:gimp2 \
                port:gtk2 \
                port:sane-backends

patchfiles      patch-src-xsane-back-gtk.c.diff \
                patch-sane-options-handling-fix.diff \
                patch-gtk_adjustment_new.diff

destroot.destdir        prefix=${destroot}${prefix}
post-destroot {
    delete ${destroot}${prefix}/share/man
    file rename ${destroot}${prefix}/man ${destroot}${prefix}/share/man

    system "strip ${destroot}${prefix}/bin/xsane"

    if {![variant_isset disable_gimp]} {
        xinstall -d ${destroot}${prefix}/lib/gimp/2.0/plug-ins
        ln -sf ${prefix}/bin/xsane ${destroot}${prefix}/lib/gimp/2.0/plug-ins
    }
}

variant disable_gimp description {Disable building of GIMP plugin} {
    depends_lib-delete      lib:libgimp-2.0:gimp2
    configure.args-append   --disable-gimp
}

livecheck.type  regex
livecheck.url   ftp://ftp.sane-project.org/pub/sane/xsane/
livecheck.regex "${name}-(\\d+(?:\\.\\d+)*)${extract.suffix}"
