# -*- 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 110547 2013-09-01 23:17:27Z macsforever2000@macports.org $


PortSystem          1.0
PortGroup           active_variants 1.1

name                gnome-chemistry-utils
version             0.14.2
revision            1
set major           [join [lrange [split ${version} .] 0 1] .]

categories          gnome science chemistry
platforms           darwin linux freebsd
maintainers         me.com:c.herbig openmaintainer
license             GPL-3

description         This package provides a set of Gtk3-based applications for drawing \
                    and viewing molecules, crystals and spectra.
                    
long_description    This package provides the following programs: \
                    \n-  GChem3D displays molecule structures in 3D \
                    \n-  GChemCalc provides calculations for chemistry \
                    \n-  GChemPaint draws 2D chemical structures and reactions \
                    \n-  GChemTable provides the periodic table of the elements \
                    \n-  GCrystal displays and edits 3D crystal structures \
                    \n-  GSpectrum displays spectra files (NMR, IR, etc) \
                    \n-  Includes plugins for Gnumeric spreadsheet

homepage            http://gchemutils.nongnu.org/index.html
master_sites        http://download.savannah.gnu.org/releases/gchemutils/${major}/
use_xz              yes

checksums           sha256  85462b95b9d72e95b34ebaa0d07dc101595adf2159e480e3483ab8f440028dfe \
                    rmd160  981652a5650ff7b1bed7718085274c8a492fda9b

depends_build       port:autoconf \
                    port:intltool \
                    port:pkgconfig
                    
depends_lib         port:goffice \
                    port:gnome-doc-utils \
                    port:openbabel \
                    port:bodr \
                    port:chemical-mime-data \
                    port:gnome-mime-data \
                    port:mesa


configure.args      --disable-scrollkeeper \
                    --disable-update-databases \
                    --enable-introspection


# compiling with clang leads to gchempaint's close button being broken, #39863
compiler.blacklist  *clang*


# TODO: work with the upstream devs to make a +quartz variant…
#       currently it fails to build in a +quartz environment
#       due to <gdk/gdkx.h> and OpenGL dependencies in the code.
require_active_variants gtk3 x11

post-activate {
    catch {system "${prefix}/bin/update-mime-database ${prefix}/share/mime"}
    catch {system "${prefix}/bin/update-desktop-database ${prefix}/share/applications"}
    catch {system "${prefix}/bin/scrollkeeper-update"}
    catch {system "${prefix}/bin/gtk-update-icon-cache -f -t ${prefix}/share/icons/hicolor"}
    catch {system "${prefix}/bin/glib-compile-schemas ${prefix}/share/glib-2.0/schemas"}
}

post-deactivate {
    catch {system "${prefix}/bin/update-mime-database ${prefix}/share/mime"}
    catch {system "${prefix}/bin/update-desktop-database ${prefix}/share/applications"}
    catch {system "${prefix}/bin/scrollkeeper-update"}
    catch {system "${prefix}/bin/gtk-update-icon-cache -f -t ${prefix}/share/icons/hicolor"}
    catch {system "${prefix}/bin/glib-compile-schemas ${prefix}/share/glib-2.0/schemas"}
}

notes \
"Recommended supplementary ports:
    gnome-themes-standard  provides the default Gnome Adwaita theme
    yelp                   provides a help browser for Gnome apps

--- NOTICE ---
gchemcalc is known to be broken on OS X
gchemtable is known to crash on launch on OS X"
