diff --git a/pkgs/by-name/pi/picocom/lrzsz-path.patch b/pkgs/by-name/pi/picocom/lrzsz-path.patch new file mode 100644 index 000000000000..86e9759db2de --- /dev/null +++ b/pkgs/by-name/pi/picocom/lrzsz-path.patch @@ -0,0 +1,15 @@ +diff --git a/picocom.c b/picocom.c +index ba2f9bd666..d4df60f2d3 100644 +--- a/picocom.c ++++ b/picocom.c +@@ -243,8 +243,8 @@ + .send_cmd = "", + .receive_cmd = "", + #else +- .send_cmd = "sz -vv", +- .receive_cmd = "rz -vv -E", ++ .send_cmd = "@lrzsz@/bin/sz -vv", ++ .receive_cmd = "@lrzsz@/bin/rz -vv -E", + #endif + .imap = M_I_DFL, + .omap = M_O_DFL, diff --git a/pkgs/by-name/pi/picocom/package.nix b/pkgs/by-name/pi/picocom/package.nix new file mode 100644 index 000000000000..9e9d1380558a --- /dev/null +++ b/pkgs/by-name/pi/picocom/package.nix @@ -0,0 +1,66 @@ +{ + lib, + stdenv, + fetchFromGitLab, + replaceVars, + pkg-config, + go-md2man, + installShellFiles, + linenoise, + darwin, + lrzsz, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "picocom"; + version = "2024-07"; + + src = fetchFromGitLab { + owner = "wsakernel"; + repo = "picocom"; + rev = finalAttrs.version; + hash = "sha256-cQoEfi75iltjeAm26NvXgfrL7d1Hm+1veQ4dVe0S1q8="; + }; + + patches = [ + ./use-system-linenoise.patch + (replaceVars ./lrzsz-path.patch { inherit lrzsz; }) + ]; + + nativeBuildInputs = [ + pkg-config + go-md2man + installShellFiles + ]; + + buildInputs = [ + linenoise + ] ++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.IOKit ]; + + makeFlags = [ + "HISTFILE=.cache/picocom_history" + "all" + "doc" + ]; + + enableParallelBuilding = true; + + installPhase = '' + runHook preInstall + + install -Dm555 -t $out/bin picocom + installManPage picocom.1 + installShellCompletion --bash bash_completion/picocom + + runHook postInstall + ''; + + meta = { + description = "Minimal dumb-terminal emulation program"; + homepage = "https://gitlab.com/wsakernel/picocom"; + changelog = "https://gitlab.com/wsakernel/picocom/-/releases"; + license = lib.licenses.gpl2Plus; + platforms = lib.platforms.unix; + mainProgram = "picocom"; + }; +}) diff --git a/pkgs/by-name/pi/picocom/use-system-linenoise.patch b/pkgs/by-name/pi/picocom/use-system-linenoise.patch new file mode 100644 index 000000000000..ee31a0d617cc --- /dev/null +++ b/pkgs/by-name/pi/picocom/use-system-linenoise.patch @@ -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 + #endif + + #include "custbaud.h" diff --git a/pkgs/development/libraries/linenoise/default.nix b/pkgs/development/libraries/linenoise/default.nix index 42017e5e1718..a525a3da9a41 100644 --- a/pkgs/development/libraries/linenoise/default.nix +++ b/pkgs/development/libraries/linenoise/default.nix @@ -2,6 +2,7 @@ , stdenv , fetchFromGitHub , validatePkgConfig +, fixDarwinDylibNames }: stdenv.mkDerivation { @@ -15,7 +16,8 @@ stdenv.mkDerivation { hash = "sha256-GsrYg16gpjHkkmpCU3yGzqNS/buZl+JoWALLvwzmT4A="; }; - nativeBuildInputs = [ validatePkgConfig ]; + nativeBuildInputs = [ validatePkgConfig ] + ++ lib.optionals stdenv.isDarwin [ fixDarwinDylibNames ]; buildPhase = '' runHook preBuild diff --git a/pkgs/tools/misc/picocom/default.nix b/pkgs/tools/misc/picocom/default.nix deleted file mode 100644 index d8422e3679fd..000000000000 --- a/pkgs/tools/misc/picocom/default.nix +++ /dev/null @@ -1,49 +0,0 @@ -{ lib, stdenv -, fetchFromGitHub -, installShellFiles -, lrzsz -, IOKit -}: - -stdenv.mkDerivation rec { - pname = "picocom"; - # last tagged release is 3.1 but 3.2 is still considered a release - version = "3.2a"; - - # upstream is quiet as the original author is no longer active since March 2018 - src = fetchFromGitHub { - owner = "npat-efault"; - repo = "picocom"; - rev = "1acf1ddabaf3576b4023c4f6f09c5a3e4b086fb8"; - sha256 = "sha256-cs2bxqZfTbnY5d+VJ257C5hssaFvYup3tBKz68ROnAo="; - }; - - postPatch = '' - substituteInPlace Makefile \ - --replace '.picocom_history' '.cache/picocom_history' - - substituteInPlace picocom.c \ - --replace '"rz -vv -E"' '"${lrzsz}/bin/rz -vv -E"' \ - --replace '"sz -vv"' '"${lrzsz}/bin/sz -vv"' - ''; - - enableParallelBuilding = true; - - nativeBuildInputs = [ installShellFiles ]; - - buildInputs = lib.optional stdenv.isDarwin IOKit; - - installPhase = '' - install -Dm555 -t $out/bin picocom - installManPage picocom.1 - installShellCompletion --bash bash_completion/picocom - ''; - - meta = with lib; { - description = "Minimal dumb-terminal emulation program"; - homepage = "https://github.com/npat-efault/picocom/"; - license = licenses.gpl2Plus; - platforms = platforms.unix; - mainProgram = "picocom"; - }; -} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index cd5e3b427ba9..2dda1e36002a 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -32589,10 +32589,6 @@ with pkgs; picard = callPackage ../applications/audio/picard { }; - picocom = callPackage ../tools/misc/picocom { - inherit (darwin.apple_sdk.frameworks) IOKit; - }; - picoloop = callPackage ../applications/audio/picoloop { }; picosnitch = callPackage ../tools/networking/picosnitch { };