lol
1{ lib, stdenv, fetchFromGitHub, makeWrapper
2, SDL, ffmpeg, frei0r, libjack2, libdv, libsamplerate, libexif
3, libvorbis, libxml2, movit, pkg-config, sox, fftw, opencv4, SDL2
4, gtk2, genericUpdater, common-updater-scripts, libebur128
5, jack2, ladspa-sdk, swig, which, ncurses
6, enablePython ? false, python3
7}:
8
9stdenv.mkDerivation rec {
10 pname = "mlt";
11 version = "6.26.0";
12
13 src = fetchFromGitHub {
14 owner = "mltframework";
15 repo = "mlt";
16 rev = "v${version}";
17 sha256 = "FPXROiX7A6oB1VMipw3slyhk7q4fO6m9amohnC67lnA=";
18 };
19
20 buildInputs = [
21 SDL ffmpeg frei0r libjack2 libdv libsamplerate libvorbis libxml2.dev
22 movit sox libexif gtk2 fftw libebur128 opencv4 SDL2 jack2
23 ladspa-sdk
24 ] ++ lib.optional enablePython ncurses;
25
26 nativeBuildInputs = [ pkg-config makeWrapper which ]
27 ++ lib.optionals enablePython [ python3 swig ];
28
29 strictDeps = true;
30
31 # Mostly taken from:
32 # http://www.kdenlive.org/user-manual/downloading-and-installing-kdenlive/installing-source/installing-mlt-rendering-engine
33 configureFlags = [
34 "--avformat-swscale" "--enable-gpl" "--enable-gpl3" "--enable-opengl"
35 ] ++ lib.optional enablePython "--swig-languages=python";
36
37 enableParallelBuilding = true;
38 outPythonPath = lib.optionalString enablePython "$(toPythonPath $out)";
39
40 postInstall = ''
41 wrapProgram $out/bin/melt --prefix FREI0R_PATH : ${frei0r}/lib/frei0r-1
42
43 # Remove an unnecessary reference to movit.dev.
44 s=${movit.dev}/include
45 t=$(for ((i = 0; i < ''${#s}; i++)); do echo -n X; done)
46 sed -i $out/lib/mlt/libmltopengl.so -e "s|$s|$t|g"
47 '' + lib.optionalString enablePython ''
48 mkdir -p ${outPythonPath}/mlt
49 cp -a src/swig/python/_mlt.so ${outPythonPath}/mlt/
50 cp -a src/swig/python/mlt.py ${outPythonPath}/mlt/__init__.py
51 sed -i ${outPythonPath}/mlt/__init__.py -e "s|return importlib.import_module('_mlt')|return importlib.import_module('mlt._mlt')|g"
52 '';
53
54 passthru.updateScript = genericUpdater {
55 inherit pname version;
56 versionLister = "${common-updater-scripts}/bin/list-git-tags ${src.meta.homepage}";
57 rev-prefix = "v";
58 };
59
60 meta = with lib; {
61 description = "Open source multimedia framework, designed for television broadcasting";
62 homepage = "https://www.mltframework.org";
63 license = with licenses; [ gpl3Only gpl2Only lgpl21Only ];
64 maintainers = with maintainers; [ tohl peti ];
65 platforms = platforms.linux;
66 };
67}