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

github.setup        newville ifeffit 1.2.13
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
revision            8
categories          science
license             Permissive
maintainers         {nist.gov:joe.fowler @joefowler} openmaintainer

description         IFEFFIT is a program and programming library for analyzing x-ray absorption fine-structure (XAFS) data.

long_description    {*}${description} \
    IFEFFIT1 gives an interactive method for fitting XAFS data using calculations from \
    FEFF. It is based on the fitting program FEFFIT of the UWXAFS3.0 Analysis Package. \
    It is NOT actively maintained since 2014. Consider port py-xraylarch as a replacement.

homepage            http://cars.uchicago.edu/ifeffit

checksums           rmd160  7b09aa5722a4aa638364c35e15d64b857cdb822b \
                    sha256  79fa938643a1417c5b01be4b6196bd0ea6bf40685448ba98546c7989b0f48a48 \
                    size    4238666

depends_lib         port:pgplot \
                    port:libpng \
                    port:ncurses \
                    port:xorg-libX11

# Patches needed to compile under recent Xcode. See https://trac.macports.org/ticket/61570
patchfiles          implicit.patch

# the ifeffit script to determine pgplot's linking options is broken
# so we have to supply them explicitly

configure.args      --with-pgplot \
                    --with-pgplot-link="-L${prefix}/lib -lpgplot -lpng -lX11"

compilers.choose    f77
compilers.setup     require_fortran
compilers.enforce_fortran pgplot

# IMPORTANT BUILD NOTES
#
# p5-ifeffit is configured using a Makefile.PL that is generated when ifeffit is built.
# since the paths to the compiler libraries contain compiler version information,
# if the compiler version changes then both ifeffit and p5-ifeffit need to be rebuilt
# so that the Makefile.PL in use contains the correct paths.
#
# if in doubt rebuild everything

pre-configure {
    configure.args-append --with-fortran=${configure.f77}
}

# this is the final release of ifeffit
livecheck.type none
