mimalloc: 1.1.0 -> 1.6.1

This commit is contained in:
ajs124 2020-02-18 03:57:05 +01:00 committed by Austin Seipp
parent 7829fb70bb
commit 194f3aa4b5

View file

@ -7,39 +7,42 @@ let
in
stdenv.mkDerivation rec {
pname = "mimalloc";
version = "1.1.0";
version = "1.6.1";
src = fetchFromGitHub {
owner = "microsoft";
repo = pname;
rev = "refs/tags/v${version}";
sha256 = "1i8pwzpcmbf7dxncb984xrnczn1737xqhf1jaizlyw0k1hpiam4v";
rev = "v${version}";
sha256 = "1zql498587wvb0gaavnzxj2zm535sgm22x0sjgl4ncfk7ragnv9c";
};
nativeBuildInputs = [ cmake ninja ];
enableParallelBuilding = true;
cmakeFlags = stdenv.lib.optional secureBuild [ "-DMI_SECURE=ON" ];
postInstall = ''
postInstall = let
rel = stdenv.lib.versions.majorMinor version;
in ''
# first, install headers, that's easy
mkdir -p $dev
mv $out/lib/*/include $dev/include
# move .a and .o files into place
mv $out/lib/mimalloc-1.0/libmimalloc*.a $out/lib/libmimalloc.a
mv $out/lib/mimalloc-1.0/mimalloc*.o $out/lib/mimalloc.o
find $out/lib
mv $out/lib/mimalloc-${rel}/libmimalloc*.a $out/lib/libmimalloc.a
mv $out/lib/mimalloc-${rel}/mimalloc*.o $out/lib/mimalloc.o
'' + (if secureBuild then ''
mv $out/lib/mimalloc-1.0/libmimalloc-secure${soext}.1.0 $out/lib/libmimalloc-secure${soext}.1.0
ln -sfv $out/lib/libmimalloc-secure${soext}.1.0 $out/lib/libmimalloc-secure${soext}
ln -sfv $out/lib/libmimalloc-secure${soext}.1.0 $out/lib/libmimalloc${soext}
mv $out/lib/mimalloc-${rel}/libmimalloc-secure${soext}.${rel} $out/lib/libmimalloc-secure${soext}.${rel}
ln -sfv $out/lib/libmimalloc-secure${soext}.${rel} $out/lib/libmimalloc-secure${soext}
ln -sfv $out/lib/libmimalloc-secure${soext}.${rel} $out/lib/libmimalloc${soext}
'' else ''
mv $out/lib/mimalloc-1.0/libmimalloc${soext}.1.0 $out/lib/libmimalloc${soext}.1.0
ln -sfv $out/lib/libmimalloc${soext}.1.0 $out/lib/libmimalloc${soext}
mv $out/lib/mimalloc-${rel}/libmimalloc${soext}.${rel} $out/lib/libmimalloc${soext}.${rel}
ln -sfv $out/lib/libmimalloc${soext}.${rel} $out/lib/libmimalloc${soext}
'') + ''
# remote duplicate dir. FIXME: try to fix the .cmake file distribution
# so we can re-use it for dependencies...
rm -rf $out/lib/mimalloc-1.0
rm -rf $out/lib/mimalloc-${rel}
'';
outputs = [ "out" "dev" ];
@ -50,5 +53,6 @@ stdenv.mkDerivation rec {
license = licenses.bsd2;
platforms = platforms.unix;
maintainers = with maintainers; [ thoughtpolice ];
badPlatforms = platforms.darwin;
};
}