Unverified Commit c63bad16 authored by Sergei Trofimovich's avatar Sergei Trofimovich Committed by GitHub
Browse files

Merge pull request #241854 from trofi/mutt-smaller-closure

mutt: avoid build-only references in 'mutt -v'
parents 6968383d 45f4f704
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -31,7 +31,10 @@ stdenv.mkDerivation rec {
    sha256 = "sha256-TXc/IkIveQlve5S1e+5FZUrZolFl27NkY8WClbTNPYg=";
  };

  patches = lib.optional smimeSupport (fetchpatch {
  patches = [
    # Avoid build-only references embedding into 'mutt -v' output.
    ./no-build-only-refs.patch
  ] ++ lib.optional smimeSupport (fetchpatch {
    url = "https://salsa.debian.org/mutt-team/mutt/raw/debian/1.10.1-2/debian/patches/misc/smime.rc.patch";
    sha256 = "0b4i00chvx6zj9pcb06x2jysmrcb2znn831lcy32cgfds6gr3nsi";
  });
+24 −0
Original line number Diff line number Diff line
Avoid build-only store references embedding into 'mutt -v'.
--- a/txt2c.sh
+++ b/txt2c.sh
@@ -21,8 +21,18 @@ txt2c_fallback () {
 	echo ";"
 }
 
+nix_store_mangle() {
+	# consume stdin
+
+	# Avoid build-only references to nix store. These are usually
+	# 'gcc -v' output embedded into 'mutt -v'. But also might be
+	# ./configure-passed arguments.
+	sed \
+	    -e 's@'$NIX_STORE'/[a-z0-9]\{32\}-@/<<NIX>>/@g'
+}
+
 if ./txt2c test </dev/null >/dev/null 2>&1; then
-    ./txt2c "$1"
+    nix_store_mangle | ./txt2c "$1"
 else
-    txt2c_fallback "$1"
+    nix_store_mangle | txt2c_fallback "$1"
 fi