--- orig.Portfile	2017-05-09 16:33:36.077086333 +0200
+++ Portfile	2017-07-16 09:26:18.855399726 +0200
@@ -29,8 +29,12 @@
     homepage            http://www.videolan.org/vlc/libvlc.html
 }
 
-subport ffmpeg-VLC {}
-set FFMPEG_VLC_PREFIX   ${prefix}/lib/vlc/ffmpeg
+set use_ffmpeg_VLC      no
+
+if {[tbool use_ffmpeg_VLC]} {
+    subport ffmpeg-VLC {}
+    set FFMPEG_VLC_PREFIX   ${prefix}/lib/vlc/ffmpeg
+}
 
 if {${subport} eq ${name}} {
     conflicts           lib${name} libVLC-devel VLC-devel
@@ -44,8 +48,7 @@
 ###################  ports VLC and libVLC  ###################
 ##
 if {(${subport} eq ${name}) || (${subport} eq "lib${name}")} {
-    version             2.2.4
-    revision            8
+    version             2.2.6
     license             GPL-2
 
     platforms           darwin
@@ -54,8 +57,8 @@
     distname            vlc-${version}
     use_xz              yes
 
-    checksums           rmd160  2fe178bb9a4b2ad5ca0294d3e52ceb992b22e8ee \
-                        sha256  1632e91d2a0087e0ef4c3fb4c95c3c2890f7715a9d1d43ffd46329f428cf53be
+    checksums           rmd160  b2727834bcbbf0d274e3a0b4a3317f3b914f9ad4 \
+                        sha256  c403d3accd9a400eb2181c958f3e7bc5524fe5738425f4253d42883b425a42a8
 
     if {[info exist ::env(MACPORTS_COMPRESS_WORKDIR)] && $::env(MACPORTS_COMPRESS_WORKDIR)} {
         # Enable HFS compression.
@@ -67,8 +70,11 @@
 
     depends_build       port:pkgconfig
 
-    depends_lib         port:ffmpeg-VLC \
-                        port:a52dec \
+    if {[tbool use_ffmpeg_VLC]} {
+        depends_lib-append \
+                        port:ffmpeg-FFMPEG_VLC_PREFIX
+    }
+    depends_lib-append  port:a52dec \
                         port:avahi \
                         port:bzip2 \
                         port:faad2 \
@@ -189,8 +195,14 @@
                         static_assert.patch \
                         no-sparkle.patch \
                         patch-vlc-no-O4.diff \
-                        patch-ffmpegVLC.diff \
                         patch-soundfont-path.diff
+    if {[tbool use_ffmpeg_VLC]} {
+        patchfiles-append \
+                        patch-ffmpegVLC.diff
+    } else {
+        patchfiles-append \
+                        patch-ffmpeg3-compat.diff
+    }
 
     post-patch {
         if {[string match *clang* ${configure.cxx}] && ${configure.cxx_stdlib} == "libc++"} {
@@ -201,32 +213,34 @@
 
         reinplace "s|@PREFIX@|${prefix}|g" ${worksrcpath}/modules/codec/fluidsynth.c
 
-        # patch source using ffmpeg to use the correct header file locations
-        foreach dir {libavcodec libavformat libavresample libavutil libpostproc libswresample libswscale} {
-            foreach module {access codec/avcodec demux/avformat hw/vdpau packetizer video_chroma} {
-                foreach cf [glob -nocomplain ${worksrcpath}/modules/${module}/*.c] {
-                    reinplace "s|${dir}/|${dir}-VLC/|g" ${cf}
-                }
-                foreach cf [glob -nocomplain ${worksrcpath}/modules/${module}/*.h] {
-                    reinplace "s|${dir}/|${dir}-VLC/|g" ${cf}
+        if {[tbool use_ffmpeg_VLC]} {
+            # patch source using ffmpeg to use the correct header file locations
+            foreach dir {libavcodec libavformat libavresample libavutil libpostproc libswresample libswscale} {
+                foreach module {access codec/avcodec demux/avformat hw/vdpau packetizer video_chroma} {
+                    foreach cf [glob -nocomplain ${worksrcpath}/modules/${module}/*.c] {
+                        reinplace "s|${dir}/|${dir}-VLC/|g" ${cf}
+                    }
+                    foreach cf [glob -nocomplain ${worksrcpath}/modules/${module}/*.h] {
+                        reinplace "s|${dir}/|${dir}-VLC/|g" ${cf}
+                    }
                 }
+                reinplace "s|${dir}/|${dir}-VLC/|g" ${worksrcpath}/configure.ac ${worksrcpath}/configure
             }
-            reinplace "s|${dir}/|${dir}-VLC/|g" ${worksrcpath}/configure.ac ${worksrcpath}/configure
-        }
-        reinplace "s|postproc/|postproc-VLC/|g" ${worksrcpath}/configure.ac ${worksrcpath}/configure
-        reinplace "s|libpostproc/|libpostproc-VLC/|g" ${worksrcpath}/modules/video_filter/postproc.c
-        reinplace "s|HAVE_LIBAVUTIL_AV|HAVE_LIBAVUTIL_VLC_AV|g" \
+            reinplace "s|postproc/|postproc-VLC/|g" ${worksrcpath}/configure.ac ${worksrcpath}/configure
+            reinplace "s|libpostproc/|libpostproc-VLC/|g" ${worksrcpath}/modules/video_filter/postproc.c
+            reinplace "s|HAVE_LIBAVUTIL_AV|HAVE_LIBAVUTIL_VLC_AV|g" \
                 ${worksrcpath}/modules/codec/avcodec/avcommon.h \
                 ${worksrcpath}/modules/codec/avcodec/avcommon_compat.h
-        reinplace "s|HAVE_LIBAVFORMAT_AV|HAVE_LIBAVFORMAT_VLC_AV|g" \
+            reinplace "s|HAVE_LIBAVFORMAT_AV|HAVE_LIBAVFORMAT_VLC_AV|g" \
                 ${worksrcpath}/modules/codec/avcodec/avcommon.h \
                 ${worksrcpath}/modules/codec/avcodec/avcommon_compat.h
-        reinplace "s|HAVE_LIBAVCODEC_AV|HAVE_LIBAVCODEC_VLC_AV|g" \
+            reinplace "s|HAVE_LIBAVCODEC_AV|HAVE_LIBAVCODEC_VLC_AV|g" \
                 ${worksrcpath}/modules/codec/avcodec/avcommon.h \
                 ${worksrcpath}/modules/codec/avcodec/avcommon_compat.h
-        reinplace "s|HAVE_LIBSWSCALE_SW|HAVE_LIBSWSCALE_VLC_SW|g" \
+            reinplace "s|HAVE_LIBSWSCALE_SW|HAVE_LIBSWSCALE_VLC_SW|g" \
                 ${worksrcpath}/modules/codec/avcodec/avcommon.h \
                 ${worksrcpath}/modules/codec/avcodec/avcommon_compat.h
+        }
     }
     post-configure {
         system -W ${worksrcpath} "patch -Np0 -i ${filespath}/patch-static_assert.diff"
@@ -240,9 +254,11 @@
 
     configure.env-append \
                         CXXCPP="${configure.cxx} -E"
-    # splice in ffmpeg-VLC's pkgconfig path, hoping that PKG_CONFIG_PATH hasn't been set by anyone else
-    configure.env-append \
+    if {[tbool use_ffmpeg_VLC]} {
+        # splice in ffmpeg-VLC's pkgconfig path, hoping that PKG_CONFIG_PATH hasn't been set by anyone else
+        configure.env-append \
                         PKG_CONFIG_PATH=${FFMPEG_VLC_PREFIX}/lib/pkgconfig
+    }
     build.args-append   DESTDIR=${worksrcpath}/dest_ignore V=1
 
     # gl.c:121:3: error: Platform not recognized.
@@ -505,10 +521,20 @@
                     delete ${destroot}${applications_dir}/VLC.app/Contents/MacOS/share/lua
 
                     # http://trac.macports.org/ticket/35131
-                    ln -s ${prefix}/lib ${destroot}${applications_dir}/VLC.app/Contents/MacOS/lib
+                    xinstall -m 755 -d ${destroot}${applications_dir}/VLC.app/Contents/MacOS/lib
+                    foreach l [glob -nocomplain ${destroot}${prefix}/lib/*] {
+                        ln -s ${prefix}/lib/[file tail ${l}] ${destroot}${applications_dir}/VLC.app/Contents/MacOS/lib
+                    }
                     ln -s ${prefix}/lib/vlc/plugins ${destroot}${applications_dir}/VLC.app/Contents/MacOS/plugins
                     ln -s ${prefix}/lib/vlc/lua ${destroot}${applications_dir}/VLC.app/Contents/MacOS/share/lua
-                    ln -s ${prefix}/share/locale ${destroot}${applications_dir}/VLC.app/Contents/MacOS/share/locale
+                    foreach d [glob -nocomplain ${destroot}${prefix}/share/locale/*] {
+                        set locale [file tail ${d}]
+                        set ldir ${destroot}${applications_dir}/VLC.app/Contents/MacOS/share/locale/${locale}/LC_MESSAGES
+                        xinstall -m 755 -d ${ldir}
+                        foreach m [glob -nocomplain ${d}/LC_MESSAGES/*] {
+                            ln -s ${prefix}/share/locale/${locale}/LC_MESSAGES/[file tail ${m}] ${ldir}/
+                        }
+                    }
 
                     # the vlc executable needs to be started with a full path to the app bundle executable
                     # or else the Mac OS X interface will hang beyond even a ^C or ^\ :
@@ -529,9 +555,8 @@
             system "${prefix}/lib/vlc/vlc-cache-gen -f ${prefix}/lib/vlc"
         }
     }
-# outcomment when the port:fluid-soundfont* ports have been made available
-#     notes-append "MIDI support requires installing one or more SoundFont files,\
-#         in ${prefix}/share/sounds/sf2, for instance from one of the port:fluid-soundfont-* ports"
+    notes-append "MIDI support requires installing one or more SoundFont files,\
+        in ${prefix}/share/sounds/sf2, for instance from port:generaluser-soundfont."
 }
 
 ##
