From cac4d6469f0020e0568b6254a33ed9028fc7bd55 Mon Sep 17 00:00:00 2001 From: Ben Wolsieffer Date: Mon, 20 Jun 2022 14:34:21 -0400 Subject: [PATCH] vim: fix shebangs when cross-compiling vim does its own shebang patching, which ends up pulling in build platform tools. This commit patches the build system to use HOST_PATH instead. I also enabled strictDeps and added additional dependencies needed to make patchShebangs work on some of the other scripts. This commit brings the cross-compiled package in line with the native one, but even the native build has some unpatched shebang references to python, perl and csh. Additionally, efm_perl.pl has a broken shebang (#! -w) because vim's build system can't handle not finding perl. --- pkgs/applications/editors/vim/default.nix | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/editors/vim/default.nix b/pkgs/applications/editors/vim/default.nix index d8167f609879..42a1b730fe15 100644 --- a/pkgs/applications/editors/vim/default.nix +++ b/pkgs/applications/editors/vim/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchurl, callPackage, ncurses, gettext, pkg-config +{ lib, stdenv, fetchurl, callPackage, ncurses, bash, gawk, gettext, pkg-config # default vimrc , vimrc ? fetchurl { name = "default-vimrc"; @@ -18,9 +18,11 @@ stdenv.mkDerivation { inherit (common) version src postPatch hardeningDisable enableParallelBuilding meta; nativeBuildInputs = [ gettext pkg-config ]; - buildInputs = [ ncurses ] + buildInputs = [ ncurses bash gawk ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ Carbon Cocoa ]; + strictDeps = true; + configureFlags = [ "--enable-multibyte" "--enable-nls" @@ -36,6 +38,13 @@ stdenv.mkDerivation { "vim_cv_memmove_handles_overlap=yes" ]; + # which.sh is used to for vim's own shebang patching, so make it find + # binaries for the host platform. + preConfigure = '' + export HOST_PATH + substituteInPlace src/which.sh --replace '$PATH' '$HOST_PATH' + ''; + postInstall = '' ln -s $out/bin/vim $out/bin/vi mkdir -p $out/share/vim