--- Portfile	2017-07-26 17:47:41.000000000 +0200
+++ Portfile.new	2017-07-26 17:47:23.000000000 +0200
@@ -4,30 +4,18 @@
 PortGroup           xcodeversion 1.0
 
 name                HandBrake
-version             0.10.0
+version             1.0.7
 categories          multimedia aqua
 platforms           macosx
 license             GPL-2
 maintainers         larryv
 
-subport HandBrakeCLI {
-    categories-delete aqua
-}
-
-
 description         The open source video transcoder
 long_description    HandBrake is a tool for converting video from \
                     nearly any format to a selection of modern, \
                     widely supported codecs.
 homepage            http://handbrake.fr/
 
-subport HandBrakeCLI {
-    description-append          (CLI)
-    long_description-append {*}{(This port provides the command-line
-                                interface only; install the `HandBrake`
-                                port for the graphical user interface.)}
-}
-
 
 # The MacGui uses NS_ENUM, boolean literals, NSDictionary
 # subscripting, and other modern Objective-C features
@@ -35,13 +23,6 @@
 minimum_xcodeversions {12 4.4}
 set minDarwinVersion 12
 
-subport HandBrakeCLI {
-    # TODO: Fix build on Snow Leopard. All the contribs build fine,
-    # but linking the HandBrakeCLI executable fails.
-    minimum_xcodeversions
-    set minDarwinVersion 11
-}
-
 set minOSXVersion 10.[expr {$minDarwinVersion - 4}]
 if {${os.platform} eq "darwin" && ${os.major} < $minDarwinVersion} {
     pre-fetch {
@@ -91,10 +72,6 @@
 # Configure the bundled fontconfig to use the port's fonts.
 depends_lib-append  port:fontconfig
 
-subport HandBrake {
-    depends_run     port:HandBrakeCLI
-}
-
 # TODO: Sort out depends_skip_archcheck.
 
 
@@ -103,40 +80,43 @@
 
 
 # use_bzip2 must come first so master_sites gets the right extract.suffix.
-use_bzip2           yes
-master_sites        http://handbrake.fr/rotation.php?file=${distname}${extract.suffix}&dummy=:src \
-                    http://download.handbrake.fr/handbrake/contrib:contrib
+use_bzip2 yes
+master_sites        https://handbrake.fr/mirror:src \
+                    https://download.handbrake.fr/handbrake/contrib:contrib 
 
 # The subports use the same distfiles.
 dist_subdir ${name}
 
 checksums           ${distname}${extract.suffix} \
-                        rmd160  c0140fd33b4ca3fea3dd43a5960a71055a00acc8 \
-                        sha256  a91042da3cc08454844f7c171ee2fde4f0ed08176407fc0328d5118227ed4114 \
-                    fontconfig-2.8.0.tar.gz \
-                        rmd160  fefee412cad4fa71b573e997e14f1df12f439be2 \
-                        sha256  fa2a1c6eea654d9fce7a4b1220f10c99cdec848dccaf1625c01f076b31382335 \
-                    freetype-2.4.7.tar.bz2 \
-                        rmd160  48abfcd4546cbd6626796ab121252e804ddcc6d8 \
-                        sha256  ba22620479954582371286268ef75e6e932c0270ee67d6797bbf3ed9d31a5d77 \
-                    fribidi-0.19.2.tar.gz \
-                        rmd160  4fafb4b3140bbbcf4c2c58c714b02db2d71e5491 \
-                        sha256  49cf91586e48b52fe25872ff66c1da0dff0daac2593f9f300e2af12f44f64177 \
+                        rmd160  9ab7267234c066cdcfec2652b9133d0d1aedd210 \
+                        sha256  ffdee112f0288f0146b965107956cd718408406b75db71c44d2188f5296e677f \
+                    freetype-2.6.5.tar.bz2 \
+                        rmd160  aa7a75433ed1e54b1904a8c57d924ba45d7ff47e \
+                        sha256  e20a6e1400798fd5e3d831dd821b61c35b1f9a6465d6b18a53a9df4cf441acf0 \
+                    fribidi-0.19.7.tar.bz2 \
+                        rmd160  031cd7a160717bca78cbee93cfc92c6c86f373a3 \
+                        sha256  08222a6212bbc2276a2d55c3bf370109ae4a35b689acbc66571ad2a670595a8e \
+                    harfbuzz-1.3.0.tar.bz2 \
+                        rmd160  92c18499ec2cc830d58b9512ee181dba0228a74e \
+                        sha256  b04be31633efee2cae1d62d46434587302554fa837224845a62565ec68a0334d \
+                    jansson-2.6.tar.bz2 \
+                        rmd160  83d543f12716cc56aee726022a16738387ed7f95 \
+                        sha256  d2cc63ee7f6dcda6c9a8f0b558f94b8f25f048706b7cbd6a79d3e877b738cd4d \
                     lame-3.98.tar.gz \
                         rmd160  c10c20128622e16f9cac3d346bea8e390e4bfdc5 \
                         sha256  40235e84dfe4760ad3f352590a64b7bda1502a386c97d06229df356426e37686 \
-                    libass-0.10.0-1.tar.gz \
-                        rmd160  da29a27a4ae107629d0ea6dd7ec21f1d36167b16 \
-                        sha256  a0c652f4a5c1bfd58cd47ff627fff2dfbd471b40f765aa96fd1b251c0058b867 \
-                    libav-v10.1.tar.bz2 \
-                        rmd160  fc9420a1ce8f081df592dbc2ac4500771103b38b \
-                        sha256  bc3807426d4e73fe8c245730b0df4ba95766cf7e17e47c738ee302f73d066ac9 \
-                    libbluray-0.5.0.tar.bz2 \
-                        rmd160  7816daf8dced33765be85621ab3cd3da61edd76d \
-                        sha256  d414b548ff97c081e1a2f337c0904f44e65d91a00d2efa4a46a1ecd3de285b4d \
-                    libdvdnav-5.0.1-0-gaa3659d.tar.gz \
-                        rmd160  a712563c197a3f24636be7aa87396400f110e0f7 \
-                        sha256  574b7af7ff52e21048ab62c0b14271e651faafb5d46f8efc64dbd82ff34e162b \
+                    libass-0.13.2.tar.gz \
+                        rmd160  9e84dfc71b7c1c4726bdc149a9087e616dcaf352 \
+                        sha256  8baccf663553b62977b1c017d18b3879835da0ef79dc4d3b708f2566762f1d5e \
+                    libav-12.tar.gz \
+                        rmd160  229aa9bfc2397f4899f0f981f31f8a4f58b9a185 \
+                        sha256  ca5cb22ba660f0bdc47817fdb9d99059a71f9eb0776c68cf8bef769a5ccc7534 \
+                    libbluray-0.9.3.tar.bz2 \
+                        rmd160  14789e01ab6918f5452e198df5cb23b4382ef7ca \
+                        sha256  a6366614ec45484b51fe94fcd1975b3b8716f90f038a33b24d59978de3863ce0 \
+                    libdvdnav-5.0.1.tar.bz2 \
+                        rmd160  f957c3cb739d9f2c0c747ad8f55876d1e440a650 \
+                        sha256  72b1cb8266f163d4a1481b92c7b6c53e6dc9274d2a6befb08ffc351fe7a4a2a9 \
                     libdvdread-5.0.0-6-gcb1ae87.tar.gz \
                         rmd160  708aa5031b16c9b63d6382e9dd223da874702d53 \
                         sha256  d2e4200c3c5d5f812892f9c14851c94e2f707d54e7328946c6397ac999f15f17 \
@@ -152,18 +132,21 @@
                     libvorbis-aotuv_b6.03.tar.bz2 \
                         rmd160  6e25b9b6545b2e568038349fafe559999b9c3387 \
                         sha256  95455420f07e4b3abdf32bda9f5921e9ed3f1afdc3739098dc090150a42fd7fd \
-                    libvpx-v1.3.0.tar.bz2 \
-                        rmd160  bf74821ac8f20ed30f44b6e01473ee1f332f721c \
-                        sha256  d3dcc8d84af51c6c382b214397c62402e37a799e8ebcda6f4217aef0010451a9 \
+                    libvpx-1.5.0.tar.bz2 \
+                        rmd160  50d919e8d27d7d83754ca20e8997a0357010a33c \
+                        sha256  306d67908625675f8e188d37a81fbfafdf5068b09d9aa52702b6fbe601c76797 \
                     libxml2-2.7.7.tar.gz \
                         rmd160  9f72c778c3e9e348a68eada0cf624c012658c085 \
                         sha256  af5b781418ba4fff556fa43c50086658ea8a2f31909c2b625c2ce913a1d9eb68 \
-                    x264-r2479-dd79a61.tar.gz \
-                        rmd160  da2113422d71a85518533499defb2c63f096c6a3 \
-                        sha256  7307a83085f4110f8ae690748f00b5acb4882ec34b83ef260fec264c018c49e9 \
-                    x265-8768-5e604833c5aa-1.4.tar.bz2 \
-                        rmd160  c6cc8072db0b98482760e43216f3926729f225c5 \
-                        sha256  7e7f5f2883ccd39dd0e26c7f3ef3c9f80234d669e29811016d8993987d47ab92
+                    opus-1.1.3.tar.gz \
+                        rmd160  d498f13d81f3337a2e0b6683c09280955ec3d705 \
+                        sha256  58b6fe802e7e30182e95d0cde890c0ace40b6f125cffc50635f0ad2eef69b633 \
+                    x264-snapshot-20160920-2245-stable.tar.bz2 \
+                        rmd160  4ecaa58c0806d5375472ce1e6d08bd955cf49b64 \
+                        sha256  6ba2d848eabbca0d9d2c2a12b263e02f856a81fce87fbc74df52a1097c88e39c \
+                    x265_2.1-1.tar.gz \
+                        rmd160  7f9bf15aed2f7658e4165a1cea48ef45077a2d6c \
+                        sha256  88fcb9af4ba52c0757ac9c0d8cd5ec79951a22905ae886897e06954353d6a643
 
 # Use `checksums` to construct `distfiles`, instead of maintaining and
 # synchronizing two separate lists.
@@ -185,78 +168,46 @@
 
 
 # Patches maintained at https://github.com/larryv/HandBrake.
-patch.pre_args -p1
-patchfiles \
-    0001-Add-a-default-font-directory-for-fontconfig-to-use-w.patch \
-    0002-BuildSystem-Create-configs-for-OS-X-Yosemite.patch \
-    0003-Build-contribs-verbosely.patch \
-    0004-MP-BuildSystem-Allow-Xcode-compiler-override.patch \
-    0005-MP-BuildSystem-Don-t-abort-on-missing-GCC.patch \
-    0006-MP-BuildSystem-Add-targets-for-MacGui-and-CLI.patch \
-    0007-MP-BuildSystem-Destroot-and-install-to-right-locatio.patch \
-    0008-MP-Force-contrib-builds-to-use-MacPorts-tools.patch \
-    0009-MP-MacGui-Disable-Sparkle.patch \
-    0010-MP-fontconfig-Use-our-port-s-configuration.patch \
-    0011-MP-libav-Respect-our-compiler-selection-on-Darwin-i3.patch \
-    0012-libvpx-Add-build-targets-for-OS-X-10.10-Yosemite.patch \
-    0013-libvpx-Fix-discovery-of-Darwin-SDKs.patch \
-    0014-libvpx-Fix-Clang-cross-building-on-OS-X.patch \
-    0015-MP-libvpx-Enable-ccache-if-requested.patch \
-    0016-MP-libvpx-Set-build-target-explicitly.patch
-
-
-# Since HandBrake itself is built using Xcode, restrict ourselves to the
-# Xcode-provided compilers.
-compiler.blacklist apple* macports*
-set xcGCCVersion \
-        [switch ${configure.compiler} {
-            clang        {expr {"com.apple.compilers.llvm.clang.1_0"}}
-            gcc-4.0      {expr {"4.0"}}
-            gcc-4.2      {expr {"4.2"}}
-            llvm-gcc-4.2 {expr {"com.apple.compilers.llvmgcc42"}}
-        }]
+#patch.pre_args -p1
+#patchfiles \
+ #   0001-Add-a-default-font-directory-for-fontconfig-to-use-w.patch \
+ #   0002-BuildSystem-Create-configs-for-OS-X-Yosemite.patch \
+ #   0003-Build-contribs-verbosely.patch \
+ #   0004-MP-BuildSystem-Allow-Xcode-compiler-override.patch \
+ #   0005-MP-BuildSystem-Don-t-abort-on-missing-GCC.patch \
+ #   0006-MP-BuildSystem-Add-targets-for-MacGui-and-CLI.patch \
+ #   0007-MP-BuildSystem-Destroot-and-install-to-right-locatio.patch \
+ #   0008-MP-Force-contrib-builds-to-use-MacPorts-tools.patch \
+ #   0009-MP-MacGui-Disable-Sparkle.patch \
+ #   0010-MP-fontconfig-Use-our-port-s-configuration.patch \
+ #   0011-MP-libav-Respect-our-compiler-selection-on-Darwin-i3.patch \
+ #   0012-libvpx-Add-build-targets-for-OS-X-10.10-Yosemite.patch \
+ #   0013-libvpx-Fix-discovery-of-Darwin-SDKs.patch \
+ #   0014-libvpx-Fix-Clang-cross-building-on-OS-X.patch \
+ #   0015-MP-libvpx-Enable-ccache-if-requested.patch \
+ #   0016-MP-libvpx-Set-build-target-explicitly.patch
 
 # TODO: Respect deployment target in all contrib builds.
-set xcconfigOS osx[string map {. {}} ${macosx_deployment_target}]
+# Max supported target is 10.9 currently
+#set xcconfigOS osx[string map {. {}} ${macosx_deployment_target}]
+set xcconfigOS osx109
 
 configure.args      --arch=${configure.build_arch} \
-                    --curl=false \
-                    --fetch=curl \
                     --gcc='${configure.cc}' \
+                    --disable-df-fetch \
                     --verbose \
-                    --xcode-config=${xcconfigOS}.${configure.build_arch} \
-                    --xcode-driver=terminal \
                     APPLICATIONS_DIR='${applications_dir}' \
                     BUILD.jobs=${build.jobs} \
-                    CCACHE=${configure.ccache} \
-                    GCC_VERSION=$xcGCCVersion
-
+                    CCACHE=${configure.ccache} 
+                    #GCC_VERSION=$xcGCCVersion
+                    #--xcode-config=${xcconfigOS}.${configure.build_arch} \
+                    #--xcode-driver=terminal \
 
 build.type          gnu
 build.dir           ${worksrcpath}/build
-build.target        macosx.gui.build
-build.args          X265.CONFIGURE.exe='${prefix}/bin/cmake'
-
-destroot.target     macosx.gui.install
-
-subport HandBrakeCLI {
-    build.target    macosx.cli.build
-    destroot.target macosx.cli.install
-    # Since HandBrake depends on HandBrakeCLI, install the docs through
-    # HandBrakeCLI so they're always available.
-    post-destroot {
-        set docDir ${destroot}${prefix}/share/doc/${name}
-        xinstall -d $docDir
-        xinstall -m 0644 -W ${worksrcpath} \
-            AUTHORS COPYING CREDITS NEWS THANKS TRANSLATIONS $docDir
-    }
-}
-
+build.target        build
+#build.args          X265.CONFIGURE.exe='${prefix}/bin/cmake'
 
 livecheck.type      regex
 livecheck.url       https://handbrake.fr/downloads.php
 livecheck.regex     {Current Version: (\d(?:\.\d+)+)}
-
-subport HandBrakeCLI {
-    livecheck.type  none
-}
