lol
1{lib, stdenv, fetchurl, readline, coreutils }:
2
3stdenv.mkDerivation rec {
4 pname = "renameutils";
5 version = "0.12.0";
6
7 src = fetchurl {
8 url = "mirror://savannah/renameutils/renameutils-${version}.tar.gz";
9 sha256 = "18xlkr56jdyajjihcmfqlyyanzyiqqlzbhrm6695mkvw081g1lnb";
10 };
11
12 patches = [ ./install-exec.patch ];
13
14 postPatch = lib.optionalString stdenv.isDarwin ''
15 substituteInPlace src/apply.c \
16 --replace "command = \"mv\"" "command = \"${coreutils}/bin/mv\"" \
17 --replace "command = \"cp\"" "command = \"${coreutils}/bin/cp\""
18 substituteInPlace src/icmd.c \
19 --replace "#define MV_COMMAND \"mv\"" "#define MV_COMMAND \"${coreutils}/bin/mv\"" \
20 --replace "#define CP_COMMAND \"cp\"" "#define CP_COMMAND \"${coreutils}/bin/cp\""
21 substituteInPlace src/qcmd.c \
22 --replace "ls_program = xstrdup(\"ls\")" "ls_program = xstrdup(\"${coreutils}/bin/ls\")"
23 '';
24
25 nativeBuildInputs = [ readline ];
26
27 preConfigure = lib.optionalString (stdenv.isDarwin && stdenv.isAarch64) ''
28 export ac_cv_func_lstat64=no
29 '';
30
31 meta = {
32 homepage = "https://www.nongnu.org/renameutils/";
33 description = "A set of programs to make renaming of files faster";
34 platforms = lib.platforms.unix;
35 license = lib.licenses.gpl2Plus;
36 };
37}