# -*- 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 113668 2013-11-22 19:48:18Z mojca@macports.org $

PortSystem          1.0
PortGroup           app       1.0
PortGroup           github    1.0
PortGroup           wxWidgets 1.0

# The released version has the extra complication that it needs to fetch cmpfit-1.2.tar.gz
# and a few other minor issues in 10.9 which have been fixed recently.
#
# As soon as the next version gets released, we should stick back to the official release.
# Maybe also a special addition to version string is needed to make the version info more exact
# github.setup      wojdyr fityk 1.2.1 v
github.setup        wojdyr fityk a707fe12b7
name                fityk
version             1.2.1
revision            3
categories          math
platforms           darwin
license             GPL-2
maintainers         nomaintainer

description         fityk is for peak fitting.

long_description    fityk is a program for nonlinear fitting of analytical \
                    functions (especially peak-shaped) to data (usually \
                    experimental data). There are also people using it to \
                    remove the baseline from data, or to display data only.

homepage            http://fityk.nieto.pl/

checksums           rmd160  037b2289c617a3159f99a5845ca82419c377d8e7 \
                    sha256  90284fa836886f28dc083256e634649a1c955d30819d1d96f71e1b94c0d9cb5e

app.name            fityk
app.executable      fityk
app.icon            ${worksrcpath}/fityk.png

wxWidgets.use       wxWidgets-3.0

# WARNING: dvipng command 'dvipng' cannot be run (needed for math display), check the pngmath_dvipng setting
depends_build-append port:swig-lua

depends_lib         port:boost \
                    port:readline \
                    port:ncurses \
                    port:xylib \
                    port:lua \
                    port:zlib \
                    port:python27 \
                    port:${wxWidgets.port}

depends_run         port:gnuplot

use_autoreconf      yes

configure.args-append --with-wxdir=${wxWidgets.wxdir}

pre-build {
    if {[variant_isset docs]} {
        depends_build-append port:py27-sphinx
        # TODO: use a python PortGroup and variable
        reinplace "s|sphinx-build|${prefix}/Library/Frameworks/Python.framework/Versions/2.7/bin/sphinx-build|" ${worksrcpath}/doc/Makefile
        system -W ${worksrcpath}/doc make
    } else {
        file mkdir ${worksrcpath}/doc/html/placeholder
    }
}

variant docs description {Build and install documentation} {}
