Index: Portfile
===================================================================
--- Portfile	(revision 142600)
+++ Portfile	(working copy)
@@ -1,10 +1,20 @@
+# -*- 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
 
 name                alliance
-version             5.0-20110203
-revision            2
-license             GPL
-set version_number  [lindex [split ${version} -] 0]
+
+#fetch.type git
+
+if {${fetch.type} ne "git"} {
+    version             5.1.1
+} else {
+    git.url             https://www-soc.lip6.fr/git/alliance.git
+    git.branch          57b0f4774e2347f768eb1aacbb173b683f75c144
+    version             5.0-20171128
+}
+
+license             GPL-2+
 categories          science
 maintainers         nomaintainer
 description         Alliance, CAD and libraries for VLSI design
@@ -13,45 +23,98 @@
                     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/
 
+homepage            https://www-soc.lip6.fr/equipe-cian/logiciels/alliance/
 master_sites        ftp://asim.lip6.fr/pub/alliance/distribution/latest
+use_bzip2           yes
 
-checksums           sha1    a1a9f84b5120ea262c989fcf42a6131ee54d5ec7 \
-                    rmd160  be9554ae1c84c1f6d4cd49bf19e2fe997d9ec27b
+checksums           rmd160  ad765aa6ce035f47d2a9745389dd58638d23ea87 \
+                    sha256  811f201881af46d9d36f1c60b184c136fd2b8bebbe932a29e07ced40394ecc10 \
+                    size    4486561
 
+depends_build       port:fig2dev \
+                    port:ImageMagick \
+                    port:texlive-fonts-recommended \
+                    port:texlive-latex \
+                    port:texlive-latex-extra \
+                    port:texlive-latex-recommended \
+                    port:texlive-pictures \
+                    port:texlive-plain-generic
+
 depends_lib         port:xpm \
                     port:openmotif
 
-worksrcdir          ${name}-${version_number}
+if {${fetch.type} ne "git"} {
+    worksrcdir              ${name}/src
+} else {
+    patch.dir               ${worksrcpath}/alliance/src
+}
 
-patchfiles          patch-distrib-etc-Makefile.in.diff
+patchfiles-append       patch-autostuff.diff
+#patchfiles-append       patch-distrib-etc-Makefile.in.diff
+if {${fetch.type} ne "git"} {
+    patchfiles-append       patch-documentation.diff
+}
 
+# The distribution file doesn't contain a configure script.
+# Homepage says:
+# > Before running the autotools, you have to run the autostuff script
+# > in ./alliance/src which generate the top-level automake files.
+# See also:
+# https://www-soc.lip6.fr/wws/arc/alliance-users/2014-03/msg00007.html
+use_autoreconf          yes
+autoreconf.dir          ${patch.dir}
+autoreconf.cmd          ./autostuff
+depends_build-append    port:autoconf \
+                        port:automake \
+                        port:libtool
+
+# README says:
+# > We recommand not to build the tool in the source directory.
+configure.dir           ${workpath}/build
+configure.cmd           ${patch.dir}/configure
+build.dir               ${configure.dir}
+post-extract {
+    file mkdir ${configure.dir}
+}
+
+# README says:
+# > Also, the install stage has to be done at the same time
+# > as the make itself : the way the configure and Makefiles
+# > are written implies that you do a "make install" in one
+# > step rather than a "make" followed by a "make install"
+build {}
+
+# Homepage says:
+# > Do not build in parallel, always uses -j1, the build
+# > process fail in strange ways when run in parallel (this
+# > is a known problem due to the way Alliance was developped).
 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'
+configure.args-append   --enable-alc-shared
+configure.env-append    ALLIANCE_TOP=${prefix} \
+                        YACC=/usr/bin/yacc
 
+destroot.env-append     LC_ALL=C \
+                        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 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
-    }
+    # cf. https://bugs.llvm.org/show_bug.cgi?id=7445
+    # cf. https://trac.macports.org/ticket/32947#comment:3
+#    patchfiles-append   patch-nero-src-Makefile.am.diff
 }
 
 post-destroot {
+return -code error
     file mkdir  ${destroot}${prefix}/share/alliance
     file rename ${destroot}${prefix}/doc        ${destroot}${prefix}/share/alliance
     file rename ${destroot}${prefix}/examples   ${destroot}${prefix}/share/alliance
