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

PortSystem      1.0
PortGroup       cmake 1.0

name            vxl
version         1.17.0
revision        1
set branch      [join [lrange [split ${version} .] 0 1] .]
categories      devel
maintainers     nomaintainer
description     C++ libraries for computer vision
long_description \
    VXL (the Vision-something-Libraries) is a collection of C++ libraries \
    designed for computer vision research and implementation. It was \
    created from TargetJr and the IUE with the aim of making a light, \
    fast and consistent system. VXL is written in ANSI/ISO C++ and is \
    designed to be portable over many platforms.
homepage        http://vxl.sourceforge.net/
platforms       darwin

master_sites    sourceforge:project/vxl/vxl/${branch}
use_zip         yes
checksums       rmd160  a00d811aa86b2d3a2dad292ff94991c034092434 \
                sha256  b06b4a087486af3a270ced2597242bd6cc4e3381779f27a944ea0620208ae7e1

# licenses in vxl:
# (see also: http://anonscm.debian.org/viewvc/debian-med/trunk/packages/vxl/trunk/debian/copyright?revision=10688&view=markup)
# BSD       for core
# GPL-2+    for v3p/Qv/*
# zlib      for v3p/zlib/*
# GPL-2+    for v3p/mpeg2/libmpeg2/*
# MIT       for v3p/geotiff/*
# Boost     for core/vul/vul_ios_state.h
# Boost     for contrib/rpl/rgrl/*
# MIT/X11   for contrib/brl/b3p/shapelib/* (or LGPL-something)
# zlib      for contrib/brl/b3p/minizip/*
# GPL-2+    for vidl_vil1/vidl_vil1_mpegcodec.cxx and vidl1/vidl1_mpegcodec.cxx
# Boost     for vcl_atomic_count.h and vcl/internal/*
license         BSD GPL-2+ zlib MIT Boost

# ensure that embedded openjpeg2 openjpeg.h takes precedence over that from external openjpeg15 or openjpeg
# disable ffmpeg support that fails to build with current ffmpeg versions
# disable broken contrib/prip code

patchfiles      patch-use-embedded-openjpeg2.diff \
                patch-contrib_mul_tools_crop_image_2d.cxx.diff \
                patch-contrib_mul_tools_crop_image_3d.cxx.diff \
                patch-disable-broken-ffmpeg.diff \
                patch-disable-contrib-prip.diff

depends_lib-append \
                port:jpeg \
                port:tiff \
                port:libgeotiff \
                port:libpng \
                port:zlib \
                port:bzip2 \
                port:libdc1394

if {[string match *clang* ${configure.compiler}]} {
    configure.cxxflags-append -Werror=gnu -Wno-error=vla -std=c++0x
    patchfiles-append   patch-core_vul_vul_psfile.h.diff
}

configure.args-append \
    -DBUILD_SHARED_LIBS=YES \
    -DCMAKE_INSTALL_NAME_DIR=${prefix}/lib/${name} \
    -DBUILD_BRL=NO

# shuffle directories around to turn ${prefix}/lib into ${prefix}/lib/${name}
post-destroot {
    file rename ${destroot}${prefix}/lib ${destroot}${prefix}/tmp
    file mkdir ${destroot}${prefix}/lib
    file rename ${destroot}${prefix}/tmp ${destroot}${prefix}/lib/${name}

    # for some reason this file doesn't get installed, making rev-upgrade complain
    xinstall -m 755 ${worksrcpath}/lib/libvpgl.dylib ${destroot}${prefix}/lib/${name}
}

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