about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Hoeg <peter@hoeg.com>2021-07-15 09:24:59 +0800
committerPeter Hoeg <peter@hoeg.com>2021-07-29 11:29:49 +0800
commit98dcfcfeb80477315f7faa995d677f919500f8b5 (patch)
treec8e2036b4d9c08f553f209e34710f95211250e48
parent7d189ad382a2d924ed04f3a7856a0ae0747a1187 (diff)
mkvtoolnix: 56.0.0 -> 59.0.0
Additional changes:

1. Qt is now needed for both the cli and gui variants.
2. Run the test suite
3. Drop a number of dependencies that are no longer needed
4. We have nlohmann_json and pugixml, so use those instead of the
   vendored versions
5. Add support for reading chapters from DVDs
6. Build with rake as recommended by upstream
-rw-r--r--pkgs/applications/video/mkvtoolnix/default.nix135
-rw-r--r--pkgs/top-level/all-packages.nix2
2 files changed, 103 insertions, 34 deletions
diff --git a/pkgs/applications/video/mkvtoolnix/default.nix b/pkgs/applications/video/mkvtoolnix/default.nix
index 23bad049d6f88..8557c47ad77fb 100644
--- a/pkgs/applications/video/mkvtoolnix/default.nix
+++ b/pkgs/applications/video/mkvtoolnix/default.nix
@@ -1,69 +1,138 @@
-{ lib, stdenv, fetchFromGitLab, pkg-config, autoconf, automake, libiconv, drake
-, ruby, docbook_xsl, file, xdg-utils, gettext, expat, boost, libebml, zlib
-, fmt, libmatroska, libogg, libvorbis, flac, libxslt, cmark, pcre2
+{ lib
+, stdenv
+, mkDerivation
+, fetchFromGitLab
+, pkg-config
+, autoreconfHook
+, qmake
+, rake
+, boost
+, cmark
+, docbook_xsl
+, expat
+, file
+, flac
+, fmt
+, gettext
+, gmp
+, gtest
+, libdvdread
+, libebml
+, libiconv
+, libmatroska
+, libogg
+, libvorbis
+, libxslt
+, nlohmann_json
+, pugixml
+, qtbase
+, qtmultimedia
+, xdg-utils
+, zlib
 , withGUI ? true
-  , qtbase ? null
-  , qtmultimedia ? null
-  , wrapQtAppsHook ? null
+, wrapQtAppsHook
 }:
 
-assert withGUI -> qtbase != null && qtmultimedia != null && wrapQtAppsHook != null;
+let
+  inherit (lib) enableFeature optional optionals optionalString;
 
-with lib;
+  phase = name: args:
+    ''
+      runHook pre${name}
 
-stdenv.mkDerivation rec {
+      rake ${args}
+
+      runHook post${name}
+    '';
+
+in
+mkDerivation rec {
   pname = "mkvtoolnix";
-  version = "56.0.0";
+  version = "59.0.0";
 
   src = fetchFromGitLab {
-    owner  = "mbunkus";
-    repo   = "mkvtoolnix";
-    rev    = "release-${version}";
-    sha256 = "0nhpp1zkggxqjj7lhj6as5mcjcz5yk3l1d1xcgs7i9153blam1yj";
+    owner = "mbunkus";
+    repo = "mkvtoolnix";
+    rev = "release-${version}";
+    sha256 = "sha256-bPypOsveXrkz1V961b9GTJKFdgru/kcW15z/yik/4yQ=";
   };
 
   nativeBuildInputs = [
-    pkg-config autoconf automake gettext
-    drake ruby docbook_xsl libxslt
-  ];
+    autoreconfHook
+    docbook_xsl
+    gettext
+    gtest
+    libxslt
+    pkg-config
+    rake
+  ]
+  ++ optional withGUI wrapQtAppsHook;
 
+  # 1. qtbase and qtmultimedia are needed without the GUI
+  # 2. we have utf8cpp in nixpkgs but it doesn't find it
   buildInputs = [
-    expat file xdg-utils boost libebml zlib fmt
-    libmatroska libogg libvorbis flac cmark pcre2
-  ] ++ optional  stdenv.isDarwin libiconv
-    ++ optionals withGUI [ qtbase qtmultimedia wrapQtAppsHook ];
+    boost
+    expat
+    file
+    flac
+    fmt
+    gmp
+    libdvdread
+    libebml
+    libmatroska
+    libogg
+    libvorbis
+    nlohmann_json
+    pugixml
+    qtbase
+    qtmultimedia
+    xdg-utils
+    zlib
+  ]
+  ++ optional withGUI cmark
+  ++ optional stdenv.isDarwin libiconv;
 
-  preConfigure = "./autogen.sh; patchShebangs .";
-  buildPhase   = "drake -j $NIX_BUILD_CORES";
-  installPhase = "drake install -j $NIX_BUILD_CORES";
+  # autoupdate is not needed but it silences a ton of pointless warnings
+  postPatch = ''
+    patchShebangs . > /dev/null
+    autoupdate configure.ac ac/*.m4
+  '';
 
   configureFlags = [
-    "--enable-magic"
-    "--enable-optimization"
-    "--with-boost-libdir=${boost.out}/lib"
     "--disable-debug"
-    "--disable-profiling"
     "--disable-precompiled-headers"
+    "--disable-profiling"
     "--disable-static-qt"
-    "--with-gettext"
+    "--enable-optimization"
+    "--with-boost-libdir=${boost.out}/lib"
     "--with-docbook-xsl-root=${docbook_xsl}/share/xml/docbook-xsl"
-    (enableFeature withGUI "qt")
+    "--with-gettext"
+    (enableFeature withGUI "gui")
   ];
 
+  buildPhase = phase "Build" "";
+
+  installPhase = phase "Install" "install";
+
+  doCheck = true;
+
+  checkPhase = phase "Check" "tests:run_unit";
+
   CXXFLAGS = optional stdenv.cc.isClang "-std=c++17";
   LDFLAGS = optional stdenv.cc.isClang "-lc++fs";
 
   dontWrapQtApps = true;
+
   postFixup = optionalString withGUI ''
     wrapQtApp $out/bin/mkvtoolnix-gui
   '';
 
   meta = with lib; {
     description = "Cross-platform tools for Matroska";
-    homepage    = "http://www.bunkus.org/videotools/mkvtoolnix/";
-    license     = licenses.gpl2Only;
+    homepage = "https://mkvtoolnix.download/";
+    license = licenses.gpl2Only;
     maintainers = with maintainers; [ codyopel rnhmjoj ];
-    platforms   = platforms.linux
+    platforms = platforms.linux
       ++ optionals (!withGUI) platforms.darwin;
   };
 }
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 66e5491deab0c..beab8189b4479 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -17554,7 +17554,7 @@ in
 
   mkvtoolnix = libsForQt5.callPackage ../applications/video/mkvtoolnix { };
 
-  mkvtoolnix-cli = callPackage ../applications/video/mkvtoolnix {
+  mkvtoolnix-cli = mkvtoolnix.override {
     withGUI = false;
   };