2021-01-15 22:18:51 +00:00
|
|
|
{ lib, stdenv
|
2020-04-24 23:36:52 +00:00
|
|
|
, fetchurl
|
2022-08-21 13:32:41 +00:00
|
|
|
, buildPackages
|
2021-02-05 17:12:51 +00:00
|
|
|
, pkg-config
|
2020-04-24 23:36:52 +00:00
|
|
|
, glib
|
|
|
|
, gpm
|
|
|
|
, file
|
|
|
|
, e2fsprogs
|
|
|
|
, libX11
|
|
|
|
, libICE
|
|
|
|
, perl
|
|
|
|
, zip
|
|
|
|
, unzip
|
|
|
|
, gettext
|
|
|
|
, slang
|
|
|
|
, libssh2
|
|
|
|
, openssl
|
|
|
|
, coreutils
|
2021-05-28 09:39:13 +00:00
|
|
|
, autoSignDarwinBinariesHook
|
2022-01-03 16:56:52 +00:00
|
|
|
|
|
|
|
# updater only
|
|
|
|
, writeScript
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "mc";
|
2023-02-02 18:25:31 +00:00
|
|
|
version = "4.8.29";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://www.midnight-commander.org/downloads/${pname}-${version}.tar.xz";
|
2023-02-02 18:25:31 +00:00
|
|
|
sha256 = "sha256-AdijuU9YGAzKW/FyV7UHjR/W/SeptcDpcOx2dUlUCtQ=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeBuildInputs = [ pkg-config unzip ]
|
2021-05-28 09:39:13 +00:00
|
|
|
# The preFixup hook rewrites the binary, which invaliates the code
|
|
|
|
# signature. Add the fixup hook to sign the output.
|
|
|
|
++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [
|
|
|
|
autoSignDarwinBinariesHook
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
file
|
|
|
|
gettext
|
|
|
|
glib
|
|
|
|
libICE
|
|
|
|
libX11
|
|
|
|
libssh2
|
|
|
|
openssl
|
|
|
|
slang
|
|
|
|
zip
|
2021-01-15 22:18:51 +00:00
|
|
|
] ++ lib.optionals (!stdenv.isDarwin) [ e2fsprogs gpm ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2022-08-21 13:32:41 +00:00
|
|
|
configureFlags = [
|
|
|
|
# used for vfs helpers at run time:
|
|
|
|
"PERL=${perl}/bin/perl"
|
|
|
|
# used for .hlp generation at build time:
|
|
|
|
"PERL_FOR_BUILD=${buildPackages.perl}/bin/perl"
|
|
|
|
|
|
|
|
# configure arguments have a bunch of build-only dependencies.
|
|
|
|
# Avoid their retention in final closure.
|
|
|
|
"--disable-configure-args"
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace src/filemanager/ext.c \
|
|
|
|
--replace /bin/rm ${coreutils}/bin/rm
|
2022-01-13 20:06:32 +00:00
|
|
|
|
|
|
|
substituteInPlace misc/ext.d/misc.sh.in \
|
|
|
|
--replace /bin/cat ${coreutils}/bin/cat
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-08-05 21:33:18 +00:00
|
|
|
postFixup = lib.optionalString (!stdenv.isDarwin) ''
|
|
|
|
# libX11.so is loaded dynamically so autopatch doesn't detect it
|
|
|
|
patchelf \
|
|
|
|
--add-needed ${libX11}/lib/libX11.so \
|
|
|
|
$out/bin/mc
|
|
|
|
'';
|
|
|
|
|
2022-01-03 16:56:52 +00:00
|
|
|
passthru.updateScript = writeScript "update-mc" ''
|
|
|
|
#!/usr/bin/env nix-shell
|
|
|
|
#!nix-shell -i bash -p curl pcre common-updater-scripts
|
|
|
|
|
|
|
|
set -eu -o pipefail
|
|
|
|
|
|
|
|
# Expect the text in format of "Current version is: 4.8.27; ...".
|
|
|
|
new_version="$(curl -s https://midnight-commander.org/ | pcregrep -o1 'Current version is: (([0-9]+\.?)+);')"
|
|
|
|
update-source-version mc "$new_version"
|
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2022-10-30 15:09:59 +00:00
|
|
|
description = "File Manager and User Shell for the GNU Project, known as Midnight Commander";
|
2020-04-24 23:36:52 +00:00
|
|
|
downloadPage = "https://www.midnight-commander.org/downloads/";
|
|
|
|
homepage = "https://www.midnight-commander.org";
|
|
|
|
license = licenses.gpl2Plus;
|
|
|
|
maintainers = with maintainers; [ sander ];
|
|
|
|
platforms = with platforms; linux ++ darwin;
|
|
|
|
};
|
|
|
|
}
|