# -*- 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$
PortSystem      1.0
PortGroup       compilers 1.0

name            molecfit_third_party
conflicts       molecfit_third_party-devel
version         1.9.5
revision        1
categories      science
license         GPL-2 and Custom-AER
platforms       darwin
maintainers     eso.org:usd-help
description     3rd party tools for the Molecfit library
long_description This package fulfils Molecfit's dependency requirements. \
                It provides the The 3rd party command line tools and data files that are needed by Molecfit itself.
homepage        http://www.eso.org/sci/software/pipelines/skytools/molecfit
master_sites    https://ftp.eso.org/pub/dfs/pipelines/libraries/${name}
distfiles       ${name}-${version}.tar
checksums       sha256 d71ff1cbf1eaec211af64b6b0fa4d8400282274b0a63ddf992ba0ab494d59161

compilers.choose  cc fc
compilers.setup   -clang -gcc44 -gcc45 -gcc46 -gcc47 -gcc48 -g95
default_variants +${compilers.gcc_default}

depends_lib     port:zlib

depends_build port:gnutar

extract.only ${distname}${extract.suffix}

post-extract {
    system "tar -xzf ${distpath}/molecfit_third_party-${version}.tar -C ${workpath}"
    reinplace "s|tar |gnutar |" BuildThirdParty.mk 
}

use_configure       no
use_parallel_build  no

build {
    system "cd ${workpath}/molecfit_third_party-${version} && \
            ${build.cmd} -f BuildThirdParty.mk \
                CC=${configure.cc} FC=${configure.fc} \
                lnfl_target=customOsxGNUsgl lblrtm_target=customOsxGNUsgl \
                prefix=${prefix}"
}

destroot {
    system "cd ${workpath}/molecfit_third_party-${version} && \
            ${build.cmd} -f BuildThirdParty.mk \
                CC=${configure.cc} FC=${configure.fc} \
                lnfl_target=customOsxGNUsgl lblrtm_target=customOsxGNUsgl \
                DESTDIR=${destroot} prefix=${prefix} install"
}

