2024-02-07 01:22:34 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, validatePkgConfig
|
2024-09-19 14:19:46 +00:00
|
|
|
, fixDarwinDylibNames
|
2024-02-07 01:22:34 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
pname = "linenoise";
|
2024-02-07 01:22:34 +00:00
|
|
|
version = "1.0-34-g93b2db9";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "antirez";
|
|
|
|
repo = "linenoise";
|
2024-02-07 01:22:34 +00:00
|
|
|
rev = "1.0-34-g93b2db9";
|
|
|
|
hash = "sha256-GsrYg16gpjHkkmpCU3yGzqNS/buZl+JoWALLvwzmT4A=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
nativeBuildInputs = [ validatePkgConfig ]
|
2024-09-26 11:04:55 +00:00
|
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin [ fixDarwinDylibNames ];
|
2024-02-07 01:22:34 +00:00
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
|
|
|
|
|
|
|
$CC -c -o linenoise.o linenoise.c
|
|
|
|
$CC -shared -o liblinenoise.so linenoise.o
|
|
|
|
$AR rcs liblinenoise.a linenoise.o
|
|
|
|
|
|
|
|
runHook postBuild
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
2024-02-07 01:22:34 +00:00
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
install -d $out/lib/pkgconfig $out/include
|
|
|
|
install -m644 linenoise.h $out/include/
|
|
|
|
install -m644 liblinenoise.a $out/lib/
|
|
|
|
install -m644 liblinenoise.so $out/lib/
|
|
|
|
substituteAll ${./linenoise.pc.in} $out/lib/pkgconfig/linenoise.pc
|
|
|
|
|
|
|
|
runHook postInstall
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
homepage = "https://github.com/antirez/linenoise";
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Minimal, zero-config, BSD licensed, readline replacement";
|
2024-02-07 01:22:34 +00:00
|
|
|
maintainers = with lib.maintainers; [ fstamour remexre ];
|
2021-02-05 17:12:51 +00:00
|
|
|
platforms = lib.platforms.unix;
|
|
|
|
license = lib.licenses.bsd2;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|