# -*- 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 94988 2012-07-03 12:23:06Z thibaut@macports.org $

PortSystem          1.0
PortGroup           github 1.0

github.setup        gyoto Gyoto 0.0.3
license             GPL-3+
categories          science yorick
platforms           darwin
maintainers         thibaut openmaintainer
description         General relativistic geodesic integration and ray-tracing
long_description    Gyoto aims at providing a framework for computing orbits \
                    and ray-traced images in General relativity. It consists \
                    in a C++ shared library (libgyoto), utility programs \
                    (gyoto, gyotoy), and a plug-in for the Yorick programming \
                    language. Gyoto can be extended with plug-ins.
homepage            http://gyoto.obspm.fr

checksums           rmd160  79418d7131c8d6af33c1f30bc86d9f07ce2f376a \
                    sha256  f6bbb6e148cdffd5e2482d37f13bfe8ed543918d20e0b803a935dce93760a46d

depends_lib         port:cfitsio \
                    port:xercesc3 \
                    path:bin/yorick:yorick

depends_run         port:yorick-yutils

# yorick is not universal
universal_variant   no

configure {
    reinplace "s|yorick|${prefix}/bin/yorick|" ${worksrcpath}/local_settings
    reinplace "s|/opt/local|${prefix}|" ${worksrcpath}/local_settings
    reinplace "s|/usr/local|${prefix}|" ${worksrcpath}/local_settings
    reinplace "s|-dynamiclib|-install_name ${prefix}/lib/libgyoto.dylib -dynamiclib|" ${worksrcpath}/local_settings
    reinplace "s|g++|${configure.cxx}|" ${worksrcpath}/local_settings
    reinplace "s|CPPFLAGS = .*|CPPFLAGS = ${configure.cppflags}|" ${worksrcpath}/local_settings
    reinplace "s|LDFLAGS  = .*|LDFLAGS  = ${configure.ldflags}|" ${worksrcpath}/local_settings
    reinplace "s|CXXFLAGS = .*|CXXFLAGS = ${configure.cxxflags}|" ${worksrcpath}/local_settings
    reinplace "s|  -Wcast-align -Wconversion -Winline \\\\||"  ${worksrcpath}/local_settings
    reinplace "s|  -Wabi -Woverloaded-virtual  -Wno-long-long -fPIC||" ${worksrcpath}/local_settings
}

# parallel builds fail
use_parallel_build  no

build.args-append    Y_CFLAGS="${configure.cxxflags}" Y_CPPFLAGS="${configure.cppflags}" CC="${configure.cc}" COPT_DEFAULT="" Y_LDFLAGS="${configure.ldflags}"
