From 74ff7795ceefa34f76568e6bffabd6f7ce6c8718 Mon Sep 17 00:00:00 2001 From: Weijia Wang <9713184+wegank@users.noreply.github.com> Date: Tue, 27 Jun 2023 12:11:08 +0300 Subject: [PATCH] libsForQt5.mlt: refactor, add darwin support --- pkgs/development/libraries/mlt/qt-5.nix | 84 +++++++++++++++---------- pkgs/top-level/qt5-packages.nix | 4 +- 2 files changed, 54 insertions(+), 34 deletions(-) diff --git a/pkgs/development/libraries/mlt/qt-5.nix b/pkgs/development/libraries/mlt/qt-5.nix index dce5f18c4fb6..60ec139d0c04 100644 --- a/pkgs/development/libraries/mlt/qt-5.nix +++ b/pkgs/development/libraries/mlt/qt-5.nix @@ -1,34 +1,41 @@ { config , lib +, stdenv , fetchFromGitHub , cmake -, SDL +, pkg-config +, which +, wrapQtAppsHook +, SDL2 , ffmpeg +, fftw , frei0r -, libjack2 , libdv +, libjack2 , libsamplerate , libvorbis , libxml2 , movit -, pkg-config -, sox +, opencv4 , qtbase , qtsvg -, fftw -, vid-stab -, opencv4 -, ladspa-sdk -, gitUpdater -, ladspaPlugins +, rtaudio , rubberband -, mkDerivation -, which +, sox +, vid-stab +, darwin , cudaSupport ? config.cudaSupport or false -, cudaPackages ? {} +, cudaPackages ? { } +, jackrackSupport ? stdenv.isLinux +, ladspa-sdk +, ladspaPlugins +, pythonSupport ? false +, python3 +, swig +, gitUpdater }: -mkDerivation rec { +stdenv.mkDerivation rec { pname = "mlt"; version = "7.16.0"; @@ -36,39 +43,47 @@ mkDerivation rec { owner = "mltframework"; repo = "mlt"; rev = "v${version}"; - sha256 = "sha256-Ed9CHaeJ8Rkrvfq/dZVOn/5lhHLH7B6A1Qf2xOQfWik="; + hash = "sha256-Ed9CHaeJ8Rkrvfq/dZVOn/5lhHLH7B6A1Qf2xOQfWik="; }; + nativeBuildInputs = [ + cmake + pkg-config + which + wrapQtAppsHook + ] ++ lib.optionals cudaSupport [ + cudaPackages.cuda_nvcc + ] ++ lib.optionals pythonSupport [ + python3 + swig + ]; + buildInputs = [ - SDL + SDL2 ffmpeg + fftw frei0r - libjack2 libdv + libjack2 libsamplerate libvorbis libxml2 movit + opencv4 qtbase qtsvg + rtaudio + rubberband sox - fftw vid-stab - opencv4 + ] ++ lib.optionals stdenv.isDarwin [ + darwin.apple_sdk_11_0.frameworks.Accelerate + ] ++ lib.optionals cudaSupport [ + cudaPackages.cuda_cudart + ] ++ lib.optionals jackrackSupport [ ladspa-sdk ladspaPlugins - rubberband - ] ++ lib.optionals cudaSupport (with cudaPackages; [ - cuda_cudart - ]); - - nativeBuildInputs = [ - cmake - which - pkg-config - ] ++ lib.optionals cudaSupport (with cudaPackages; [ - cuda_nvcc - ]); + ]; outputs = [ "out" "dev" ]; @@ -76,10 +91,13 @@ mkDerivation rec { # RPATH of binary /nix/store/.../bin/... contains a forbidden reference to /build/ "-DCMAKE_SKIP_BUILD_RPATH=ON" "-DMOD_OPENCV=ON" + ] ++ lib.optionals pythonSupport [ + "-DSWIG_PYTHON=ON" ]; qtWrapperArgs = [ "--prefix FREI0R_PATH : ${frei0r}/lib/frei0r-1" + ] ++ lib.optionals jackrackSupport [ "--prefix LADSPA_PATH : ${ladspaPlugins}/lib/ladspa" ]; @@ -99,8 +117,8 @@ 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; [ lgpl21Plus gpl2Plus ]; maintainers = [ maintainers.goibhniu ]; - platforms = platforms.linux; + platforms = platforms.unix; }; } diff --git a/pkgs/top-level/qt5-packages.nix b/pkgs/top-level/qt5-packages.nix index 6de840951521..48a8d6f39778 100644 --- a/pkgs/top-level/qt5-packages.nix +++ b/pkgs/top-level/qt5-packages.nix @@ -154,7 +154,9 @@ in (kdeFrameworks // plasmaMobileGear // plasma5 // plasma5.thirdParty // kdeGea maui-core = libsForQt5.callPackage ../development/libraries/maui-core { }; - mlt = callPackage ../development/libraries/mlt/qt-5.nix { }; + mlt = callPackage ../development/libraries/mlt/qt-5.nix { + stdenv = if pkgs.stdenv.isDarwin then pkgs.darwin.apple_sdk_11_0.stdenv else pkgs.stdenv; + }; phonon = callPackage ../development/libraries/phonon { };