2021-01-11 08:54:33 +01:00
|
|
|
{ lib, stdenv
|
2020-01-23 10:08:35 +01:00
|
|
|
, fetchurl
|
2021-01-17 04:51:22 +01:00
|
|
|
, pkg-config
|
2020-01-23 10:08:35 +01:00
|
|
|
, glib
|
|
|
|
, gpm
|
|
|
|
, file
|
|
|
|
, e2fsprogs
|
|
|
|
, libX11
|
|
|
|
, libICE
|
|
|
|
, perl
|
|
|
|
, zip
|
|
|
|
, unzip
|
|
|
|
, gettext
|
|
|
|
, slang
|
|
|
|
, libssh2
|
|
|
|
, openssl
|
|
|
|
, coreutils
|
2020-03-14 08:28:34 +01:00
|
|
|
, autoreconfHook
|
2021-02-12 04:11:43 +01:00
|
|
|
, autoSignDarwinBinariesHook
|
2021-12-31 15:42:25 +01:00
|
|
|
|
|
|
|
# updater only
|
|
|
|
, writeScript
|
2020-01-23 10:08:35 +01:00
|
|
|
}:
|
2008-01-23 10:58:07 +01:00
|
|
|
|
2008-01-28 20:49:59 +01:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "mc";
|
2022-03-27 19:07:20 +02:00
|
|
|
version = "4.8.28";
|
2017-05-17 01:15:07 +02:00
|
|
|
|
2008-01-23 10:58:07 +01:00
|
|
|
src = fetchurl {
|
2020-01-21 16:13:53 +01:00
|
|
|
url = "https://www.midnight-commander.org/downloads/${pname}-${version}.tar.xz";
|
2022-03-27 19:07:20 +02:00
|
|
|
sha256 = "sha256-6ZTZvppxcumsSkrWIQeSH2qjEuZosFbf5bi867r1OAM=";
|
2008-01-23 10:58:07 +01:00
|
|
|
};
|
2017-05-17 01:15:07 +02:00
|
|
|
|
2021-02-12 04:11:43 +01:00
|
|
|
nativeBuildInputs = [ pkg-config autoreconfHook unzip ]
|
|
|
|
# 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
|
|
|
|
];
|
2018-05-10 07:25:48 +02:00
|
|
|
|
|
|
|
buildInputs = [
|
2020-01-23 10:08:35 +01:00
|
|
|
file
|
|
|
|
gettext
|
|
|
|
glib
|
|
|
|
libICE
|
|
|
|
libX11
|
|
|
|
libssh2
|
|
|
|
openssl
|
|
|
|
slang
|
|
|
|
zip
|
2021-01-15 10:19:50 +01:00
|
|
|
] ++ lib.optionals (!stdenv.isDarwin) [ e2fsprogs gpm ];
|
2018-05-10 07:25:48 +02:00
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
2016-08-30 10:38:51 +02:00
|
|
|
|
2022-03-27 19:07:20 +02:00
|
|
|
configureFlags = [ "PERL=${perl}/bin/perl" ];
|
2009-09-16 19:08:33 +02:00
|
|
|
|
2020-01-23 10:08:35 +01:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace src/filemanager/ext.c \
|
|
|
|
--replace /bin/rm ${coreutils}/bin/rm
|
2022-01-06 12:28:28 +01:00
|
|
|
|
|
|
|
substituteInPlace misc/ext.d/misc.sh.in \
|
|
|
|
--replace /bin/cat ${coreutils}/bin/cat
|
2020-01-23 10:08:35 +01:00
|
|
|
'';
|
|
|
|
|
2021-07-28 19:42:00 +02:00
|
|
|
preFixup = ''
|
2017-05-17 01:15:07 +02:00
|
|
|
# remove unwanted build-dependency references
|
|
|
|
sed -i -e "s!PKG_CONFIG_PATH=''${PKG_CONFIG_PATH}!PKG_CONFIG_PATH=$(echo "$PKG_CONFIG_PATH" | sed -e 's/./0/g')!" $out/bin/mc
|
2021-07-28 19:42:00 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
postFixup = lib.optionalString (!stdenv.isDarwin) ''
|
2021-07-22 02:37:52 +02:00
|
|
|
# libX11.so is loaded dynamically so autopatch doesn't detect it
|
|
|
|
patchelf \
|
|
|
|
--add-needed ${libX11}/lib/libX11.so \
|
|
|
|
$out/bin/mc
|
2017-05-17 01:15:07 +02:00
|
|
|
'';
|
|
|
|
|
2021-12-31 15:42:25 +01: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-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2008-02-05 10:34:39 +01:00
|
|
|
description = "File Manager and User Shell for the GNU Project";
|
2020-01-21 16:13:53 +01:00
|
|
|
downloadPage = "https://www.midnight-commander.org/downloads/";
|
2020-03-14 08:31:07 +01:00
|
|
|
homepage = "https://www.midnight-commander.org";
|
2020-01-23 10:08:35 +01:00
|
|
|
license = licenses.gpl2Plus;
|
|
|
|
maintainers = with maintainers; [ sander ];
|
|
|
|
platforms = with platforms; linux ++ darwin;
|
2008-01-28 20:49:59 +01:00
|
|
|
};
|
2008-01-23 10:58:07 +01:00
|
|
|
}
|