nixpkgs/pkgs/tools/compression/lz4/default.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
Part of: https://github.com/NixOS/nixpkgs/issues/108938

meta = with stdenv.lib;

is a widely used pattern. We want to slowly remove
the `stdenv.lib` indirection and encourage people
to use `lib` directly. Thus let’s start with the meta
field.

This used a rewriting script to mostly automatically
replace all occurances of this pattern, and add the
`lib` argument to the package header if it doesn’t
exist yet.

The script in its current form is available at
https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
2021-01-11 10:38:22 +01:00

62 lines
1.8 KiB
Nix

{ lib, stdenv, fetchFromGitHub, valgrind, fetchpatch
, enableStatic ? stdenv.hostPlatform.isStatic
, enableShared ? !stdenv.hostPlatform.isStatic
}:
stdenv.mkDerivation rec {
pname = "lz4";
version = "1.9.3";
src = fetchFromGitHub {
sha256 = "1w02kazh1fps3sji2sn89fz862j1199c5ajrqcgl1bnlxj09kcbz";
rev = "v${version}";
repo = pname;
owner = pname;
};
# TODO(@Ericson2314): Separate binaries and libraries
outputs = [ "bin" "out" "dev" ];
buildInputs = stdenv.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
++ stdenv.lib.optional stdenv.hostPlatform.isMinGW "TARGET_OS=MINGW"
;
doCheck = false; # tests take a very long time
checkTarget = "test";
# TODO(@Ericson2314): Make resusable setup hook for this issue on Windows.
postInstall =
stdenv.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 = ''
Very fast lossless compression algorithm, providing compression speed
at 400 MB/s per core, with near-linear scalability for multi-threaded
applications. It also features an extremely fast decoder, with speed in
multiple GB/s per core, typically reaching RAM speed limits on
multi-core systems.
'';
homepage = "https://lz4.github.io/lz4/";
license = with licenses; [ bsd2 gpl2Plus ];
platforms = platforms.all;
};
}