lz4: use CMake to build

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
Sefa Eyeoglu 2024-06-09 14:02:12 +02:00
parent afa876d6fe
commit ead868553b
No known key found for this signature in database
GPG Key ID: E13DFD4B47127951

View File

@ -1,6 +1,5 @@
{ lib, stdenv, fetchFromGitHub, fetchpatch, valgrind
, enableStatic ? stdenv.hostPlatform.isStatic
, enableShared ? !stdenv.hostPlatform.isStatic
{ lib, stdenv, fetchFromGitHub, fetchpatch, cmake
, valgrind
}:
stdenv.mkDerivation rec {
@ -14,6 +13,15 @@ stdenv.mkDerivation rec {
owner = pname;
};
nativeBuildInputs = [
cmake
];
buildInputs = lib.optional finalAttrs.doCheck valgrind;
# TODO(@Ericson2314): Separate binaries and libraries
outputs = [ "bin" "out" "dev" ];
patches = [
(fetchpatch { # https://github.com/lz4/lz4/pull/1162
name = "build-shared-no.patch";
@ -22,38 +30,12 @@ stdenv.mkDerivation rec {
})
];
# TODO(@Ericson2314): Separate binaries and libraries
outputs = [ "bin" "out" "dev" ];
buildInputs = lib.optional doCheck valgrind;
enableParallelBuilding = true;
makeFlags = [
"PREFIX=$(out)"
"INCLUDEDIR=$(dev)/include"
"BUILD_STATIC=${if enableStatic then "yes" else "no"}"
"BUILD_SHARED=${if enableShared then "yes" else "no"}"
"WINDRES:=${stdenv.cc.bintools.targetPrefix}windres"
]
# TODO make full dictionary
++ lib.optional stdenv.hostPlatform.isMinGW "TARGET_OS=MINGW"
++ lib.optional stdenv.hostPlatform.isLinux "TARGET_OS=Linux"
;
cmakeDir = "../build/cmake";
cmakeBuildDir = "build-dist";
doCheck = false; # tests take a very long time
checkTarget = "test";
# TODO(@Ericson2314): Make resusable setup hook for this issue on Windows.
postInstall =
lib.optionalString stdenv.hostPlatform.isWindows ''
mv $out/bin/*.dll $out/lib
ln -s $out/lib/*.dll
''
+ ''
moveToOutput bin "$bin"
'';
meta = with lib; {
description = "Extremely fast compression algorithm";
longDescription = ''