picocom: devendor linenoise

This commit is contained in:
Emily 2024-09-12 14:45:05 +01:00
parent 5f0e2e9e4e
commit a5cd7bba11
2 changed files with 37 additions and 1 deletions

View File

@ -3,8 +3,10 @@
stdenv,
fetchFromGitLab,
replaceVars,
pkg-config,
go-md2man,
installShellFiles,
linenoise,
darwin,
lrzsz,
}:
@ -21,15 +23,19 @@ stdenv.mkDerivation (finalAttrs: {
};
patches = [
./use-system-linenoise.patch
(replaceVars ./lrzsz-path.patch { inherit lrzsz; })
];
nativeBuildInputs = [
pkg-config
go-md2man
installShellFiles
];
buildInputs = lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.IOKit ];
buildInputs = [
linenoise
] ++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.IOKit ];
makeFlags = [
"HISTFILE=.cache/picocom_history"

View File

@ -0,0 +1,30 @@
diff --git a/Makefile b/Makefile
index 8fca24ee38..33b59b5b96 100644
--- a/Makefile
+++ b/Makefile
@@ -39,9 +39,9 @@
## Comment these out to disable "linenoise"-library support
HISTFILE = .picocom_history
CPPFLAGS += -DHISTFILE=\"$(HISTFILE)\" \
- -DLINENOISE
-OBJS += linenoise-1.0/linenoise.o
-linenoise-1.0/linenoise.o : linenoise-1.0/linenoise.c linenoise-1.0/linenoise.h
+ -DLINENOISE \
+ $(shell pkg-config --cflags linenoise)
+LDFLAGS += $(shell pkg-config --libs linenoise)
## Comment this in to enable (force) custom baudrate support
## even on systems not enabled by default.
diff --git a/picocom.c b/picocom.c
index 775ee9c3bb..ba2f9bd666 100644
--- a/picocom.c
+++ b/picocom.c
@@ -48,7 +48,7 @@
#include "split.h"
#include "term.h"
#ifdef LINENOISE
-#include "linenoise-1.0/linenoise.h"
+#include <linenoise.h>
#endif
#include "custbaud.h"