Commit 5f0e2e9e authored by Emily's avatar Emily
Browse files

picocom: switch to maintained fork

The previous upstream has been dead for six years; this fork is by
Linux kernel developer Wolfram Sang, and is already used by Fedora,
openSUSE, and Buildroot.
parent dfa36a3e
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
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,
+34 −25
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  fetchFromGitHub,
  fetchFromGitLab,
  replaceVars,
  go-md2man,
  installShellFiles,
  lrzsz,
  darwin,
  lrzsz,
}:

stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
  pname = "picocom";
  # last tagged release is 3.1 but 3.2 is still considered a release
  version = "3.2a";
  version = "2024-07";

  # upstream is quiet as the original author is no longer active since March 2018
  src = fetchFromGitHub {
    owner = "npat-efault";
  src = fetchFromGitLab {
    owner = "wsakernel";
    repo = "picocom";
    rev = "1acf1ddabaf3576b4023c4f6f09c5a3e4b086fb8";
    sha256 = "sha256-cs2bxqZfTbnY5d+VJ257C5hssaFvYup3tBKz68ROnAo=";
    rev = finalAttrs.version;
    hash = "sha256-cQoEfi75iltjeAm26NvXgfrL7d1Hm+1veQ4dVe0S1q8=";
  };

  postPatch = ''
    substituteInPlace Makefile \
      --replace '.picocom_history' '.cache/picocom_history'
  patches = [
    (replaceVars ./lrzsz-path.patch { inherit lrzsz; })
  ];

    substituteInPlace picocom.c \
      --replace '"rz -vv -E"' '"${lrzsz}/bin/rz -vv -E"' \
      --replace '"sz -vv"' '"${lrzsz}/bin/sz -vv"'
  '';
  nativeBuildInputs = [
    go-md2man
    installShellFiles
  ];

  enableParallelBuilding = true;
  buildInputs = lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.IOKit ];

  nativeBuildInputs = [ installShellFiles ];
  makeFlags = [
    "HISTFILE=.cache/picocom_history"
    "all"
    "doc"
  ];

  buildInputs = lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.IOKit ];
  enableParallelBuilding = true;

  installPhase = ''
    runHook preInstall

    install -Dm555 -t $out/bin picocom
    installManPage picocom.1
    installShellCompletion --bash bash_completion/picocom

    runHook postInstall
  '';

  meta = with lib; {
  meta = {
    description = "Minimal dumb-terminal emulation program";
    homepage = "https://github.com/npat-efault/picocom/";
    license = licenses.gpl2Plus;
    platforms = platforms.unix;
    homepage = "https://gitlab.com/wsakernel/picocom";
    changelog = "https://gitlab.com/wsakernel/picocom/-/releases";
    license = lib.licenses.gpl2Plus;
    platforms = lib.platforms.unix;
    mainProgram = "picocom";
  };
}
})