From bcb2de4443268e009b82f22570567b2b013d5523 Mon Sep 17 00:00:00 2001 From: Arul Agrawal Date: Fri, 18 Nov 2022 10:11:19 +0200 Subject: [PATCH] renameutils: fix package on darwin (#195807) Co-authored-by: Sandro --- pkgs/tools/misc/renameutils/default.nix | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/pkgs/tools/misc/renameutils/default.nix b/pkgs/tools/misc/renameutils/default.nix index 2dff399cc9a4..1b6c70a2773d 100644 --- a/pkgs/tools/misc/renameutils/default.nix +++ b/pkgs/tools/misc/renameutils/default.nix @@ -1,4 +1,4 @@ -{lib, stdenv, fetchurl, readline}: +{lib, stdenv, fetchurl, readline, coreutils }: stdenv.mkDerivation rec { pname = "renameutils"; @@ -11,8 +11,23 @@ stdenv.mkDerivation rec { patches = [ ./install-exec.patch ]; + postPatch = lib.optionalString stdenv.isDarwin '' + substituteInPlace src/apply.c \ + --replace "command = \"mv\"" "command = \"${coreutils}/bin/mv\"" \ + --replace "command = \"cp\"" "command = \"${coreutils}/bin/cp\"" + substituteInPlace src/icmd.c \ + --replace "#define MV_COMMAND \"mv\"" "#define MV_COMMAND \"${coreutils}/bin/mv\"" \ + --replace "#define CP_COMMAND \"cp\"" "#define CP_COMMAND \"${coreutils}/bin/cp\"" + substituteInPlace src/qcmd.c \ + --replace "ls_program = xstrdup(\"ls\")" "ls_program = xstrdup(\"${coreutils}/bin/ls\")" + ''; + nativeBuildInputs = [ readline ]; + preConfigure = lib.optionalString (stdenv.isDarwin && stdenv.isAarch64) '' + export ac_cv_func_lstat64=no + ''; + meta = { homepage = "https://www.nongnu.org/renameutils/"; description = "A set of programs to make renaming of files faster";