Merge pull request #276618 from remexre/fix-linenoise-pkgconfig

linenoise: 1.0.10 -> 1.0-34-g93b2db9
This commit is contained in:
Janik 2024-02-05 12:42:44 +01:00 committed by GitHub
commit 522f476e56
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 45 additions and 23 deletions

View file

@ -15896,6 +15896,12 @@
githubId = 801525;
name = "rembo10";
};
remexre = {
email = "nathan+nixpkgs@remexre.com";
github = "remexre";
githubId = 4196789;
name = "Nathan Ringo";
};
renatoGarcia = {
email = "fgarcia.renato@gmail.com";
github = "renatoGarcia";

View file

@ -1,13 +0,0 @@
cat <<EOF > linenoise.pc
prefix=$out
exec_prefix=\${prefix}
libdir=\${exec_prefix}/lib
includedir=\${prefix}/include
Name: linenoise
Description: A minimal, zero-config, BSD licensed, readline replacement.
Requires:
Version: 1.0.10
Cflags: -I\${includedir}/ \${prefix}/src/linenoise.c
EOF

View file

@ -1,29 +1,48 @@
{ lib, stdenv, fetchFromGitHub }:
{ lib
, stdenv
, fetchFromGitHub
, validatePkgConfig
}:
stdenv.mkDerivation {
pname = "linenoise";
version = "1.0.10"; # Its version 1.0 plus 10 commits
version = "1.0-34-g93b2db9";
src = fetchFromGitHub {
owner = "antirez";
repo = "linenoise";
rev = "c894b9e59f02203dbe4e2be657572cf88c4230c3";
sha256 = "0wasql7ph5g473zxhc2z47z3pjp42q0dsn4gpijwzbxawid71b4w";
rev = "1.0-34-g93b2db9";
hash = "sha256-GsrYg16gpjHkkmpCU3yGzqNS/buZl+JoWALLvwzmT4A=";
};
buildPhase = ./create-pkg-config-file.sh;
nativeBuildInputs = [ validatePkgConfig ];
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
'';
installPhase = ''
mkdir -p $out/{lib/pkgconfig,src,include}
cp linenoise.c $out/src/
cp linenoise.h $out/include/
cp linenoise.pc $out/lib/pkgconfig/
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
'';
meta = {
homepage = "https://github.com/antirez/linenoise";
description = "A minimal, zero-config, BSD licensed, readline replacement";
maintainers = with lib.maintainers; [ fstamour ];
maintainers = with lib.maintainers; [ fstamour remexre ];
platforms = lib.platforms.unix;
license = lib.licenses.bsd2;
};

View file

@ -0,0 +1,10 @@
prefix=@out@
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: linenoise
Description: A minimal, zero-config, BSD licensed, readline replacement.
Version: @version@
Libs: -L${libdir} -llinenoise
Cflags: -I${includedir}