mlt: Add option to build python bindings

Python bindings are required for flowblade package
Also updated licenses according to copying information
This commit is contained in:
polygon 2021-06-10 00:36:36 +02:00
parent 58fbce466b
commit 59b66edba7
2 changed files with 19 additions and 5 deletions

View file

@ -2,6 +2,7 @@
, SDL, ffmpeg, frei0r, libjack2, libdv, libsamplerate, libexif , SDL, ffmpeg, frei0r, libjack2, libdv, libsamplerate, libexif
, libvorbis, libxml2, movit, pkg-config, sox, fftw, opencv4, SDL2 , libvorbis, libxml2, movit, pkg-config, sox, fftw, opencv4, SDL2
, gtk2, genericUpdater, common-updater-scripts, libebur128 , gtk2, genericUpdater, common-updater-scripts, libebur128
, swig, which, ncurses, enablePython ? false, python
}: }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
@ -17,17 +18,20 @@ stdenv.mkDerivation rec {
buildInputs = [ buildInputs = [
SDL ffmpeg frei0r libjack2 libdv libsamplerate libvorbis libxml2 SDL ffmpeg frei0r libjack2 libdv libsamplerate libvorbis libxml2
makeWrapper movit pkg-config sox libexif gtk2 fftw libebur128 movit sox libexif gtk2 fftw libebur128 opencv4 SDL2
opencv4 SDL2 ] ++ lib.optional enablePython ncurses;
];
nativeBuildInputs = [ pkg-config makeWrapper ]
++ lib.optionals enablePython [ which python swig ];
# Mostly taken from: # Mostly taken from:
# http://www.kdenlive.org/user-manual/downloading-and-installing-kdenlive/installing-source/installing-mlt-rendering-engine # http://www.kdenlive.org/user-manual/downloading-and-installing-kdenlive/installing-source/installing-mlt-rendering-engine
configureFlags = [ configureFlags = [
"--avformat-swscale" "--enable-gpl" "--enable-gpl3" "--enable-opengl" "--avformat-swscale" "--enable-gpl" "--enable-gpl3" "--enable-opengl"
]; ] ++ lib.optional enablePython "--swig-languages=python";
enableParallelBuilding = true; enableParallelBuilding = true;
outPythonPath = lib.optionalString enablePython "$(toPythonPath $out)";
postInstall = '' postInstall = ''
wrapProgram $out/bin/melt --prefix FREI0R_PATH : ${frei0r}/lib/frei0r-1 wrapProgram $out/bin/melt --prefix FREI0R_PATH : ${frei0r}/lib/frei0r-1
@ -36,6 +40,11 @@ stdenv.mkDerivation rec {
s=${movit.dev}/include s=${movit.dev}/include
t=$(for ((i = 0; i < ''${#s}; i++)); do echo -n X; done) t=$(for ((i = 0; i < ''${#s}; i++)); do echo -n X; done)
sed -i $out/lib/mlt/libmltopengl.so -e "s|$s|$t|g" 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 { passthru.updateScript = genericUpdater {
@ -47,7 +56,7 @@ stdenv.mkDerivation rec {
meta = with lib; { meta = with lib; {
description = "Open source multimedia framework, designed for television broadcasting"; description = "Open source multimedia framework, designed for television broadcasting";
homepage = "https://www.mltframework.org"; homepage = "https://www.mltframework.org";
license = licenses.gpl3; license = with licenses; [ gpl3Only gpl2Only lgpl21Only ];
maintainers = with maintainers; [ tohl peti ]; maintainers = with maintainers; [ tohl peti ];
platforms = platforms.linux; platforms = platforms.linux;
}; };

View file

@ -4373,6 +4373,11 @@ in {
mlxtend = callPackage ../development/python-modules/mlxtend { }; mlxtend = callPackage ../development/python-modules/mlxtend { };
mlt = toPythonModule (pkgs.mlt.override {
inherit python;
enablePython = true;
});
mmh3 = callPackage ../development/python-modules/mmh3 { }; mmh3 = callPackage ../development/python-modules/mmh3 { };
mmpython = callPackage ../development/python-modules/mmpython { }; mmpython = callPackage ../development/python-modules/mmpython { };