# $Id: Portfile 89292 2012-01-23 18:03:18Z and.damore@macports.org $

PortSystem          1.0

name                alliance
version             5.0-20110203
license             GPL
set version_number  [lindex [split ${version} -] 0]
categories          science
maintainers         and.damore openmaintainer
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            http://www-soc.lip6.fr/en/recherche/cian/alliance/

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

checksums           sha1    a1a9f84b5120ea262c989fcf42a6131ee54d5ec7 \
                    rmd160  be9554ae1c84c1f6d4cd49bf19e2fe997d9ec27b

depends_lib         port:xpm \
                    port:openmotif \
                    port:libpng

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'
destroot.env-append     YACC='/usr/bin/yacc'

# compiler_issue
if {${configure.compiler} == "clang"} {
    # adding -Wno-return-type to clang's CFLAGS to prevent error on missing return statements
    # cf. http://trac.macports.org/ticket/32947
    configure.cflags-append -Wno-return-type

}
if {${configure.compiler} == "clang" ||
    ${configure.compiler} == "llvm-gcc-4.2"} {
    # 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
