# $Id: Portfile 118591 2014-04-05 10:17:18Z ram@macports.org $

PortSystem    1.0
PortGroup     active_variants 1.1
PortGroup     conflicts_build 1.0

name          lalpulsar
version       1.9.0
revision      3
categories    science
platforms     darwin
maintainers   ram
license       GPL

description   LSC Algorithm Library - Pulsar
long_description \
  LIGO Scientific Collaboration Algorithm Library - Pulsar containing \
  routines for continuous gravitatin wave gravitational data analysis.

homepage      https://www.lsc-group.phys.uwm.edu/daswg/projects/lalsuite.html
master_sites  http://www.lsc-group.phys.uwm.edu/daswg/download/software/source/lalsuite

checksums     rmd160 f6a08952942ad2a5299361275183f9743ce06989 \
              sha256 e0398ad4a098cbb43fc93ee8cbcbf6705410791ca5fce7de18e6fbccd94826a2

patchfiles    0001-SWIG-make-wrappings-compatible-with-SWIG-v3.0.0.patch
patch.pre_args -p2

depends_build-append port:pkgconfig

depends_lib   port:python27 \
              port:gsl \
              port:lal

configure.python ${prefix}/bin/python2.7
configure.args --mandir=${prefix}/share/man \
               --disable-silent-rules \
               --disable-gcc-flags \
               --disable-debug

use_parallel_build yes

set pythondir "${frameworks_dir}/Python.framework/Versions/2.7/lib/python2.7/site-packages"
destroot.args-append \
              pythondir="${pythondir}" \
              pyexecdir="${pythondir}" \
              pkgpythondir="${pythondir}/${name}" \
              pkgpyexecdir="${pythondir}/${name}"

# FIXME: fails to build if previous version active
conflicts_build ${name}

variant lalxml description {Build with LALXML support} {
  if {[variant_isset swig_python]} {
    require_active_variants lalxml swig_python
  }
  depends_lib-append   port:libxml2 \
                       port:lalxml
  configure.args-append --enable-lalxml
}

variant swig_python description {Build python SWIG bindings} {
  require_active_variants lal swig_python
  depends_build-append  port:swig-python
  depends_lib-append    port:py27-numpy
  configure.args-append --enable-swig-python
}

default_variants +lalxml +swig_python

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