# -*- 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 91988 2012-04-15 05:30:35Z ryandesign@macports.org $

PortSystem          1.0

name                rNMR
version             1.1.7
categories          science
platforms           darwin
maintainers         bromo.med.uc.edu:howarth
supported_archs     noarch
license             GPL-3

description         Open Source Software for NMR Data Analysis

long_description    rNMR is an open source software package for visualizing \
                    and interpreting one and two dimensional NMR data. In \
                    contrast to most existing 2D NMR software, rNMR is \
                    specifically designed for high-throughput assignment and \
                    quantification of small molecules. As a result, rNMR \
                    supports extensive batch manipulation of plotting \
                    parameters and has numerous tools for expediting \
                    repetitive resonance assignment and quantification tasks.

homepage            http://rnmr.nmrfam.wisc.edu/
master_sites        ${homepage}pages/download/files/Binaries/Mac%20and%20Linux/current/ \
                    ${homepage}pages/download/files/Binaries/Mac%20and%20Linux/${version}/

distname            ${name}_${version}

checksums           rmd160  daaa56141cb1fdd5febd33601147f6ef401ed837 \
                    sha256  fb9082bb098af1678c5e9b566e6f3411ee46256d47488f5dd2f1f367b3513c1f

depends_lib         port:R

use_configure       no

build {
    file mkdir ${worksrcpath}/pkg
    system -W ${worksrcpath} "${prefix}/bin/R CMD INSTALL -l pkg --byte-compile --build ${distpath}/[lindex ${distfiles} 0]"
}

destroot {
    xinstall -d ${destroot}${prefix}/lib/R/library/${name}/macosx/
    system "tar -C ${destroot}${prefix}/lib/R/library -zxf ${worksrcpath}/${distname}.tgz"
    xinstall -W ${destroot}${prefix}/lib/R/library/${name}/linux \
        loadrNMR.R rNMR.gif xdg-open \
        ${destroot}${prefix}/lib/R/library/${name}/macosx/
    reinplace "s|~/rNMR/linux/|./|g" ${destroot}${prefix}/lib/R/library/${name}/macosx/loadrNMR.R
    xinstall -m 755 ${filespath}/${name}.sh ${destroot}${prefix}/lib/R/library/${name}/macosx
    reinplace "s|@PREFIX@|${prefix}|g" ${destroot}${prefix}/lib/R/library/${name}/macosx/rNMR.sh
    ln -s ${prefix}/lib/R/library/${name}/macosx/${name}.sh ${destroot}${prefix}/bin/${name}
}

livecheck.type      regex
livecheck.url       [lindex ${master_sites} 0]
livecheck.regex     ${name}_(\[0-9.\]+)${extract.suffix}
