mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-18 15:56:50 +01:00
mimalloc: make use of MI_INSTALL_TOPLEVEL
Fixes: - Gross file moving in postInstall (maintenance burden) - Usability of CMake files Also enables check phase
This commit is contained in:
parent
13034ba77a
commit
58e6fa615a
1 changed files with 15 additions and 21 deletions
|
@ -17,41 +17,35 @@ stdenv.mkDerivation rec {
|
|||
};
|
||||
|
||||
nativeBuildInputs = [ cmake ninja ];
|
||||
cmakeFlags = lib.optional secureBuild [ "-DMI_SECURE=ON" ];
|
||||
cmakeFlags = [ "-DMI_INSTALL_TOPLEVEL=ON" ] ++ lib.optional secureBuild [ "-DMI_SECURE=ON" ];
|
||||
|
||||
postInstall = let
|
||||
rel = lib.versions.majorMinor version;
|
||||
suffix = if stdenv.isLinux then "${soext}.${rel}" else ".${rel}${soext}";
|
||||
in ''
|
||||
# first, install headers, that's easy
|
||||
mkdir -p $dev
|
||||
mv $out/lib/*/include $dev/include
|
||||
# first, move headers and cmake files, that's easy
|
||||
mkdir -p $dev/lib
|
||||
mv $out/include $dev/include
|
||||
mv $out/cmake $dev/lib/
|
||||
|
||||
# move .a and .o files into place
|
||||
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-${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-${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-${rel}
|
||||
'';
|
||||
'' + (lib.optionalString secureBuild ''
|
||||
# pretend we're normal mimalloc
|
||||
ln -sfv $out/lib/libmimalloc-secure${suffix} $out/lib/libmimalloc${suffix}
|
||||
ln -sfv $out/lib/libmimalloc-secure${suffix} $out/lib/libmimalloc${soext}
|
||||
ln -sfv $out/lib/libmimalloc-secure.a $out/lib/libmimalloc.a
|
||||
ln -sfv $out/lib/mimalloc-secure.o $out/lib/mimalloc.o
|
||||
'');
|
||||
|
||||
outputs = [ "out" "dev" ];
|
||||
|
||||
doCheck = true;
|
||||
|
||||
meta = with lib; {
|
||||
description = "Compact, fast, general-purpose memory allocator";
|
||||
homepage = "https://github.com/microsoft/mimalloc";
|
||||
license = licenses.bsd2;
|
||||
platforms = platforms.unix;
|
||||
maintainers = with maintainers; [ thoughtpolice ];
|
||||
badPlatforms = platforms.darwin;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue