# -*- 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 83390 2011-08-31 07:13:22Z jmr@macports.org $

PortSystem          1.0
PortGroup           python27 1.0

name                pymol-devel
conflicts           pymol
svn.revision        3964
version             1.4.1.${svn.revision}
revision            1
categories          science
maintainers         adfernandes openmaintainer
description         Molecular graphics system
long_description    PyMOL is a molecular graphics system with an embedded Python interpreter \
                    designed for real-time visualization and rapid generation of high-quality \
                    molecular graphics images and animations.

platforms           darwin

homepage            http://www.pymol.org/

master_sites        sourceforge
fetch.type          svn
svn.url             https://pymol.svn.sourceforge.net/svnroot/pymol/trunk/pymol
worksrcdir          pymol

depends_lib         port:freetype port:libpng port:python27 port:py27-pmw port:py27-numpy port:py27-scipy port:mesa port:glew port:py27-tkinter
depends_run         port:xdpyinfo

patchfiles          setup_py.diff pymol_shell.diff

post-patch {
    reinplace  "s|@PREFIX@|${prefix}|g" ${worksrcpath}/setup.py
    reinplace  "s|@@PYTHON_PKGDIR@@|${python.pkgd}|g" ${worksrcpath}/setup/pymol_macports
    reinplace  "s|@@PYTHON_BINARY@@|${python.bin}|g" ${worksrcpath}/setup/pymol_macports
}

use_parallel_build yes

platform darwin 11 {
    python.add_archflags   no
    build.env CC="/usr/bin/clang" CXX="/usr/bin/clang++"
}

variant gcc43 description conflicts gcc44 gcc45 gcc46 description {build using macports-gcc-4.3} {
    depends_lib-append  port:gcc43
    python.add_archflags   no
    build.env CC="${prefix}/bin/gcc-mp-4.3" CXX="${prefix}/bin/g++-mp-4.3"
}

variant gcc44 description conflicts gcc43 gcc45 gcc46 description {build using macports-gcc-4.4} {
    depends_lib-append  port:gcc44
    python.add_archflags   no
    build.env CC="${prefix}/bin/gcc-mp-4.4" CXX="${prefix}/bin/g++-mp-4.4"
}

variant gcc45 description conflicts gcc43 gcc44 gcc46 description {build using macports-gcc-4.5} {
    depends_lib-append  port:gcc45
    python.add_archflags   no
    build.env CC="${prefix}/bin/gcc-mp-4.5" CXX="${prefix}/bin/g++-mp-4.5"
}

variant gcc46 description conflicts gcc43 gcc44 gcc45 description {build using macports-gcc-4.6} {
    depends_lib-append  port:gcc46
    python.add_archflags   no
    build.env CC="${prefix}/bin/gcc-mp-4.6" CXX="${prefix}/bin/g++-mp-4.6"
}

post-destroot {
     file copy ${worksrcpath}/setup/pymol_macports ${destroot}${prefix}/bin/pymol
     file attributes ${destroot}${prefix}/bin/pymol -permissions a+x
     ln -s ${python.pkgd}/pymol ${destroot}${python.pkgd}/pymol/pymol_path
     foreach d {data modules examples test scripts} {
        copy ${worksrcpath}/${d} ${destroot}${python.pkgd}/pymol
    }
}
