1{ 2 lib, 3 stdenv, 4}: 5 6# Implementation notes 7 8# The patch exploits the fact that the download part is enclosed with "# ---" 9# To use this module you will need to pass the CMake variable MIMALLOC_LIB 10# example: -DMIMALLOC_LIB=${pkgs.mimalloc}/lib/mimalloc.o 11 12# Direct link for the original CMakeLists.txt: https://raw.githubusercontent.com/media-kit/media-kit/main/libs/linux/media_kit_libs_linux/linux/CMakeLists.txt 13 14{ version, src, ... }: 15 16stdenv.mkDerivation { 17 pname = "media_kit_libs_linux"; 18 inherit version src; 19 inherit (src) passthru; 20 21 dontBuild = true; 22 23 postPatch = 24 lib.optionalString (lib.versionAtLeast version "1.2.1") '' 25 sed -i '/if(MIMALLOC_USE_STATIC_LIBS)/,/unset(MIMALLOC_USE_STATIC_LIBS CACHE)/d' linux/CMakeLists.txt 26 '' 27 + lib.optionalString (lib.versionOlder version "1.2.1") '' 28 awk -i inplace 'BEGIN {opened = 0}; /# --*[^$]*/ { print (opened ? "]===]" : "#[===["); opened = !opened }; {print $0}' linux/CMakeLists.txt 29 ''; 30 31 installPhase = '' 32 runHook preInstall 33 34 cp -r . $out 35 36 runHook postInstall 37 ''; 38}