From 4d3920996105278ffa6c2a88e78afb6243bef719 Mon Sep 17 00:00:00 2001 From: Austin Seipp Date: Tue, 3 Dec 2019 13:41:28 -0600 Subject: [PATCH] mimalloc: un-break dynamic linking Previous versions of the build assumed libmimalloc.so would be a hard copy of mimalloc-secure.so iff secureBuild == true, but in 1.1.0 and later it seems libmimalloc.so is a symlink to the -secure variant. This apparently rectifies some behavior I noticed that was strange previously. This breakage wasn't caught because the 1.1.0 update was automatic in 5596317d4; there should be a checkPhase to ensure this doesn't happen again... Signed-off-by: Austin Seipp --- pkgs/development/libraries/mimalloc/default.nix | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/pkgs/development/libraries/mimalloc/default.nix b/pkgs/development/libraries/mimalloc/default.nix index 460be100b166..17b53c88e9fb 100644 --- a/pkgs/development/libraries/mimalloc/default.nix +++ b/pkgs/development/libraries/mimalloc/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchFromGitHub, cmake +{ stdenv, fetchFromGitHub, cmake, ninja , secureBuild ? true }: @@ -6,32 +6,33 @@ let soext = stdenv.hostPlatform.extensions.sharedLibrary; in stdenv.mkDerivation rec { - name = "mimalloc-${version}"; + pname = "mimalloc"; version = "1.1.0"; src = fetchFromGitHub { owner = "microsoft"; - repo = "mimalloc"; + repo = pname; rev = "refs/tags/v${version}"; sha256 = "1i8pwzpcmbf7dxncb984xrnczn1737xqhf1jaizlyw0k1hpiam4v"; }; - nativeBuildInputs = [ cmake ]; + nativeBuildInputs = [ cmake ninja ]; enableParallelBuilding = true; - cmakeFlags = stdenv.lib.optional secureBuild [ "-DMI_SECURE=ON" ]; postInstall = '' + # first, install headers, that's easy mkdir -p $dev mv $out/lib/*/include $dev/include - rm -f $out/lib/libmimalloc*${soext} # weird duplicate - + # move everything else into place 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-* + # remote duplicate dir. FIXME: try to fix the .cmake file distribution + # so we can re-use it for dependencies... + rm -r $out/lib/mimalloc-1.0/ ''; outputs = [ "out" "dev" ];