diff --git a/pkgs/development/libraries/mimalloc/default.nix b/pkgs/development/libraries/mimalloc/default.nix new file mode 100644 index 000000000000..728b41176766 --- /dev/null +++ b/pkgs/development/libraries/mimalloc/default.nix @@ -0,0 +1,46 @@ +{ stdenv, fetchFromGitHub, cmake +, secureBuild ? true +}: + +let + soext = stdenv.hostPlatform.extensions.sharedLibrary; +in +stdenv.mkDerivation rec { + name = "mimalloc-${version}"; + version = "1.0.8"; + + src = fetchFromGitHub { + owner = "microsoft"; + repo = "mimalloc"; + rev = "refs/tags/v${version}"; + sha256 = "04k2d3x84q2jfqdjxngy98hlw6czmigsqlf7gi3mhs6682n127r5"; + }; + + nativeBuildInputs = [ cmake ]; + enableParallelBuilding = true; + + cmakeFlags = stdenv.lib.optional secureBuild [ "-DMI_SECURE=ON" ]; + + postInstall = '' + mkdir -p $dev + mv $out/lib/*/include $dev/include + + rm -f $out/lib/libmimalloc*${soext} # weird duplicate + + mv $out/lib/*/libmimalloc*${soext} $out/lib/libmimalloc${soext} + mv $out/lib/*/libmimalloc*.a $out/lib/libmimalloc.a + mv $out/lib/*/mimalloc*.o $out/lib/mimalloc.o + + rm -rf $out/lib/mimalloc-* + ''; + + outputs = [ "out" "dev" ]; + + meta = with stdenv.lib; { + description = "Compact, fast, general-purpose memory allocator"; + homepage = "https://github.com/microsoft/mimalloc"; + license = licenses.bsd2; + platforms = platforms.unix; + maintainers = with maintainers; [ thoughtpolice ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 4b95d340af84..3fa376c45126 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -12700,6 +12700,8 @@ in microsoft_gsl = callPackage ../development/libraries/microsoft_gsl { }; + mimalloc = callPackage ../development/libraries/mimalloc { }; + minizip = callPackage ../development/libraries/minizip { }; mkvtoolnix = libsForQt5.callPackage ../applications/video/mkvtoolnix { };