From 6f450b87de18e6d41795848a8c3f4f6e749190c3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= <ludo@gnu.org>
Date: Mon, 18 May 2015 22:53:09 +0200
Subject: [PATCH] gnu: gcc-toolchain: Remove 'bin/sh' and 'bin/bash'.

* gnu/packages/commencement.scm (gcc-toolchain)[arguments] <#:builder>: Delete
  'bin/sh' and 'bin/bash'.
---
 gnu/packages/commencement.scm | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index da1b1ffd985..9611ff2620e 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -756,16 +756,26 @@ (define (gcc-toolchain gcc)
      '(#:modules ((guix build union))
        #:builder (begin
                    (use-modules (ice-9 match)
+                                (srfi srfi-26)
                                 (guix build union))
 
-                   (match %build-inputs
-                     (((names . directories) ...)
-                      (union-build (assoc-ref %outputs "out")
-                                   directories)))
+                   (let ((out (assoc-ref %outputs "out")))
 
-                   (union-build (assoc-ref %outputs "debug")
-                                (list (assoc-ref %build-inputs
-                                                 "libc-debug"))))))
+                     (match %build-inputs
+                       (((names . directories) ...)
+                        (union-build out directories)))
+
+                     ;; Remove the 'sh' and 'bash' binaries that come with
+                     ;; libc to avoid polluting the user's profile (these are
+                     ;; statically-linked binaries with no locale support and
+                     ;; so on.)
+                     (for-each (lambda (file)
+                                 (delete-file (string-append out "/bin/" file)))
+                               '("sh" "bash"))
+
+                     (union-build (assoc-ref %outputs "debug")
+                                  (list (assoc-ref %build-inputs
+                                                   "libc-debug")))))))
 
     (native-search-paths (package-native-search-paths gcc))
     (search-paths (package-search-paths gcc))
-- 
GitLab