# -*- 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                xcircuit
version             3.10.30
revision            3
set branch          [join [lrange [split ${version} .] 0 1] .]
categories          x11 cad
maintainers         {khindenburg @kurthindenburg} openmaintainer
# asg subdir licensed for noncommercial use only, linked to GPL code, conflicts.
license             GPL-2+ Noncommercial Restrictive

description         circuit-drawing program

long_description    XCircuit is a program for drawing publishable-quality \
                    electrical circuit schematic diagrams and related figures, \
                    and produce circuit netlists through schematic capture. \
                    XCircuit regards circuits as inherently hierarchical, and \
                    writes both hierarchical PostScript output and \
                    hierarchical SPICE netlists. Circuit components are saved \
                    in and retrieved from libraries which are fully editable. \
                    XCircuit does not separate artistic expression from \
                    circuit drawing\; it maintains flexiblity in style without \
                    compromising the power of schematic capture.

homepage            http://opencircuitdesign.com/xcircuit/
master_sites        ${homepage}archive/
extract.suffix      .tgz

checksums           rmd160  85ceb248824ccb85b39dec4a1e8215273e3c57fe \
                    sha256  b2f63cba605e79cc2a08714bf3888f7be7174384ed724db3c70f8bf25c36f554 \
                    size    1619256

depends_build       port:autoconf \
                    port:automake \
                    path:bin/pkg-config:pkgconfig

depends_lib         path:lib/pkgconfig/cairo.pc:cairo \
                    port:ghostscript \
                    port:tk-x11 \
                    port:xpm

# Currently, xcircuit crashes upon start if tk is built without x11

require_active_variants cairo x11

use_autoreconf      yes
autoreconf.args     -fvi

# functions.c:1989:4: error: implicit declaration of function 'UDrawXAt' is invalid in C99
patchfiles-append   patch-xcircuit-implicit-udrawxat.diff

configure.cflags-append -Wno-return-type

configure.args      --with-tcl=${prefix}/lib \
                    --with-tk=${prefix}/lib/tk-x11 \
                    --with-gs=${prefix}/bin/gs \
                    --x-includes=${prefix}/include \
                    --x-libraries=${prefix}/lib

post-destroot {
    xinstall -m 755 -d ${destroot}${prefix}/share/${name}
    file copy ${worksrcpath}/examples \
        ${destroot}${prefix}/share/${name}/examples
}

livecheck.type      regex
livecheck.url       [lindex ${master_sites} 0]
livecheck.regex     xcircuit-(${branch}\\.\[0-9.\]+)${extract.suffix}
