# $Id: Portfile 64763 2010-03-15 16:31:33Z nox@macports.org $

PortSystem 1.0

name            sane-backends
version         1.0.20
revision        3
categories      graphics
maintainers     nomaintainer
description     Backends for scanner access
homepage        http://www.sane-project.org/
platforms       darwin

long_description These are the backends for the Scanner Access Now Easy \
                 project. They allow you to access various scanners either \
                 locally or remote using saned.

master_sites    ftp://ftp.sane-project.org/pub/sane/${distname}/ \
                ftp://ftp.sane-project.org/pub/sane/old-versions/${distname}/

checksums       md5     a0cfdfdebca2feb4f2ba5d3418b15a42 \
                sha1    3b4d2ecde8be404bb44269771cf5dc6e4c10b086 \
                rmd160  b80c0a15a75b3bce07060d65aecdcaf7860c323b

depends_lib     port:jpeg \
                port:libusb-compat \
                port:tiff \
                port:zlib

patchfiles      patch-configure.diff

configure.cppflags-append -no-cpp-precomp -fno-common
configure.args  --mandir=${prefix}/share/man \
                --with-docdir=${prefix}/share/doc/${name} \
                --enable-local-backends --enable-libusb \
                --without-gphoto2

use_parallel_build no

pre-destroot {
               xinstall -d -o root -g admin -m 775 ${destroot}${prefix}/var/lock
}

destroot.keepdirs ${destroot}${prefix}/var/lock

variant disable_localbackends conflicts enable_pnmbackend with_gphoto2 description "turn off compilation of all backends but net" {
    depends_lib-delete      port:libusb-compat
    configure.args-delete   --enable-local-backends --enable-libusb
    configure.args-append   --disable-local-backends --disable-libusb
}

variant enable_pnmbackend conflicts disable_localbackends description "enable the pnm backend for testing frontends (possible security risk, see PROBLEMS file)" {
    configure.args-append   --enable-pnm-backend
}

variant with_gphoto2 conflicts disable_localbackends description "include the gphoto2 backend" {
    depends_lib-append      port:libexif \
                            port:libgphoto2 \
                            port:pkgconfig
    configure.args-delete   --without-gphoto2
    configure.args-append   --with-gphoto2
}

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