--- /opt/local/var/macports/sources/svn.macports.org/trunk/dports/devel/bison/Portfile	2015-01-12 12:43:17.000000000 +0100
+++ Portfile	2015-03-04 19:09:27.000000000 +0100
@@ -1,15 +1,9 @@
+# -*- 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 108830 2013-08-02 22:11:18Z jeremyhu@macports.org $
 
 PortSystem 1.0
 
 name                bison
-version             2.7.1
-epoch               1
-categories          devel
-maintainers         mww
-license             GPL-3+
-platforms           darwin
-installs_libs       no
 description         general-purpose parser generator
 long_description \
     Bison is a general-purpose parser generator that converts a grammar \
@@ -18,45 +12,60 @@
     it to develop a wide range of language parsers, from those used in  \
     simple desk calculators to complex programming languages.
 
+subport ${name}-2 {
+    version         2.7.1
+    revision        1
+    long_description    ${long_description} - This is the legacy 2.7.1 version
+}
+if {${subport} ne "${name}-2"} {
+    version         3.0.4
+}
+
+epoch               1
+categories          devel
+maintainers         mww
+license             GPL-3+
+platforms           darwin
+
 homepage            http://www.gnu.org/software/bison/
 master_sites        gnu
-checksums           rmd160  933257e61c1098160d4fd71063f340b2ee304671 \
-                    sha256  b409adcbf245baadb68d2f66accf6fdca5e282cafec1b865f4b5e963ba8ea7fb
 use_xz              yes
 
 depends_lib         port:gettext port:m4 port:libiconv
 
-installs_libs       no
-
-configure.args      --infodir=${prefix}/share/info \
-                    --mandir=${prefix}/share/man \
-                    --disable-yacc
-
-test.run            yes
-test.target         check
+configure.args      --disable-dependency-tracking \
+                    --infodir=${prefix}/share/info \
+                    --mandir=${prefix}/share/man
 
-post-destroot {
-    set docdir ${prefix}/share/doc/${name}
-    xinstall -d ${destroot}${docdir}/examples/calc++
-    xinstall -m 0444 -W ${worksrcpath} AUTHORS COPYING ChangeLog NEWS \
-        THANKS TODO ${destroot}${docdir}
-    xinstall -m 444 -W ${worksrcpath}/examples/calc++  \
-        calc++-driver.cc calc++-driver.hh calc++-parser.cc \
-        calc++-parser.hh calc++-parser.stamp calc++-parser.yy \
-        calc++-scanner.cc calc++-scanner.ll calc++.cc location.hh \
-        position.hh stack.hh test \
-        ${destroot}${docdir}/examples/calc++
-    # yacc manpage gets installed even with '--disable-yacc'
-    if {! [variant_isset yacc]} {
-        delete ${destroot}${prefix}/share/man/man1/yacc.1
+if {${subport} eq "${name}-2"} {
+    checksums       rmd160  933257e61c1098160d4fd71063f340b2ee304671 \
+                    sha256  b409adcbf245baadb68d2f66accf6fdca5e282cafec1b865f4b5e963ba8ea7fb
+    set DEST        ${prefix}/libexec/bison2
+    configure.args-delete   --prefix=${prefix}
+    configure.args-append   --prefix=${DEST}
+    post-destroot {
+        file rename ${destroot}${prefix}/share/info ${destroot}${DEST}/share/info
+        file rename ${destroot}${prefix}/share/man ${destroot}${DEST}/share/man
+        ln -s ${DEST}/bin/bison ${destroot}/${prefix}/bin/bison-2
+    }
+} else {
+    checksums       rmd160  414959f3d619d8e4875e241ee02852b2ff13c2cb \
+                    sha256  a72428c7917bdf9fa93cb8181c971b6e22834125848cf1d03ce10b1bb0716fe1
+    build.args      examples/calc++/calc++ \
+                    examples/mfcalc/mfcalc \
+                    examples/rpcalc/rpcalc
+
+    post-destroot {
+        set docdir ${prefix}/share/doc/${name}
+        xinstall -d ${destroot}${docdir}
+        xinstall -m 0444 -W ${worksrcpath} AUTHORS COPYING ChangeLog NEWS \
+            THANKS TODO ${destroot}${docdir}
     }
 }
 
-variant yacc description "enable yacc compatibility" {
-    configure.args-delete   --disable-yacc
-}
+test.run            yes
+test.target         check
 
 livecheck.type      regex
 livecheck.url       http://ftp.gnu.org/gnu/bison/?C=M&O=D
 livecheck.regex     ${name}-(\\d+(?:\\.\\d+)*)
-
