# -*- 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
# $Id: Portfile 88360 2011-12-29 15:34:06Z ryandesign@macports.org $

PortSystem      1.0

name            ng-spice
version         23
license         BSD
categories      science cad
maintainers     nomaintainer
platforms       darwin
description     Circuit simulator based on Spice 3f5
long_description \
                Ngspice is a mixed-level/mixed-signal circuit simulator. Its \
                code is based on three open source software packages: Spice3f5, \
                Cider1b1 and Xspice. Ngspice is part of gEDA project, a full \
                GPL'd suite of Electronic Design Automation tools. \
                Note: this port does not compile the Cider and Xspice modules.

homepage        http://ngspice.sourceforge.net/
master_sites    sourceforge:project/ngspice/ng-spice-rework/${version}

distname        ngspice-${version}

checksums       [suffix ${distname}] \
                md5     bc7faa7348e307145b3bb04ef70a87d2 \
                sha1    65fa23d1168cb3af7651b990344f763c77bf6132 \
                rmd160  34a5bb0a06e67a9ebe21f7abe8067cd8e793ea9e \
                ngspice${version}-manual.pdf.gz \
                md5     7c1766f61034725268fd1ba6817358d1 \
                sha1    ea92e50eb84f973bf0b364e75d74416cf69291ce \
                rmd160  286bfa0dc5b38d0d931cd686d9979c0734a17ea7

worksrcdir      ngspice-${version}

depends_lib     port:xorg-libXaw

extract.only    [suffix ${distname}]  
configure.args  --x-includes=${prefix}/include \
                --x-libraries=${prefix}/lib \
                --with-editline=yes \
                --enable-x

post-destroot {
    file rename ${destroot}${prefix}/share/ngspice ${destroot}${prefix}/share/${name}
}

variant manual description {Includes manual in PDF format} {
    distfiles-append ngspice${version}-manual.pdf.gz
    post-destroot {
        xinstall -d ${destroot}${prefix}/share/doc/${name}
        xinstall -m 644 ${distpath}/ngspice${version}-manual.pdf.gz ${destroot}${prefix}/share/doc/${name}
        system -W ${destroot}${prefix}/share/doc/${name} "gunzip ngspice${version}-manual.pdf.gz"
    }
}

livecheck.type  regex
livecheck.url   http://sourceforge.net/projects/ngspice/files/
livecheck.regex "${name}-rework-(\\d+)${extract.suffix}"
