From: Julien Lepiller <[email-masked]>
To: [email-masked]
Cc: [email-masked], [email-masked]
Date: Sat, 18 Jun 2022 08:46:32 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

This patch ensures that we don't record a reference to gcc-toolchain in
the result of `guix pull`.  With this, we save 150 MB of closure.

This is a patch to fix the first issue I found in
https://issues.guix.gnu.org/56030.

From f96742e204f6b98401f49f7d1066257d7355c873 Mon Sep 17 00:00:00 2001
From: Julien Lepiller <[email-masked]>
Date: Sat, 18 Jun 2022 08:17:59 +0200
Subject: [PATCH] guix: self: Do not record reference to gcc-toolchain.

The ld-wrapper from gcc-toolchain records a reference to the library
path through rpath, but this is not needed.  By explicitely using rpath
flags instead, we save 150 MB of closure.

* guix/self.scm (quiet-guile): Do not record reference to gcc-toolchain.
---
 guix/self.scm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/guix/self.scm b/guix/self.scm
index 9a64051c32..36ada4d171 100644
--- a/guix/self.scm
+++ b/guix/self.scm
@@ -569,10 +569,12 @@ (define build
                               (filter package? packages))))
                    ":"))
           (setenv "LIBRARY_PATH" #$(file-append gcc "/lib"))
+          (setenv "GUIX_LD_WRAPPER_DISABLE_RPATH" "1")
 
           (invoke "gcc" #$(local-file source) "-Wall" "-g0" "-O2"
                   "-I" #$(file-append guile "/include/guile/" effective)
                   "-L" #$(file-append guile "/lib")
+                  "-Wl,-rpath" #$(file-append guile "/lib")
                   #$(string-append "-lguile-" effective)
                   "-o" (string-append #$output "/bin/guile")))))
 
-- 
2.35.1