summary refs log tree commit diff
path: root/pkgs/applications/video/mkvtoolnix/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/video/mkvtoolnix/default.nix')
-rw-r--r--pkgs/applications/video/mkvtoolnix/default.nix135
1 files changed, 102 insertions, 33 deletions
diff --git a/pkgs/applications/video/mkvtoolnix/default.nix b/pkgs/applications/video/mkvtoolnix/default.nix
index 23bad049d6f..8557c47ad77 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;
   };
 }