# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4
PortSystem          1.0

name                alliance
version             5.0-20110203
revision            2
license             GPL
set version_number  [lindex [split ${version} -] 0]
categories          science
maintainers         nomaintainer
description         Alliance, CAD and libraries for VLSI design
long_description    Alliance is a complete set of free CAD tools and portable libraries for \
                    VLSI design. It includes a VHDL compiler and simulator, logic synthesis \
                    tools, and automatic place and route tools. A complete set of portable \
                    CMOS libraries is provided
platforms           darwin
homepage            https://www-soc.lip6.fr/equipe-cian/logiciels/alliance/

master_sites        ftp://asim.lip6.fr/pub/alliance/distribution/latest

checksums           sha1    a1a9f84b5120ea262c989fcf42a6131ee54d5ec7 \
                    rmd160  be9554ae1c84c1f6d4cd49bf19e2fe997d9ec27b

depends_lib         port:xpm \
                    port:openmotif

worksrcdir          ${name}-${version_number}

patchfiles          patch-distrib-etc-Makefile.in.diff

use_parallel_build  no

configure.args-append   --mandir=${prefix}/share/man
configure.env-append    YACC=/usr/bin/yacc
build.env               LC_ALL=C
destroot.env-append     YACC=/usr/bin/yacc

# compiler_issue
if {[string match *clang* ${configure.compiler}]} {
    # Missing return statements should really be fixed.
    # If you care about this port, fix the real issue...
    configure.cflags-append -Wno-return-type
}

if {[string match *clang* ${configure.compiler}] ||
    [string match *llvm-gcc-4.2* ${configure.compiler}]} {
    # removing -O2 in nero/src in order to correctly export symbols in MDRGrid.o
    # cf. http://llvm.org/bugs/show_bug.cgi?id=7445
    # cf. http://trac.macports.org/ticket/32947#comment:3
    post-configure {
        reinplace "/^CXXFLAGS/s/ -O2//" ${worksrcpath}/nero/src/Makefile
    }
}

post-destroot {
    file mkdir  ${destroot}${prefix}/share/alliance
    file rename ${destroot}${prefix}/doc        ${destroot}${prefix}/share/alliance
    file rename ${destroot}${prefix}/examples   ${destroot}${prefix}/share/alliance
    file rename ${destroot}${prefix}/tutorials  ${destroot}${prefix}/share/alliance
    file rename ${destroot}${prefix}/cells      ${destroot}${prefix}/share/alliance
}

platform darwin {
    patchfiles-append patch-xgra-src-XSB_parse.c.diff
}

livecheck.type      regex
livecheck.url       [lindex ${master_sites} 0]
livecheck.regex     ${name}-(\[0-9.-\]+)\\.tar
