From ecda3625714c411c0efcdda9e410cdff37d66b75 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Tue, 7 Feb 2017 16:11:37 +0000
Subject: handbrake: update to 1.0.2

---
 abs/extra/handbrake/PKGBUILD                       | 44 ++++++-----
 .../handbrake-fix-missing-x265-link-flag.patch     | 13 ++++
 abs/extra/handbrake/handbrake.install              | 14 ----
 .../handbrake/standard-presets-fix-type.patch      | 88 ----------------------
 4 files changed, 34 insertions(+), 125 deletions(-)
 create mode 100644 abs/extra/handbrake/handbrake-fix-missing-x265-link-flag.patch
 delete mode 100644 abs/extra/handbrake/handbrake.install
 delete mode 100644 abs/extra/handbrake/standard-presets-fix-type.patch

diff --git a/abs/extra/handbrake/PKGBUILD b/abs/extra/handbrake/PKGBUILD
index 499f790..3b0c3e4 100644
--- a/abs/extra/handbrake/PKGBUILD
+++ b/abs/extra/handbrake/PKGBUILD
@@ -4,30 +4,32 @@
 # Contributor: Sebastien Piccand <sebcactus gmail com>
 
 pkgname=('handbrake' 'handbrake-cli')
-pkgver=0.10.2
-pkgrel=3
+pkgver=1.0.2
+pkgrel=1
 arch=('i686' 'x86_64')
 url="https://handbrake.fr/"
 license=('GPL')
 makedepends=('intltool' 'python2' 'yasm' 'wget' 'bzip2' 'gcc-libs' 'libnotify'
              'gst-plugins-base' 'gtk3' 'dbus-glib' 'fribidi' 'libass' 'lame'
              'fontconfig' 'freetype2' 'libxml2' 'libogg' 'libvorbis' 'cmake'
-             'libtheora' 'libsamplerate' 'libbluray' 'x264' 'libx264'
-             'libdvdnav' 'librsvg' 'libgudev')
-source=(https://handbrake.fr/mirror/HandBrake-$pkgver.tar.bz2)
-sha256sums=('4cc3828393b26a982dbe00febd700c5090d3443c1d45492e0b373e02da73c699')
+             'libtheora' 'libsamplerate' 'ffmpeg' 'x264' 'libx264' 'x265'
+             'libvpx' 'libdvdnav' 'jansson' 'librsvg' 'libgudev')
+source=(https://handbrake.fr/mirror/HandBrake-$pkgver.tar.bz2
+        handbrake-fix-missing-x265-link-flag.patch)
+sha256sums=('18e4563cc150309df03f7e73462b823ba2eca61644a7a536c9930611f3f9aa1e'
+            '05e212e76b6e0b94a04de02cbeb7bf9db607059e19297b5bd3d0d143135285c4')
 
 prepare() {
   cd "$srcdir/HandBrake-$pkgver"
 
+  # https://bugs.gentoo.org/show_bug.cgi?id=552792
+  patch -Np1 -i ../handbrake-fix-missing-x265-link-flag.patch
+
   # Use more system libs
-  # We had ffmpeg here as well but it broke PGS subtitle processing
-  # https://forum.handbrake.fr/viewtopic.php?f=13&t=27581
-  sed -i \
-    -e '/MODULES += contrib\/libbluray/d' \
-    -e '/MODULES += contrib\/libdvdnav/d' \
-    -e '/MODULES += contrib\/libdvdread/d' \
-    make/include/main.defs
+  # Bundled libbluray is kept because it is patched locally
+  for _lib in ffmpeg x265 libvpx libdvdnav libdvdread; do
+    sed -i "/MODULES += contrib\/$_lib/d" make/include/main.defs
+  done
 }
 
 build() {
@@ -35,23 +37,19 @@ build() {
 
   ./configure \
     --prefix=/usr \
-    --force \
     --disable-gtk-update-checks
-  cd build
-  make
+  make -C build
 }
 
 package_handbrake() {
   pkgdesc="Multithreaded video transcoder"
   depends=('bzip2' 'gcc-libs' 'gst-plugins-base' 'libnotify' 'dbus-glib'
            'fribidi' 'libass' 'lame' 'gtk3' 'fontconfig' 'freetype2' 'libxml2'
-           'libogg' 'libvorbis' 'libtheora' 'libsamplerate' 'libbluray'
-           'libx264' 'libdvdnav' 'librsvg' 'libgudev' 'desktop-file-utils'
-           'hicolor-icon-theme')
-  depends+=('libx264.so')
+           'libogg' 'libvorbis' 'libtheora' 'libsamplerate' 'ffmpeg' 'libx264'
+           'x265' 'libvpx' 'libdvdnav' 'jansson' 'librsvg' 'libgudev'
+           'desktop-file-utils' 'hicolor-icon-theme')
   optdepends=('gst-plugins-good: for video previews'
               'gst-libav: for video previews')
-  install=$pkgname.install
 
   cd "$srcdir/HandBrake-$pkgver/build"
 
@@ -62,8 +60,8 @@ package_handbrake() {
 package_handbrake-cli() {
   pkgdesc="Multithreaded video transcoder (CLI)"
   depends=('bzip2' 'gcc-libs' 'zlib' 'fribidi' 'libass' 'lame' 'libxml2'
-           'libtheora' 'libsamplerate' 'libbluray' 'libx264' 'libdvdnav')
-  depends+=('libx264.so')
+           'libtheora' 'libsamplerate' 'ffmpeg' 'libx264' 'x265' 'libvpx'
+           'libdvdnav' 'jansson')
 
   cd "$srcdir/HandBrake-$pkgver/build"
   install -D HandBrakeCLI "$pkgdir/usr/bin/HandBrakeCLI"
diff --git a/abs/extra/handbrake/handbrake-fix-missing-x265-link-flag.patch b/abs/extra/handbrake/handbrake-fix-missing-x265-link-flag.patch
new file mode 100644
index 0000000..a963fe0
--- /dev/null
+++ b/abs/extra/handbrake/handbrake-fix-missing-x265-link-flag.patch
@@ -0,0 +1,13 @@
+Written by: Peter Foley <pefoley2@pefoley.com>
+Gentoo Bug: #552792
+
+--- a/test/module.defs
++++ b/test/module.defs
+@@ -25,6 +25,7 @@
+ 
+ ifeq (1,$(FEATURE.x265))
+     TEST.GCC.D += USE_X265
++    TEST.GCC.l += x265
+ endif
+ 
+ TEST.GCC.l += $(foreach m,$(MODULES.NAMES),$($m.OSL.libs))
diff --git a/abs/extra/handbrake/handbrake.install b/abs/extra/handbrake/handbrake.install
deleted file mode 100644
index 87c29e4..0000000
--- a/abs/extra/handbrake/handbrake.install
+++ /dev/null
@@ -1,14 +0,0 @@
-post_install() {
-  update-desktop-database -q
-  gtk-update-icon-cache -q -t -f usr/share/icons/hicolor
-}
-
-post_upgrade() {
-  post_install
-}
-
-post_remove() {
-  post_install
-}
-
-# vim:set ts=2 sw=2 et:
diff --git a/abs/extra/handbrake/standard-presets-fix-type.patch b/abs/extra/handbrake/standard-presets-fix-type.patch
deleted file mode 100644
index 797c3fa..0000000
--- a/abs/extra/handbrake/standard-presets-fix-type.patch
+++ /dev/null
@@ -1,88 +0,0 @@
-Index: branches/0.10.x/gtk/src/standard_presets.xml
-===================================================================
---- branches/0.10.x/gtk/src/standard_presets.xml	(revision 6995)
-+++ branches/0.10.x/gtk/src/standard_presets.xml	(revision 7008)
-@@ -85,5 +85,5 @@
- 				<string></string>
- 				<key>PictureDenoiseFilter</key>
--				<integer>off</integer>
-+				<string>off</string>
- 				<key>PictureDenoiseCustom</key>
- 				<string></string>
-@@ -216,5 +216,5 @@
- 				<string></string>
- 				<key>PictureDenoiseFilter</key>
--				<integer>off</integer>
-+				<string>off</string>
- 				<key>PictureDenoiseCustom</key>
- 				<string></string>
-@@ -347,5 +347,5 @@
- 				<string></string>
- 				<key>PictureDenoiseFilter</key>
--				<integer>off</integer>
-+				<string>off</string>
- 				<key>PictureDenoiseCustom</key>
- 				<string></string>
-@@ -478,5 +478,5 @@
- 				<string></string>
- 				<key>PictureDenoiseFilter</key>
--				<integer>off</integer>
-+				<string>off</string>
- 				<key>PictureDenoiseCustom</key>
- 				<string></string>
-@@ -625,5 +625,5 @@
- 				<string></string>
- 				<key>PictureDenoiseFilter</key>
--				<integer>off</integer>
-+				<string>off</string>
- 				<key>PictureDenoiseCustom</key>
- 				<string></string>
-@@ -772,5 +772,5 @@
- 				<string></string>
- 				<key>PictureDenoiseFilter</key>
--				<integer>off</integer>
-+				<string>off</string>
- 				<key>PictureDenoiseCustom</key>
- 				<string></string>
-@@ -919,5 +919,5 @@
- 				<string></string>
- 				<key>PictureDenoiseFilter</key>
--				<integer>off</integer>
-+				<string>off</string>
- 				<key>PictureDenoiseCustom</key>
- 				<string></string>
-@@ -1050,5 +1050,5 @@
- 				<string></string>
- 				<key>PictureDenoiseFilter</key>
--				<integer>off</integer>
-+				<string>off</string>
- 				<key>PictureDenoiseCustom</key>
- 				<string></string>
-@@ -1181,5 +1181,5 @@
- 				<string></string>
- 				<key>PictureDenoiseFilter</key>
--				<integer>off</integer>
-+				<string>off</string>
- 				<key>PictureDenoiseCustom</key>
- 				<string></string>
-@@ -1312,5 +1312,5 @@
- 				<string></string>
- 				<key>PictureDenoiseFilter</key>
--				<integer>off</integer>
-+				<string>off</string>
- 				<key>PictureDenoiseCustom</key>
- 				<string></string>
-@@ -1458,5 +1458,5 @@
- 				<string></string>
- 				<key>PictureDenoiseFilter</key>
--				<integer>off</integer>
-+				<string>off</string>
- 				<key>PictureDenoiseCustom</key>
- 				<string></string>
-@@ -1605,5 +1605,5 @@
- 				<string></string>
- 				<key>PictureDenoiseFilter</key>
--				<integer>off</integer>
-+				<string>off</string>
- 				<key>PictureDenoiseCustom</key>
- 				<string></string>
-- 
cgit v0.12