openxray: 2188-november-2023-rc1 -> 2921-january-2025-rc1 (#375925)
[NixPkgs.git] / pkgs / by-name / li / linenoise / package.nix
blobacf8cf3e258c59192f530a0a496600140a6577bc
2   lib,
3   stdenv,
4   fetchFromGitHub,
5   validatePkgConfig,
6   fixDarwinDylibNames,
7 }:
9 stdenv.mkDerivation {
10   pname = "linenoise";
11   version = "1.0-34-g93b2db9";
13   src = fetchFromGitHub {
14     owner = "antirez";
15     repo = "linenoise";
16     rev = "1.0-34-g93b2db9";
17     hash = "sha256-GsrYg16gpjHkkmpCU3yGzqNS/buZl+JoWALLvwzmT4A=";
18   };
20   nativeBuildInputs = [
21     validatePkgConfig
22   ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ fixDarwinDylibNames ];
24   buildPhase = ''
25     runHook preBuild
27     $CC -c -o linenoise.o linenoise.c
28     $CC -shared -o liblinenoise.so linenoise.o
29     $AR rcs liblinenoise.a linenoise.o
31     runHook postBuild
32   '';
34   installPhase = ''
35     runHook preInstall
37     install -d $out/lib/pkgconfig $out/include
38     install -m644 linenoise.h     $out/include/
39     install -m644 liblinenoise.a  $out/lib/
40     install -m644 liblinenoise.so $out/lib/
41     substituteAll ${./linenoise.pc.in} $out/lib/pkgconfig/linenoise.pc
43     runHook postInstall
44   '';
46   meta = {
47     homepage = "https://github.com/antirez/linenoise";
48     description = "Minimal, zero-config, BSD licensed, readline replacement";
49     maintainers = with lib.maintainers; [
50       fstamour
51       remexre
52     ];
53     platforms = lib.platforms.unix;
54     license = lib.licenses.bsd2;
55   };