# -*- 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
PortGroup           conflicts_build 1.0

name                magic
version             8.3.425
revision            0
checksums           rmd160  84fcd9646f2a5fc085209318e848b25429e8f74a \
                    sha256  a5c1f4a4425c50df42ade0d00594610bed8ae419f7bb19de68c479c06657aa29 \
                    size    4215767

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 @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.

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

extract.suffix      .tgz

depends_lib         port:blt \
                    path:lib/pkgconfig/cairo.pc:cairo \
                    port:libGLU \
                    port:mesa \
                    port:tcl \
                    port:tk \
                    port:xorg-libice \
                    port:xorg-libXi \
                    port:xorg-libXmu \
                    port:zlib

require_active_variants tk x11

universal_variant   no

conflicts_build     gnome-keyring

configure.dir       ${worksrcpath}/scripts

if {${os.platform} eq "darwin" && ${os.major} < 19} {
    depends_build-append \
                    port:python311
    configure.args-append \
                    ac_cv_path_PYTHON3=${prefix}/bin/python3.11
} else {
    configure.args-append \
                    ac_cv_path_PYTHON3=/usr/bin/python3
}

use_parallel_build  no

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

# Avoid this build system's nonstandard behavior of hiding the real
# build output in a make.log file, hiding the install output in an
# install.log file, and returning a successful exit code even when
# the build fails.
build.target        tcllibrary
destroot.target     install-tcl-real

# TODO: Build fails in trace mode due to MacPorts base bug?
# https://trac.macports.org/ticket/63359

livecheck.type      regex
livecheck.url       ${homepage}download.html
livecheck.regex     ${name}-(\[0-9.\]+)[quotemeta ${extract.suffix}]
