# -*- 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 56695 2009-09-01 12:57:03Z takeshi@macports.org $

PortSystem 1.0

name            udunits
version         1.12.9
maintainers     takeshi
platforms       darwin
categories      science

description     Unidata unit conversion libraray
long_description \
                The Unidata units library supports \
                conversion of unit specifications between \
                formatted and binary forms, arithmetic manipulation \
                of unit specifications, and conversion of values \
                between compatible scales of measurement.

homepage        http://www.unidata.ucar.edu/software/udunits/

master_sites    ftp://ftp.unidata.ucar.edu/pub/udunits/ \
                ftp://www.gfd-dennou.org/arch-large1/ucar/unidata/pub/udunits
checksums       md5    2bf4ba7a92e4c45b9e6003a295ca4e65         \
                sha1   06923bb345055eb1bb63560b368f776ce5e15b0b \
                rmd160 36e904d0af0585fdd7e45ffe87643193097ea6c4
worksrcdir      ${distname}/src
depends_build   path:bin/perl:perl5
use_parallel_build no

patch {
        reinplace "s|\$(prefix)/man|\$(prefix)/share/man|" ${worksrcpath}/port/master.mk.in
}

configure.cppflags-append       "-DNDEBUG -Df2cFortran"
configure.cflags-append         -fno-common

pre-destroot {
        file delete ${worksrcpath}/lib/libudunits.a
}

destroot.destdir    DESTDIR=${destroot} \
                    prefix=${destroot}${prefix} \
                    exec_prefix=${destroot}${prefix}

# fortran compiler does not seem to be required
# gfortran might have problem with preprocessor
#variant gcc43 conflicts g95 description {compile with gcc43} {
#    depends_build-append    port:gcc43
#    configure.env-append    FC=${prefix}/bin/gfortran-mp-4.3
#    configure.env-append    FFLAGS="-O2 -fno-common"
#}
#
#variant g95 conflicts gcc43 description {compile with g95} {
#    depends_build-append    port:g95
#    configure.fc            ${prefix}/bin/g95
#    configure.env-append    FC=${prefix}/bin/g95
#    configure.env-append    FFLAGS="-O2 -fno-common"
#}
