# -*- 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 93009 2012-05-14 00:51:53Z ryandesign@macports.org $

PortSystem          1.0

name                molmol
version             2k.2.0
revision            3
categories          science
maintainers         bromo.med.uc.edu:howarth
description         Molecular graphics display program
long_description    MOLMOL is a molecular graphics program for displaying, analyzing, \
                    and manipulating the three-dimensional structure of biological \
                    macromolecules, with special emphasis on the study of protein \
                    or DNA structures determined by NMR. The program runs on UNIX \
                    and Windows NT/95/98/2000 and is freely available. It does not work \
                    properly with RNA.
homepage            http://www.mol.biol.ethz.ch/wuthrich/software/molmol/
platforms           darwin
master_sites        ftp://ftp.mol.biol.ethz.ch/software/MOLMOL/unix-gzip
distfiles           molmol-${version}-src.tar.gz \
                    molmol-${version}-doc.tar.gz
checksums           molmol-${version}-src.tar.gz md5 e1f4416d8041a67fa08cadb03ed91c7c \
                                             sha1 09482a1dea601563ca64e773dc0ec47019e22c63 \
                                             rmd160 b1de89953631dd9b11928751d7853cb511bf45f0 \
                    molmol-${version}-doc.tar.gz md5 517545b60b0179ab691a679ed29903a7 \
                                             sha1 b47551283fa19f57f4d5edcbd52f725055d80b7f \
                                             rmd160 08b3e21ab6eb7c9044e59373334181ff91ca8a53
depends_lib         port:openmotif \
                    port:mesa \
                    port:glw \
                    port:tiff \
                    port:jpeg \
                    port:libpng \
                    port:xpm
patchfiles          molmol-build.diff molmol-warnings.diff molmol-png.diff
use_configure       no
use_parallel_build  no
build.target-delete all
extract.mkdir       yes
post-patch {
    reinplace  "s|@PREFIX@|${prefix}|g" ${worksrcpath}/makedef \
                                        ${worksrcpath}/molmol
}
destroot {
    # prune installed files
    foreach d {main motif win} {
        system -W ${worksrcpath} "rm -f src/${d}/*.h src/${d}/*.c src/${d}/*.o"
    }
    # Install example files not installed by the Makefile
    file mkdir ${destroot}${prefix}/share/${name}/src
    foreach d {auxil COPYING data help HISTORY macros man molmol README README.UNIX setup tips} {
        copy ${worksrcpath}/${d} ${destroot}${prefix}/share/${name}
    }
    foreach d {main motif win} {
        copy ${worksrcpath}/src/${d} ${destroot}${prefix}/share/${name}/src
    }
    ln -s ${prefix}/share/${name}/${name} ${destroot}${prefix}/bin/${name}
    file mkdir ${destroot}${prefix}/share/doc/${name}
    ln -s ${prefix}/share/${name}/COPYING ${destroot}${prefix}/share/doc/${name}/COPYING
    ln -s ${prefix}/share/${name}/man ${destroot}${prefix}/share/doc/${name}/man
}
