Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 157 lines 3.2 kB view raw
1{ 2 config, 3 lib, 4 stdenv, 5 fetchFromGitHub, 6 cmake, 7 pkg-config, 8 which, 9 ffmpeg, 10 fftw, 11 frei0r, 12 libdv, 13 libjack2, 14 libsamplerate, 15 libvorbis, 16 libxml2, 17 libX11, 18 makeWrapper, 19 movit, 20 opencv4, 21 rtaudio, 22 rubberband, 23 sox, 24 vid-stab, 25 cudaSupport ? config.cudaSupport, 26 cudaPackages ? { }, 27 enableJackrack ? stdenv.hostPlatform.isLinux, 28 glib, 29 ladspa-sdk, 30 ladspaPlugins, 31 enablePython ? false, 32 python3, 33 swig, 34 qt ? null, 35 enableSDL2 ? true, 36 SDL2, 37 gitUpdater, 38 libarchive, 39}: 40 41stdenv.mkDerivation rec { 42 pname = "mlt"; 43 version = "7.30.0"; 44 45 src = fetchFromGitHub { 46 owner = "mltframework"; 47 repo = "mlt"; 48 rev = "v${version}"; 49 hash = "sha256-z1bW+hcVeMeibC1PUS5XNpbkNB+75YLoOWZC2zuDol4="; 50 # The submodule contains glaxnimate code, since MLT uses internally some functions defined in glaxnimate. 51 # Since glaxnimate is not available as a library upstream, we cannot remove for now this dependency on 52 # submodules until upstream exports glaxnimate as a library: https://gitlab.com/mattbas/glaxnimate/-/issues/545 53 fetchSubmodules = true; 54 }; 55 56 nativeBuildInputs = [ 57 cmake 58 pkg-config 59 which 60 makeWrapper 61 ] 62 ++ lib.optionals cudaSupport [ 63 cudaPackages.cuda_nvcc 64 ] 65 ++ lib.optionals enablePython [ 66 python3 67 swig 68 ] 69 ++ lib.optionals (qt != null) [ 70 qt.wrapQtAppsHook 71 ]; 72 73 buildInputs = [ 74 (opencv4.override { inherit ffmpeg; }) 75 ffmpeg 76 fftw 77 frei0r 78 libdv 79 libjack2 80 libsamplerate 81 libvorbis 82 libxml2 83 movit 84 rtaudio 85 rubberband 86 sox 87 vid-stab 88 ] 89 ++ lib.optionals cudaSupport [ 90 cudaPackages.cuda_cudart 91 ] 92 ++ lib.optionals enableJackrack [ 93 glib 94 ladspa-sdk 95 ladspaPlugins 96 ] 97 ++ lib.optionals (qt != null) [ 98 qt.qtbase 99 qt.qtsvg 100 (qt.qt5compat or null) 101 libarchive 102 ] 103 ++ lib.optionals enableSDL2 [ 104 SDL2 105 libX11 106 ]; 107 108 outputs = [ 109 "out" 110 "dev" 111 ]; 112 113 cmakeFlags = [ 114 # RPATH of binary /nix/store/.../bin/... contains a forbidden reference to /build/ 115 "-DCMAKE_SKIP_BUILD_RPATH=ON" 116 "-DMOD_OPENCV=ON" 117 ] 118 ++ lib.optionals enablePython [ 119 "-DSWIG_PYTHON=ON" 120 ] 121 ++ lib.optionals (qt != null) [ 122 "-DMOD_QT${lib.versions.major qt.qtbase.version}=ON" 123 "-DMOD_GLAXNIMATE${if lib.versions.major qt.qtbase.version == "5" then "" else "_QT6"}=ON" 124 ]; 125 126 preFixup = '' 127 wrapProgram $out/bin/melt \ 128 --prefix FREI0R_PATH : ${frei0r}/lib/frei0r-1 \ 129 ${lib.optionalString enableJackrack "--prefix LADSPA_PATH : ${ladspaPlugins}/lib/ladspa"} \ 130 ${lib.optionalString (qt != null) "\${qtWrapperArgs[@]}"} 131 132 ''; 133 134 postFixup = '' 135 substituteInPlace "$dev"/lib/pkgconfig/mlt-framework-7.pc \ 136 --replace '=''${prefix}//' '=/' 137 ''; 138 139 passthru = { 140 inherit ffmpeg; 141 }; 142 143 passthru.updateScript = gitUpdater { 144 rev-prefix = "v"; 145 }; 146 147 meta = with lib; { 148 description = "Open source multimedia framework, designed for television broadcasting"; 149 homepage = "https://www.mltframework.org/"; 150 license = with licenses; [ 151 lgpl21Plus 152 gpl2Plus 153 ]; 154 maintainers = [ ]; 155 platforms = platforms.unix; 156 }; 157}