# -*- 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

PortSystem          1.0
PortGroup           github 1.0
PortGroup           xcode 1.0

github.setup        rharder imagesnap 0.3.0.2
revision            0
checksums           rmd160  74c2c979a0fd5e28d310a45f4c72effab39a0840 \
                    sha256  817660df5a5517c01d5672f28245050e8df12ef5006e98865bdcf07e6338dca4 \
                    size    10579

name                ImageSnap
categories          sysutils graphics
maintainers         {ryandesign @ryandesign}
license             public-domain

description         command-line tool to capture images from iSight or \
                    other video source

long_description    ${name} is a command-line tool that lets you capture \
                    still images from an iSight or other video source.

github.tarball_from archive

if {${os.major} < 9} {
    known_fail      yes
    pre-fetch {
        ui_error "${name} requires Mac OS X 10.5 or greater. Try isightcapture instead."
        return -code error "incompatible Mac OS X version"
    }
} elseif {${os.major} < 11} {
    # 0.2.6 and later use AVFoundation which was introduced in Lion.
    version         0.2.5
    revision        0
    checksums       rmd160  8455b057ce5f27130547524c3a7fb812f54d766e \
                    sha256  2516edd6e8fe35c075f0a6517b9fb8ba9af296f8f29b9e349566b9ba6f729615 \
                    size    45002

    master_sites    sourceforge:project/iharder/imagesnap
    distname        ${name}-v${version}
    extract.suffix  .tgz
    set readme      ReadMeOrDont.rtf
} elseif {${os.major} < 22} {
    version         0.2.16
    revision        0
    checksums       rmd160  2837a2d82922d65048bbe3e842f0c2039a265586 \
                    sha256  103610515aae71fe1eea6bea15b2b48542f88042515d404fb4d0a18f44120a9a \
                    size    12136
    set readme      README.md
} else {
    set readme      README.md
}

post-extract {
    # Delete the precompiled binary so that we compile it ourselves.
    delete ${worksrcpath}/imagesnap
}

xcode.destroot.path ${prefix}/bin

post-destroot {
    set docdir ${destroot}${prefix}/share/doc/${name}
    xinstall -d ${docdir}
    xinstall -m 0644 -W ${worksrcpath} ${readme} ${docdir}
}
