# -*- 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     conflicts_build 1.0
PortGroup     active_variants 1.1
PortGroup     python 1.0

name          gds
version       2.18.7
revision      13
categories    science
platforms     darwin
maintainers   nomaintainer
license       GPL

description   LSC Algorithm Library
long_description \
  LIGO Scientific Collaboration Algorithm Library containing core \
  routines for gravitational wave data analysis.

homepage      https://www.lsc-group.phys.uwm.edu/daswg/projects/lalsuite.html
master_sites  https://software.igwn.org/lscsoft/source/

patchfiles    patch-std_cplusplus_2017.diff

checksums     rmd160  3b2186057dec5d1e530ee1cefbfd12ab4f976d40 \
              sha256  e592727d686af1042d775f192531d440600105c12d7cdad63455cfad3fb9913c

depends_build-append \
              port:pkgconfig \
              port:swig \
              port:swig-python

depends_lib   port:python27 \
              port:py27-numpy \
              port:curl \
              port:expat \
              port:fftw-3 \
              port:fftw-3-single \
              port:hdf5 \
              port:jsoncpp \
              port:ldas-tools-framecpp \
              port:metaio

# Fix things after PortGroup python

use_configure      yes
use_parallel_build yes
build.cmd          make
build.target       all
destroot.cmd       ${build.cmd}
destroot.target    install
destroot.destdir   DESTDIR=${destroot}
destroot.args      " "
destroot.pre_args      ${destroot.target}
destroot.post_args      ${destroot.destdir}

# Use the --without-sasl option since the macports version of sasl2
# leads to a 5 minute latency for each socket connection.

configure.python ${prefix}/bin/python2.7
configure.args --enable-dtt \
               --enable-python \
               --enable-root-objects \
               --without-sasl \
               --with-jsoncpp=${prefix}

destroot.args-append \
              pythondir="${python.pkgd}" \
              pyexecdir="${python.pkgd}" \
              pkgpythondir="${python.pkgd}/${name}" \
              pkgpyexecdir="${python.pkgd}/${name}"

# Use root 6 for High Sierra and beyond else root 5

if {${os.platform} eq "darwin" && ${os.major} >= 17 } {
    configure.env           CXXFLAGS=-std=c++1z

    depends_lib-append      port:root6

    require_active_variants root6 python27
} else {
    configure.env           CXXFLAGS=-std=c++11

    depends_lib-append  port:root5

    require_active_variants root5 python27
}

livecheck.type   regex
livecheck.url    ${master_sites}
livecheck.regex  {gds-(\d+(?:\.\d+)*).tar.gz}
