# $Id: Portfile 84949 2011-10-05 16:39:56Z and.damore@macports.org $

PortSystem          1.0

name                pcb
version             20110918
categories          x11 graphics
maintainers         megacz.com:adam
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.sourceforge.net
master_sites        sourceforge
platforms           darwin
checksums           md5     54bbc997eeb22b85cf21fed54cb8e181 \
                    sha1    53ca27797d4db65a068b56f157e3ea6c5c29051f \
                    rmd160  1e176a03a7a61ac23b7abe532277415c87637c16

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

configure.args      --mandir=${prefix}/share/man \
                    --infodir=${prefix}/share/info \
                    --disable-update-desktop-database \
                    --enable-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
}

