# -*- 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: Portfile 116604 2014-01-30 03:49:17Z aronnax@macports.org $

PortSystem          1.0

name                healpix-cxx
version             3.11.2
categories          science
license             GPL-2
maintainers         aronnax
description         C++ language implementation of HEALPix
long_description \
  Software for pixelization, hierarchical indexing, synthesis, analysis, and \
  visualization of data on the sphere. This is the ${description}.
homepage            http://healpix.sourceforge.net
platforms           darwin
master_sites        sourceforge:project/healpix/Healpix_3.11/autotools_packages/
distname            healpix_cxx-${version}

checksums           md5     38f968d70df801a2d07ce498745925ec \
                    sha1    982620220ef578b5eb9a79357200ee0c1fd7b090

depends_build       port:pkgconfig
depends_lib         port:cfitsio

configure.args-append \
                    --disable-openmp

default_variants    +openmp

variant openmp description "enable OpenMP parallel acceleration" {
    configure.args-delete \
                    --disable-openmp

        # FIXME: llvm-gcc42 is broken, https://trac.macports.org/ticket/40713
        # Only clang really needs to be blacklisted
        compiler.blacklist *gcc-4.2 *clang*
        compiler.fallback macports-gcc-4.8 macports-gcc-4.7 macports-gcc-4.6 macports-gcc-4.5 macports-gcc-4.4 macports-gcc-4.3
}

pre-activate {
    if {[file exists ${prefix}/lib/libchealpix.a]
        && ![catch {set vers [lindex [registry_active healpix] 0]}]
        && [vercmp [lindex $vers 1] 3.00] < 0} {
        registry_deactivate_composite healpix "" [list ports_nodepcheck 1]
    }
}
