From f16cfd1ae9779de3fa7f36d0e10502c789f01f2f Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Tue, 7 Aug 2012 15:34:48 -0500
Subject: mkvtoolnix 5.7.0

---
 abs/extra/mkvtoolnix/PKGBUILD           | 100 +++++++++++++++++++++++++-------
 abs/extra/mkvtoolnix/mkvtoolnix.install |  14 +++++
 abs/extra/mkvtoolnix/mm_io.patch        |  11 ++++
 3 files changed, 103 insertions(+), 22 deletions(-)
 create mode 100644 abs/extra/mkvtoolnix/mkvtoolnix.install
 create mode 100644 abs/extra/mkvtoolnix/mm_io.patch

diff --git a/abs/extra/mkvtoolnix/PKGBUILD b/abs/extra/mkvtoolnix/PKGBUILD
index fb275a2..2439562 100644
--- a/abs/extra/mkvtoolnix/PKGBUILD
+++ b/abs/extra/mkvtoolnix/PKGBUILD
@@ -1,32 +1,88 @@
-# $Id: PKGBUILD 41916 2009-06-07 23:34:29Z giovanni $
+# $Id: PKGBUILD 163843 2012-07-21 11:04:01Z giovanni $
 # Maintainer: Giovanni Scafora <giovanni@archlinux.org>
-# Contributor: 03/08/04 <lefungus@altern.org>
+# Contributor: xduugu <xduugu@gmx.com>
 
-##
-## NOTE!!! Newer versions of mkvtoolnix requires gcc v4.6.0+ !!!
-##
-
-
-pkgname=mkvtoolnix
-pkgver=5.0.1
-pkgrel=1
-pkgdesc="Set of tools to create, edit and inspect Matroska files"
+pkgbase=mkvtoolnix
+pkgname=('mkvtoolnix-cli' 'mkvtoolnix-gtk')
+pkgver=5.7.0
+pkgrel=3
 arch=('i686' 'x86_64')
-license=('GPL2')
+license=('GPL')
 url="http://www.bunkus.org/videotools/mkvtoolnix/index.html"
-depends=('libmatroska>=1.0.0' 'libebml>=1.0.0' 'flac>=1.1.4' 'libvorbis' 'wxgtk>=2.8.0.1' 'file' 'boost' 'lzo2' 'qt')
-makedepends=('ruby' 'libcroco')
-source=("http://www.bunkus.org/videotools/${pkgname}/sources/${pkgname}-${pkgver}.tar.bz2")
+makedepends=('libmatroska' 'flac' 'libvorbis' 'file' 'wxgtk'
+             'boost-libs' 'lzo2' 'xdg-utils' 'boost' 'ruby')
+source=("http://www.bunkus.org/videotools/${pkgbase}/sources/${pkgbase}-${pkgver}.tar.bz2"
+        'mm_io.patch')
+md5sums=('99ea44be570412dadafe4ccaee0cfe6e'
+         '293bd4551ef8529e9d4796c5a201b8fc')
 
 build() {
-  cd ${srcdir}/${pkgname}-${pkgver}/
+  cd "${srcdir}/${pkgbase}-${pkgver}"
+
+  patch -Np1 -i "${srcdir}/mm_io.patch"
+
+  # Disable automagic curl dep used for online update checking
+  sed -i -e '/curl/d' configure.in
+  export CURL_CFLAGS="" CURL_LIBS=""
+
+  export CFLAGS="${CFLAGS} -DBOOST_FILESYSTEM_VERSION=3"
+  export CXXFLAGS="${CXXFLAGS} -DBOOST_FILESYSTEM_VERSION=3"
+
+  autoreconf
+
   ./configure --prefix=/usr \
               --with-boost-libdir=/usr/lib \
-              --enable-qt
-  ./drake  || return 1
+              --disable-gui
+  rake
+
+  mv src/mkvinfo{,-cli}
+
+  ./configure --prefix=/usr \
+              --with-boost-libdir=/usr/lib
+  rake
 }
-package() {
-  cd ${srcdir}/${pkgname}-${pkgver}
-  ./drake DESTDIR=${pkgdir} install
+
+package_mkvtoolnix-cli() {
+  pkgdesc="Set of tools to create, edit and inspect Matroska files - CLI version"
+  depends=('libmatroska' 'expat' 'flac' 'libvorbis' 'file' 'boost-libs' 'lzo2')
+  provides=('mkvtoolnix')
+  conflicts=('mkvtoolnix')
+  replaces=('mkvtoolnix')
+
+  cd "${srcdir}/${pkgbase}-${pkgver}"
+
+  rake DESTDIR="${pkgdir}" install
+  rm -rf "${pkgdir}"/usr/bin/mkvinfo
+  install -Dm755 src/mkvinfo-cli "${pkgdir}"/usr/bin/mkvinfo
+
+  rm -rf "${pkgdir}"/usr/bin/mmg
+  rm -rf "${pkgdir}"/usr/share/man/ja/man1/mmg.1
+  rm -rf "${pkgdir}"/usr/share/man/man1/mmg.1
+  rm -rf "${pkgdir}"/usr/share/man/nl/man1/mmg.1
+  rm -rf "${pkgdir}"/usr/share/man/zh_CN/man1/mmg.1
+  rm -rf "${pkgdir}"/usr/share/man/uk/man1/mmg.1
+  rm -rf "${pkgdir}"/usr/share/applications
+  rm -rf "${pkgdir}"/usr/share/icons
+  rm -rf "${pkgdir}"/usr/share/mime
+}
+
+package_mkvtoolnix-gtk() {
+  pkgdesc="Set of tools to create, edit and inspect Matroska files - wxGTK GUI"
+  depends=("mkvtoolnix-cli=${pkgver}" 'wxgtk' 'xdg-utils')
+  install=mkvtoolnix.install
+
+  cd "${srcdir}/${pkgbase}-${pkgver}"
+
+  rake DESTDIR="${pkgdir}" install
+  rm -rf "${pkgdir}"/usr/bin/mkv*
+  install -Dm755 src/mkvinfo "${pkgdir}"/usr/bin/mkvinfo-gtk
+  sed -ri 's/^(Exec=mkvinfo)/\1-gtk/' "${pkgdir}"/usr/share/applications/mkvinfo.desktop
+
+  rm -rf "${pkgdir}"/usr/share/doc
+  rm -rf "${pkgdir}"/usr/share/locale
+  rm -rf "${pkgdir}"/usr/share/man/ja/man1/mkv*
+  rm -rf "${pkgdir}"/usr/share/man/man1/mkv*
+  rm -rf "${pkgdir}"/usr/share/man/nl/man1/mkv*
+  rm -rf "${pkgdir}"/usr/share/man/zh_CN/man1/mkv*
+  rm -rf "${pkgdir}"/usr/share/man/uk/man1/mkv*
 }
-md5sums=('2cd84ff24e1d9217dd3caf170f34e758')
diff --git a/abs/extra/mkvtoolnix/mkvtoolnix.install b/abs/extra/mkvtoolnix/mkvtoolnix.install
new file mode 100644
index 0000000..74d9eb2
--- /dev/null
+++ b/abs/extra/mkvtoolnix/mkvtoolnix.install
@@ -0,0 +1,14 @@
+post_install() {
+   xdg-icon-resource forceupdate --theme hicolor &> /dev/null
+   if [ -f usr/bin/update-mime-database ]; then
+      update-mime-database usr/share/mime &> /dev/null
+   fi
+}
+
+post_upgrade() {
+   post_install
+}
+
+pre_remove() {
+   post_install
+}
diff --git a/abs/extra/mkvtoolnix/mm_io.patch b/abs/extra/mkvtoolnix/mm_io.patch
new file mode 100644
index 0000000..9ee9e01
--- /dev/null
+++ b/abs/extra/mkvtoolnix/mm_io.patch
@@ -0,0 +1,11 @@
+--- a/src/common/mm_io.cpp	2012-07-08 20:06:02.000000000 +0200
++++ b/src/common/mm_io.cpp	2012-07-21 11:59:59.000000000 +0200
+@@ -147,7 +147,7 @@
+ void
+ mm_file_io_c::prepare_path(const std::string &path) {
+   boost::filesystem::path directory = boost::filesystem::path(path).parent_path();
+-  if (boost::filesystem::exists(directory))
++  if (directory.empty() || boost::filesystem::exists(directory))
+     return;
+ 
+   boost::system::error_code error_code;
-- 
cgit v0.12

