summary refs log tree commit diff
path: root/pkgs/development/libraries/mlt
diff options
context:
space:
mode:
authorpolygon <polygon@wh2.tu-dresden.de>2021-06-10 00:36:36 +0200
committerpolygon <polygon@wh2.tu-dresden.de>2021-06-15 12:43:25 +0200
commit59b66edba7e5cfd62eea5d01c95cf10a7a764762 (patch)
treecf17237bb2fa596dfbd3d7d69d3f4fc3409b2ceb /pkgs/development/libraries/mlt
parent58fbce466b0172a03f519dccda6e3acbe0f61aa6 (diff)
downloadnixpkgs-59b66edba7e5cfd62eea5d01c95cf10a7a764762.tar
nixpkgs-59b66edba7e5cfd62eea5d01c95cf10a7a764762.tar.gz
nixpkgs-59b66edba7e5cfd62eea5d01c95cf10a7a764762.tar.bz2
nixpkgs-59b66edba7e5cfd62eea5d01c95cf10a7a764762.tar.lz
nixpkgs-59b66edba7e5cfd62eea5d01c95cf10a7a764762.tar.xz
nixpkgs-59b66edba7e5cfd62eea5d01c95cf10a7a764762.tar.zst
nixpkgs-59b66edba7e5cfd62eea5d01c95cf10a7a764762.zip
mlt: Add option to build python bindings
Python bindings are required for flowblade package
Also updated licenses according to copying information
Diffstat (limited to 'pkgs/development/libraries/mlt')
-rw-r--r--pkgs/development/libraries/mlt/default.nix19
1 files changed, 14 insertions, 5 deletions
diff --git a/pkgs/development/libraries/mlt/default.nix b/pkgs/development/libraries/mlt/default.nix
index 021dc1c3d95..26c624668a5 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;
   };