# -*- 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           app 1.0
PortGroup           legacysupport 1.0

# uses getline
legacysupport.newest_darwin_requires_legacy 10

name                geda-gaf
epoch               1
version             1.10.2
revision            2
set branch          [join [lrange [split ${version} .] 0 1] .]
platforms           darwin
categories          science electronics
maintainers         {mark @markemer} openmaintainer
license             GPL-2+

description         gEDA/gaf - gschem and friends
long_description    The gEDA project has produced and continues working on a \
                    full GPL'd suite and toolkit of Electronic Design Automation \
                    tools. These tools are used for electrical circuit design, \
                    schematic capture, simulation, prototyping, and production. \
                    This package is the smallest subset of the gEDA Suite that is \
                    directly maintained by gEDA Project founders.

homepage            http://www.geda-project.org/
master_sites        http://ftp.geda-project.org/geda-gaf/stable/v${branch}/${version}

checksums           rmd160  68507c0978cf4736e38eea5806393dc830a0f45a \
                    sha256  e862ab241528538fa3bee2739261f568011102b60c5e39a2f0358663c042c8a4 \
                    size    14441491

compiler.c_standard 1999

depends_build \
    port:pkgconfig \
    bin:groff:groff

depends_lib \
    path:lib/pkgconfig/gtk+-2.0.pc:gtk2 \
    port:guile-2.2 \
    port:libffi \
    port:python27

patchfiles-append \
    fix-st_mtim.patch \
    fix-strchrnul.patch \
    dynamic_lookup-11.patch

post-patch {
    reinplace {s|python2 >= 2\.7|python-2.7 >= 2.7|g} ${worksrcpath}/xorn/configure
    reinplace {s|guile-2\.0 >= 2\.0\.10|guile-2.2 >= 2.0.10|g} ${worksrcpath}/xorn/configure
}

configure.args-append \
    --disable-update-xdg-database \
    --without-libfam

configure.env-append GUILE=${prefix}/bin/guile-2.2
configure.env-append GUILE_SNARF=${prefix}/bin/guile-snarf-2.2

destroot.destdir    DESTDIR=${destroot}/

variant enable_xdg description {enable XDG database update} {
    depends_lib-append      port:desktop-file-utils
    configure.args-delete   --disable-update-xdg-database

    post-destroot {
        file delete ${destroot}${prefix}/share/applications/mimeinfo.cache
        file delete ${destroot}${prefix}/share/mime/XMLnamespaces
    }
    post-activate {
        system ${prefix}/bin/update-desktop-database
    }
}

app.create yes
app.name gEDA-gaf
app.executable gschem
app.icon libgeda/docs/logo.png
app.retina yes

livecheck.type      regex
livecheck.url       http://wiki.geda-project.org/geda:download
livecheck.regex     ${name}-(\[0-9\]+\\.\[0-9\]*\[02468\](\\.\[0-9\]+)*)${extract.suffix}
