# $Id$

PortSystem          1.0
PortGroup           cmake 1.0

name                indi

version             0.8
revision            2
set branch          [join [lrange [split ${version} .] 0 1] .]

categories          science
license             LGPL-2.1+
maintainers         gmail.com:jtomshine

description         distributed control protocol for astronomical instrumentation
long_description    INDI is a distributed control protocol designed to \
                    operate astronomical instrumentation. INDI is small, \
                    flexible, easy to parse, and scalable. It supports common \
                    DCS functions such as remote control, data acquisition, \
                    monitoring, and a lot more.  With INDI, you have a total \
                    transparent control over your instruments so you can get \
                    more science with less time.
                    
homepage            http://www.indilib.org/
master_sites        sourceforge:project/indi/indilib/${branch}

platforms           darwin

distname            libindi_${version}

checksums           sha1    5bf30b66f57f4e5dd63b38798e9eacc853c59d9b \
                    rmd160  882f8f99df1d24fa36c58e2090a9f6baaee00df7
                    
depends_lib         port:libnova \
                    port:zlib \
                    port:libusb \
                    port:boost \
                    port:libusb-compat \
                    port:cfitsio

worksrcdir          libindi-${version}

patchfiles          patch-libindi.pc.cmake.diff

if {${configure.compiler} == "clang"} {
    configure.compiler llvm-gcc-4.2
}

configure.args-append \
                   -DWITH_CFITSIO=ON \
                   -DWITH_FLI=OFF \
                   -DNOVA_INCLUDE_DIR=${prefix}/include/libnova \
                    -DNOVA_LIBRARIES=${prefix}/lib/libnova.dylib \
                    -DBUILD_ROOT=${destroot} \
                   ${worksrcpath}

pre-activate {
    # Remove symlinks left behind by indi 0.8_0 and earlier.
    foreach file {indi_lx200_16 indi_lx200ap indi_lx200autostar indi_lx200classic indi_lx200gps indi_tcfs3_focus} {
        file delete -force ${prefix}/bin/${file}
    }
}

livecheck.type      sourceforge
livecheck.regex     /libindi_(\[0-9.\]+)${extract.suffix}