Subject: [bug#39146] [PATCH v2] gnu: icecat: Remove about:buildconfig store references.

From: Tobias Geerinckx-Rice <[email-masked]>
Date: Wed, 22 Jan 2020 21:13:13 +0100

* gnu/packages/gnuzilla.scm (icecat)[arguments]:
New ‘neutralise-store-references’ phase.

Reported-by: Jakub Kądziołka <[email-masked]>
---

So,

Here's a version that correctly calls %store-directory.  Tested again, output looks the same.

Jakub: I accidentally kept your copyright line in v1, but didn't actually use your code (although part of your comment survives :-).  Is the Reported-by above acceptable?

Kind regards,

T G-R

 gnu/packages/gnuzilla.scm | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/gnuzilla.scm b/gnu/packages/gnuzilla.scm
index ae0c58eedb..96c3c78e98 100644
--- a/gnu/packages/gnuzilla.scm
+++ b/gnu/packages/gnuzilla.scm
@@ -7,7 +7,7 @@
 ;;; Copyright © 2016 Alex Griffin <[email-masked]>
 ;;; Copyright © 2017 Clément Lassieur <[email-masked]>
 ;;; Copyright © 2017 ng0 <[email-masked]>
-;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <[email-masked]>
+;;; Copyright © 2017, 2018, 2020 Tobias Geerinckx-Rice <[email-masked]>
 ;;; Copyright © 2018 Ricardo Wurmus <[email-masked]>
 ;;; Copyright © 2019 Ivan Petkov <[email-masked]>
 ;;; Copyright © 2020 Oleg Pykhalov <[email-masked]>
@@ -1067,6 +1067,15 @@ from forcing GEXP-PROMISE."
                                 (force-output)
                                 (retry (- remaining-attempts 1))))
                        (apply build args)))))))
+         (add-after 'build 'neutralise-store-references
+           (lambda _
+             ;; Mangle the store references to compilers & other build tools in
+             ;; about:buildconfig, reducing IceCat's closure by 1 GiB on x86-64.
+             (substitute*
+                 "dist/bin/chrome/toolkit/content/global/buildconfig.html"
+               (((format #f "(~a/)([0-9a-z]{32})" (%store-directory)) _ store hash)
+                (string-append store (string-take hash 8) "…")))
+             #t))
          (add-before 'configure 'install-desktop-entry
            (lambda* (#:key outputs #:allow-other-keys)
              ;; Install the '.desktop' file.
-- 
2.23.0