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

name                pcb
epoch               1
version             4.1.0

categories          x11 graphics
maintainers         @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  eafb7a65d0e2dab5985953d2a2cd493ecd3937a7 \
                    sha256  03dbee38e05f35fd289fb7d099f30e3ff139be76847d9359d78ed9ce1236e3b5 \
                    size    4863893

depends_build       port:intltool \
                    port:pkgconfig
depends_run         bin:wish:tk
depends_lib         port:gd2 \
                    port:gtk2 \
                    port:gtkglext \
                    port:libGLU \
                    port:mesa

configure.args      --mandir=${prefix}/share/man \
                    --infodir=${prefix}/share/info \
                    --disable-update-desktop-database \
                    --disable-dbus \
                    --disable-update-mime-database

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
}

post-configure {
    #hackish, couldn't disable OS X SDKs' OpenGL in configure script
    reinplace "s|#define HAVE_OPENGL_GL_H 1||"  ${worksrcpath}/config.h
    reinplace "s|#define HAVE_OPENGL_GLU_H 1||" ${worksrcpath}/config.h
}

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
}