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

github.setup        tmbdev iulib b2b66dbcbbbfcb4aac0784ea9f07db998077dbc1
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
version             0.4-20141216
revision            4
checksums           rmd160  65fc45ab177bc74fd839f6ccb72fb4616289697a \
                    sha256  dae24fd427ae7e1c514b37054341823499b719418c5717691477623b731d72ed \
                    size    1525706

categories          graphics
license             Apache-2
maintainers         nomaintainer

description         C++ library of image understanding-related algorithms

long_description    ${name} is a library of image understanding-related \
                    algorithms. It provides basic image processing, \
                    mathematical morphology, and machine learning algorithms.

depends_build       port:scons

depends_lib         port:libpng \
                    path:include/turbojpeg.h:libjpeg-turbo \
                    port:tiff \
                    port:zlib \
                    port:libsdl \
                    port:libsdl_image \
                    port:libsdl_gfx

# Ignore stealth update due to GitHub organization name change (from tmbdev to tmbdev-archve)
master_sites        macports_distfiles

patchfiles          patch-SConstruct.diff \
                    patch-components.cc.diff \
                    imgops.patch \
                    narray-util.patch

post-patch {
    reinplace "s|@@PREFIX@@|${prefix}|g" ${worksrcpath}/SConstruct
}

use_configure       no

variant universal {}

build.cmd           ${prefix}/bin/scons
build.target
build.env           "CC=${configure.cc}" \
                    "CFLAGS=${configure.cflags} [get_canonical_archflags cc]" \
                    "CXX=${configure.cxx}" \
                    "CXXFLAGS=${configure.cxxflags} [get_canonical_archflags cxx]" \
                    "LINKFLAGS=${configure.ldflags} [get_canonical_archflags ld]"
# you can remove the build.args test=yes, but it nice to know they work
# tests do NOT work (presumably on OS X 10.11 and later):
# dyld: Library not loaded: /opt/local/lib/libiulib.dylib
#build.args          test=yes

destroot.destdir    prefix=${destroot}${prefix}
destroot.env        {*}${build.env}
