# -*- 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 120240 2014-05-20 04:48:25Z ryandesign@macports.org $

PortSystem          1.0
PortGroup           active_variants 1.1
PortGroup           conflicts_build 1.0

# Please keep the magic and magic-devel ports as similar as possible.

name                magic-devel
conflicts           magic
version             8.0.166
set branch          [join [lrange [split ${version} .] 0 1] .]
categories          science
# mostly very permissively licensed, but includes a copy of GNU readline
license             GPL-2+
maintainers         ryandesign openmaintainer
description         A VLSI Layout System

long_description    Magic is a venerable VLSI layout tool, written in the \
                    1980's at Berkeley. Magic is widely cited as being the \
                    easiest tool to use for circuit layout, even for people \
                    who ultimately rely on commercial tools for their product \
                    design flow.

platforms           darwin

homepage            http://opencircuitdesign.com/magic/
master_sites        ${homepage}archive/

dist_subdir         magic
distname            magic-${version}
extract.suffix      .tgz

depends_lib         port:tcl port:tk port:blt port:mesa

require_active_variants tk x11

checksums           rmd160  2abaf5873bfc9712cf92ccca48a889b40f6b9d67 \
                    sha256  db9a11d21a562820a68c6bd9ae1a815a0ac0e5e171299811bd4c6e34b4f6eef2

patchfiles          patch-scripts-configure.in.diff

universal_variant   no

conflicts_build     gnome-keyring

use_autoreconf      yes
autoreconf.dir      ${worksrcpath}/scripts

use_parallel_build  no

build.env           X11_LDFLAGS=-L${prefix}/lib

post-build {
    # The build and install don't notice when essential files don't get built,
    # so we must exit for it when it fails. #32934
    foreach f {magic/tclmagic.dylib} {
        if {![file exists ${worksrcpath}/${f}]} {
            return -code error "${f} did not get built"
        }
    }
}

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