--- /opt/local/var/macports/sources/svn.macports.org/trunk/dports/multimedia/ffmpeg/Portfile	2016-02-23 11:51:32.000000000 +0100
+++ /opt/local/site-ports/multimedia/ffmpeg/Portfile	2016-02-23 19:31:03.000000000 +0100
@@ -11,6 +11,9 @@
 conflicts           ffmpeg-devel
 epoch               1
 version             2.8.6
+# the actual compat_version would be something like 24 but that looks weird and
+# the first ABI change after v2.4.0 came at v3.0.0 so we can just use "2"
+set compat_version  2
 revision            1
 license             LGPL-2.1+
 categories          multimedia
@@ -60,6 +63,16 @@
                     port:gmake \
                     port:texinfo
 
+# subport ffmpeg-${compat_version} {
+#     description-append \
+#                     This is a legacy port that with the latest version of the FFMpeg 2.4 - 2.8.6 ABI
+#     long_description-append \
+#                     This is a legacy port that with the latest version of the FFMpeg 2.4 - 2.8.6 ABI
+#     # the tricky bit is that this subport conflicts with port:ffmpeg as long as that one still contains
+#     # the same ABI (v 2.8.6) and is installed using the same "-24" suffices.
+#     # that's why this subport is commented for now.
+# }
+
 # libvpx is static only so can be considered a build dependency (#47934)
 
 depends_build-append \
@@ -107,7 +120,12 @@
 default_variants-append +gpl2
 
 configure.cflags-append -DHAVE_LRINTF ${configure.cppflags}
-configure.args      --enable-swscale \
+configure.args      --progs-suffix="-${compat_version}" --build-suffix="-${compat_version}" \
+                    --incdir=${prefix}/include/ffmpeg-${compat_version} \
+                    --datadir=${prefix}/share/ffmpeg-${compat_version} \
+                    --docdir=${prefix}/share/doc/ffmpeg-${compat_version} \
+                    --mandir=${prefix}/share/doc/ffmpeg-${compat_version}/man \
+                    --enable-swscale \
                     --enable-avfilter \
                     --enable-avresample \
                     --enable-libmp3lame \
@@ -134,7 +152,6 @@
                     --disable-outdev=xv \
                     --disable-vda \
                     --disable-videotoolbox \
-                    --mandir=${prefix}/share/man \
                     --enable-shared --enable-pthreads \
                     --cc=${configure.cc}
 
@@ -183,10 +200,52 @@
 #
 
 post-destroot {
-    file mkdir ${destroot}${prefix}/share/doc/ffmpeg
-    file copy ${worksrcpath}/doc/APIchanges ${destroot}${prefix}/share/doc/ffmpeg
+    xinstall -m 755 -d ${destroot}${prefix}/share/doc/ffmpeg-${compat_version}
+    file copy ${worksrcpath}/doc/APIchanges ${destroot}${prefix}/share/doc/ffmpeg-${compat_version}
     foreach f [glob ${worksrcpath}/doc/*.txt] {
-        file copy $f ${destroot}${prefix}/share/doc/ffmpeg
+        file copy $f ${destroot}${prefix}/share/doc/ffmpeg-${compat_version}
+    }
+    # install suffix-less symlinks to the suffixed shared libraries,
+    # unwanted symlinks will be cleaned up below
+    foreach f [glob -nocomplain ${destroot}${prefix}/lib/lib*-${compat_version}*.dylib] {
+        set dst [file tail ${f}]
+        set lf [strsed ${dst} "s/-${compat_version}//"]
+        ln -s ${dst} ${destroot}${prefix}/lib/${lf}
+    }
+    if {${subport} ne "${name}-${compat_version}"} {
+        # if we're not installing as a legacy port, install symlinks that hide the fact that we're using
+        # a suffix
+        foreach m [glob -nocomplain ${destroot}${prefix}/share/doc/ffmpeg-${compat_version}/man/*] {
+            set md [file tail ${m}]
+            foreach f [glob -nocomplain ${m}/*] {
+                set dst [file tail ${f}]
+                file delete -force ${destroot}${prefix}/share/man/${md}/${dst}
+                ln -s ../../doc/ffmpeg-${compat_version}/man/${md}/${dst} ${destroot}${prefix}/share/man/${md}/${dst}
+            }
+        }
+        foreach f [glob -nocomplain ${destroot}${prefix}/bin/*-${compat_version}] {
+            set dst [file tail ${f}]
+            set lf [strsed ${dst} "s/-${compat_version}//"]
+            ln -s ${dst} ${destroot}${prefix}/bin/${lf}
+        }
+        foreach f [glob -nocomplain ${destroot}${prefix}/lib/pkgconfig/*-${compat_version}.pc] {
+            set dst [file tail ${f}]
+            set lf [strsed ${dst} "s/-${compat_version}//"]
+            ln -s ${dst} ${destroot}${prefix}/lib/pkgconfig/${lf}
+        }
+        foreach f [glob -nocomplain ${destroot}${prefix}/lib/lib*-${compat_version}*.a] {
+            set dst [file tail ${f}]
+            set lf [strsed ${dst} "s/-${compat_version}//"]
+            ln -s ${dst} ${destroot}${prefix}/lib/${lf}
+        }
+    } else {
+        # legacy mode: remove symlinked shared libraries that shouldn't be there (= only leave the runtime libraries)
+        foreach f {libavcodec libavdevice libavfilter libavformat libavresample libavutil libpostproc libswresample libswscale} {
+            set lf ${destroot}${prefix}/lib/${f}
+            if {[file exists ${lf}]} {
+                file delete -force ${lf}
+            }
+        }
     }
 }
 
@@ -268,14 +327,16 @@
 # make libx265 support optional via +libx265 variant
 # only define variant for non-universal builds on 10.6 or greater
 
-platform darwin {
-    if {${os.major} > 8 && [variant_isset gpl2] && ![variant_isset universal]} {
-        variant libx265 description {Build with support for encoding HEVC video using libx265} {
-            configure.args-append   --enable-libx265
-            depends_lib-append      port:x265
-        }
+# there is either no need to check for darwin before considering supporting a libx265 variant
+# or else one should test for "!darwin OR os.major > 8".
+# platform darwin {
+if { (${os.platform} ne "darwin" || ${os.major} > 8) && [variant_isset gpl2] && ![variant_isset universal]} {
+    variant libx265 description {Build with support for encoding HEVC video using libx265} {
+        configure.args-append   --enable-libx265
+        depends_lib-append      port:x265
     }
 }
+# }
 
 variant high10 requires gpl2 description {Build using libx264 with 10-bit output} {}
 
