From 59b66edba7e5cfd62eea5d01c95cf10a7a764762 Mon Sep 17 00:00:00 2001 From: polygon Date: Thu, 10 Jun 2021 00:36:36 +0200 Subject: [PATCH] mlt: Add option to build python bindings Python bindings are required for flowblade package Also updated licenses according to copying information --- pkgs/development/libraries/mlt/default.nix | 19 ++++++++++++++----- pkgs/top-level/python-packages.nix | 5 +++++ 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/pkgs/development/libraries/mlt/default.nix b/pkgs/development/libraries/mlt/default.nix index 021dc1c3d95f..26c624668a59 100644 --- a/pkgs/development/libraries/mlt/default.nix +++ b/pkgs/development/libraries/mlt/default.nix @@ -2,6 +2,7 @@ , SDL, ffmpeg, frei0r, libjack2, libdv, libsamplerate, libexif , libvorbis, libxml2, movit, pkg-config, sox, fftw, opencv4, SDL2 , gtk2, genericUpdater, common-updater-scripts, libebur128 +, swig, which, ncurses, enablePython ? false, python }: stdenv.mkDerivation rec { @@ -17,17 +18,20 @@ stdenv.mkDerivation rec { buildInputs = [ SDL ffmpeg frei0r libjack2 libdv libsamplerate libvorbis libxml2 - makeWrapper movit pkg-config sox libexif gtk2 fftw libebur128 - opencv4 SDL2 - ]; + movit sox libexif gtk2 fftw libebur128 opencv4 SDL2 + ] ++ lib.optional enablePython ncurses; + + nativeBuildInputs = [ pkg-config makeWrapper ] + ++ lib.optionals enablePython [ which python swig ]; # Mostly taken from: # http://www.kdenlive.org/user-manual/downloading-and-installing-kdenlive/installing-source/installing-mlt-rendering-engine configureFlags = [ "--avformat-swscale" "--enable-gpl" "--enable-gpl3" "--enable-opengl" - ]; + ] ++ lib.optional enablePython "--swig-languages=python"; enableParallelBuilding = true; + outPythonPath = lib.optionalString enablePython "$(toPythonPath $out)"; postInstall = '' wrapProgram $out/bin/melt --prefix FREI0R_PATH : ${frei0r}/lib/frei0r-1 @@ -36,6 +40,11 @@ stdenv.mkDerivation rec { s=${movit.dev}/include t=$(for ((i = 0; i < ''${#s}; i++)); do echo -n X; done) sed -i $out/lib/mlt/libmltopengl.so -e "s|$s|$t|g" + '' + lib.optionalString enablePython '' + mkdir -p ${outPythonPath}/mlt + cp -a src/swig/python/_mlt.so ${outPythonPath}/mlt/ + cp -a src/swig/python/mlt.py ${outPythonPath}/mlt/__init__.py + sed -i ${outPythonPath}/mlt/__init__.py -e "s|return importlib.import_module('_mlt')|return importlib.import_module('mlt._mlt')|g" ''; passthru.updateScript = genericUpdater { @@ -47,7 +56,7 @@ stdenv.mkDerivation rec { meta = with lib; { description = "Open source multimedia framework, designed for television broadcasting"; homepage = "https://www.mltframework.org"; - license = licenses.gpl3; + license = with licenses; [ gpl3Only gpl2Only lgpl21Only ]; maintainers = with maintainers; [ tohl peti ]; platforms = platforms.linux; }; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 1839e598a155..3758b2cac967 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -4373,6 +4373,11 @@ in { mlxtend = callPackage ../development/python-modules/mlxtend { }; + mlt = toPythonModule (pkgs.mlt.override { + inherit python; + enablePython = true; + }); + mmh3 = callPackage ../development/python-modules/mmh3 { }; mmpython = callPackage ../development/python-modules/mmpython { };