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

name                pcb
epoch               1
version             4.2.0
revision            6

categories          x11 graphics electronics
maintainers         {gmail.com:parker.charles @technobauble}
license             GPL-2+

description         Printed Circuit Board Layout Tool
long_description    PCB is an interactive printed circuit board editor for the \
                    X11 window system. PCB includes a rats nest feature, design \
                    rule checking, and can provide industry standard RS-274-X \
                    (Gerber), NC drill, and centroid data (X-Y data) output for \
                    use in the board fabrication and assembly process. PCB offers \
                    high end features such as an autorouter and trace optimizer \
                    which can tremendously reduce layout time.

homepage            http://pcb.geda-project.org/index.html
master_sites        sourceforge
platforms           darwin

checksums           rmd160  cf98c6ab59bc12cf209683ba1311c4b011af2392 \
                    sha256  cd4b36df6747789775812fb433f246d6bd5a27f3a16357d78d9c4c9b59c59a43 \
                    size    5080228

patchfiles          pcb-4.2.0-intltoolbug.patch

depends_build       port:intltool \
                    port:pkgconfig
depends_lib         port:flex \
                    port:gd2 \
                    path:lib/pkgconfig/gtk+-2.0.pc:gtk2 \
                    port:gtkglext \
                    port:libGLU \
                    port:m4 \
                    port:mesa \
                    port:tk

# xinerama and xrender are only used if lesstif is the GUI (instead of GTK)
configure.args      --mandir=${prefix}/share/man \
                    --infodir=${prefix}/share/info \
                    --disable-update-desktop-database \
                    --disable-dbus \
                    --disable-update-mime-database \
                    --disable-doc \
                    --disable-xinerama \
                    --disable-xrender

post-extract {
    file copy ${worksrcpath}/gts/gts.h ${worksrcpath}/gts/pcbgts.h
}

post-patch {
    #rename pcb's builtin gts library so it won't conflict with port gts
    reinplace "s|gts.h|pcbgts.h|"  ${worksrcpath}/gts/Makefile.in \
                                   ${worksrcpath}/src/toporouter.h
    reinplace "s|gts.a|pcbgts.a|g" ${worksrcpath}/gts/Makefile.in \
                                   ${worksrcpath}/src/Makefile.in
}

build.env           LC_CTYPE=en_US.ISO8859-1

variant dbus description {Enable dbus support} {
    depends_lib-append      port:dbus
    configure.args-replace  --disable-dbus --enable-dbus
}

variant docs description {build documentation} {
    depends_build-append    port:ghostscript \
                            port:texinfo \
                            port:texlive-latex
    configure.args-delete   --disable-doc
}
default_variants +docs

variant quartz {
    depends_lib-delete      port:libGLU \
                            port:mesa
    configure.args-append   --with-x=no
}
if {[variant_isset quartz]} {
    require_active_variants path:lib/pkgconfig/gtk+-2.0.pc:gtk2     quartz
    require_active_variants port:gtkglext quartz
} else {
    require_active_variants path:lib/pkgconfig/gtk+-2.0.pc:gtk2     x11
    require_active_variants port:gtkglext "" quartz
}

livecheck.regex /${name}-(\\d+(?:\\.\\d+)+)
