# -*- 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           bitbucket 1.0
PortGroup           cmake 1.1

bitbucket.setup     petebunting rsgislib 3.4.9
revision            4
categories          gis
license             GPL-3
maintainers         {vince @Veence}
description         RSGISlib - Remote Sensing and GIS Library
long_description    This library provides a lot of advanced tools to \
                    perform image analysis and feature detection in \
                    remote sensing and GIS applications.
platforms           darwin
homepage            http://www.rsgislib.org
bitbucket.tarball_from  downloads

checksums               rmd160  028471cc352fc787ed8fd3e230f68c7db486107d \
                        sha256  a271aee61395166542f3283fe899eff317ffb782f59ca90da0f008a203ebe5f3 \
                        size    8092496

depends_lib-append      port:gdal \
                        port:geos \
                        port:cgal \
                        port:boost \
                        port:xercesc3 \
                        port:gsl \
                        port:fftw-3 \
                        port:kealib \
                        port:muparser

if {![variant_isset python27] && ![variant_isset python35] && \
    ![variant_isset python36]} {

    default_variants +python36
}

patchfiles              patch-CMakeLists.txt.diff

# /bin/sh: line 0: cd: build/python: No such file or directory
cmake.out_of_source     no

configure.args-append   -DBOOST_INCLUDE_DIR=${prefix}/include \
                        -DBOOST_LIB_PATH=${prefix}/lib \
                        -DCGAL_INCLUDE_DIR=${prefix}/include \
                        -DCGAL_LIB_PATH=${prefix}/lib \
                        -DFFTW_INCLUDE_DIR=${prefix}/include \
                        -DFFTW_LIB_PATH=${prefix}/lib \
                        -DGDAL_INCLUDE_DIR=${prefix}/include \
                        -DGDAL_LIB_PATH=${prefix}/lib \
                        -DGEOS_INCLUDE_DIR=${prefix}/include \
                        -DGEOS_LIB_PATH=${prefix}/lib \
                        -DGMP_INCLUDE_DIR=${prefix}/include \
                        -DGMP_LIB_PATH=${prefix}/lib \
                        -DGSL_INCLUDE_DIR=${prefix}/include \
                        -DGSL_LIB_PATH=${prefix}/lib \
                        -DHDF5_INCLUDE_DIR=${prefix}/include \
                        -DHDF5_LIB_PATH=${prefix}/lib \
                        -DINSTALL_PYTHON_USING_PREFIX=ON \
                        -DKEA_INCLUDE_DIR=${prefix}/include \
                        -DKEA_LIB_PATH=${prefix}/lib \
                        -DMPFR_INCLUDE_DIR=${prefix}/include \
                        -DMPFR_LIB_PATH=${prefix}/lib \
                        -DMUPARSER_INCLUDE_DIR=${prefix}/include \
                        -DMUPARSER_LIB_PATH=${prefix}/lib \
                        -DXERCESC_INCLUDE_DIR=${prefix}/include \
                        -DXERCESC_LIB_PATH=${prefix}/lib

variant python27 description {Build with Python 2.7 bindings} \
                 conflicts python35 python36 {

    depends_build-append    port:py27-numpy
    configure.args-append   -DPYTHON_EXE=${prefix}/bin/python2.7
    configure.args-append   -DPYTHON_INSTALL_PREFIX=${destroot}${frameworks_dir}/Python.framework/Versions/2.7/
}

variant python35 description {Build with Python 3.5 bindings} \
                 conflicts python27 python36 {

    depends_build-append    port:py35-numpy
    configure.args-append   -DPYTHON_EXE=${prefix}/bin/python3.5
    configure.args-append   -DPYTHON_INSTALL_PREFIX=${destroot}${frameworks_dir}/Python.framework/Versions/3.5/
}

variant python36 description {Build with Python 3.6 bindings} \
                 conflicts python27 python35 {

    depends_build-append    port:py36-numpy
    configure.args-append   -DPYTHON_EXE=${prefix}/bin/python3.6
    configure.args-append   -DPYTHON_INSTALL_PREFIX=${destroot}${frameworks_dir}/Python.framework/Versions/3.6/
}