bitwarden-desktop: 2024.12.0 -> 2024.12.1 (#373177)
[NixPkgs.git] / pkgs / applications / video / mkvtoolnix / default.nix
blob3577d62b0ce1c78d3b547f85a7c7113ecabb1d6e
2   lib,
3   stdenv,
4   fetchFromGitLab,
5   pkg-config,
6   autoreconfHook,
7   rake,
8   boost,
9   cmark,
10   docbook_xsl,
11   expat,
12   fetchpatch2,
13   file,
14   flac,
15   fmt,
16   gettext,
17   gmp,
18   gtest,
19   libdvdread,
20   libebml,
21   libiconv,
22   libmatroska,
23   libogg,
24   libvorbis,
25   libxslt,
26   nlohmann_json,
27   pugixml,
28   qtbase,
29   qtmultimedia,
30   qtwayland,
31   utf8cpp,
32   xdg-utils,
33   zlib,
34   withGUI ? true,
35   wrapQtAppsHook,
38 let
39   inherit (lib)
40     enableFeature
41     getDev
42     getLib
43     optionals
44     optionalString
45     ;
47   phase = name: args: ''
48     runHook pre${name}
50     rake ${args}
52     runHook post${name}
53   '';
56 stdenv.mkDerivation rec {
57   pname = "mkvtoolnix";
58   version = "87.0";
60   src = fetchFromGitLab {
61     owner = "mbunkus";
62     repo = "mkvtoolnix";
63     rev = "release-${version}";
64     hash = "sha256-UU57ZgH1sxCXspwfKXScw08aJYiv+k526U8q8N1tA+4=";
65   };
67   patches = [
68     (fetchpatch2 {
69       url = "https://gitlab.com/mbunkus/mkvtoolnix/-/commit/fc83003f541ac690fe308c3f4ac36e62814a40db.diff";
70       hash = "sha256-HOS79g5xm70upV5Okv1COEg0SanXs7brRRB59Ofx5HA=";
71     })
72   ];
74   nativeBuildInputs = [
75     autoreconfHook
76     docbook_xsl
77     gettext
78     gtest
79     libxslt
80     pkg-config
81     rake
82   ] ++ optionals withGUI [ wrapQtAppsHook ];
84   # qtbase and qtmultimedia are needed without the GUI
85   buildInputs =
86     [
87       boost
88       expat
89       file
90       flac
91       fmt
92       gmp
93       libdvdread
94       libebml
95       libmatroska
96       libogg
97       libvorbis
98       nlohmann_json
99       pugixml
100       qtbase
101       qtmultimedia
102       utf8cpp
103       xdg-utils
104       zlib
105     ]
106     ++ optionals withGUI [ cmark ]
107     ++ optionals stdenv.hostPlatform.isLinux [ qtwayland ];
109   # autoupdate is not needed but it silences a ton of pointless warnings
110   postPatch = ''
111     patchShebangs . > /dev/null
112     autoupdate configure.ac ac/*.m4
113   '';
115   configureFlags = [
116     "--disable-debug"
117     "--disable-precompiled-headers"
118     "--disable-profiling"
119     "--disable-static-qt"
120     "--disable-update-check"
121     "--enable-optimization"
122     "--with-boost-libdir=${getLib boost}/lib"
123     "--with-docbook-xsl-root=${docbook_xsl}/share/xml/docbook-xsl"
124     "--with-gettext"
125     "--with-extra-includes=${getDev utf8cpp}/include/utf8cpp"
126     "--with-extra-libs=${getLib utf8cpp}/lib"
127     (enableFeature withGUI "gui")
128   ];
130   buildPhase = phase "Build" "";
132   installPhase = phase "Install" "install";
134   doCheck = true;
136   checkPhase = phase "Check" "tests:run_unit";
138   dontWrapQtApps = true;
140   postFixup = optionalString withGUI ''
141     wrapQtApp $out/bin/mkvtoolnix-gui
142   '';
144   meta = with lib; {
145     description = "Cross-platform tools for Matroska";
146     homepage = "https://mkvtoolnix.download/";
147     license = licenses.gpl2Only;
148     mainProgram = if withGUI then "mkvtoolnix-gui" else "mkvtoolnix";
149     maintainers = with maintainers; [
150       codyopel
151       rnhmjoj
152     ];
153     platforms = platforms.unix;
154   };