# -*- 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

PortSystem          1.0
PortGroup           boost 1.0
PortGroup           cmake 1.1
PortGroup           github 1.0
PortGroup           wxWidgets 1.0

boost.depends_type  build
wxWidgets.use       wxWidgets-3.0

github.setup        wojdyr xylib 1.6 v
revision            0
categories          math
maintainers         {ryandesign @ryandesign} openmaintainer
license             LGPL-2.1

description         library for reading x-y data files

long_description    xylib is a portable library for reading files that contain \
                    x-y data from powder diffraction, spectroscopy and other \
                    experimental methods.

homepage            https://xylib.sourceforge.net

checksums           rmd160  67e7607791cccfea01e7e21e10eb0bc7391802b6 \
                    sha256  37774980be4693f178c6638478b7e050dc5c5730c547517a4b83b7e027bff39c \
                    size    606455
github.tarball_from archive

depends_lib-append  port:bzip2 \
                    port:${wxWidgets.port} \
                    port:zlib

configure.env-append \
                    WX_CONFIG=${wxWidgets.wxconfig}
configure.args-append \
                    -DBUILD_SHARED_LIBS=ON \
                    -DGUI=OFF \
                    -DUSE_BZIP2=ON \
                    -DUSE_ZLIB=ON \
                    -DwxWidgets_CONFIG_EXECUTABLE=${wxWidgets.wxconfig}

variant gui description "Build GUI" {
    configure.args-replace \
                    -DGUI=OFF -DGUI=ON
}

if {(${os.platform} eq "darwin" && ${os.major} > 9) || ${os.platform} ne "darwin"} {
    default_variants-append +gui
}

post-destroot {
    set docdir ${prefix}/share/doc/${subport}
    xinstall -d ${destroot}${docdir}
    xinstall -m 644 -W ${worksrcpath} \
        COPYING \
        README.rst \
        TODO \
        ${destroot}${docdir}
}
