guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

04/08: gnu: ncurses: Rework trick to avoid reference to the bootstrap ba


From: Ludovic Courtès
Subject: 04/08: gnu: ncurses: Rework trick to avoid reference to the bootstrap bash.
Date: Sat, 29 Aug 2015 14:16:29 +0000

civodul pushed a commit to branch core-updates
in repository guix.

commit bfaaffb06a8f5a3610db22698b4781b0db73d332
Author: Ludovic Courtès <address@hidden>
Date:   Wed Aug 19 22:43:15 2015 +0200

    gnu: ncurses: Rework trick to avoid reference to the bootstrap bash.
    
    This removes reliance on the availability of 'bin/sh' in glibc.
    
    * gnu/packages/ncurses.scm (ncurses): Remove 'configure-phase'.  Add
      'remove-shebang-phase'.
      [arguments]: Remove distinction between cross builds and native builds.  
Use
      'modify-phases'.  Add 'remove-unneeded-shebang' phase.
---
 gnu/packages/ncurses.scm |   51 ++++++++++++++++-----------------------------
 1 files changed, 18 insertions(+), 33 deletions(-)

diff --git a/gnu/packages/ncurses.scm b/gnu/packages/ncurses.scm
index 31f5d27..49a16bc 100644
--- a/gnu/packages/ncurses.scm
+++ b/gnu/packages/ncurses.scm
@@ -28,21 +28,17 @@
          '(lambda _
             (for-each patch-makefile-SHELL
                       (find-files "." "Makefile.in"))))
-        (configure-phase
-         '(lambda* (#:key inputs outputs configure-flags
-                    #:allow-other-keys)
-            ;; The `ncursesw5-config' has a #!/bin/sh.  We want to patch
-            ;; it to point to libc's embedded Bash, to avoid retaining a
-            ;; reference to the bootstrap Bash.
-            (let* ((libc (assoc-ref inputs "libc"))
-                   (bash (string-append libc "/bin/bash"))
-                   (out  (assoc-ref outputs "out")))
-              (format #t "configure flags: ~s~%" configure-flags)
-              (zero? (apply system* bash "./configure"
-                            (string-append "SHELL=" bash)
-                            (string-append "CONFIG_SHELL=" bash)
-                            (string-append "--prefix=" out)
-                            configure-flags)))))
+        (remove-shebang-phase
+         '(lambda _
+            ;; To avoid retaining a reference to the bootstrap Bash via the
+            ;; shebang of the 'ncursesw5-config' script, simply remove that
+            ;; shebang: it'll work just as well without it.
+            (substitute* "misc/ncurses-config.in"
+              (("address@hidden@")
+               "# No shebang here, use /bin/sh!\n")
+              (("@SHELL@ \\$0")
+               "$0"))
+            #t))
         (post-install-phase
          '(lambda* (#:key outputs #:allow-other-keys)
             (let ((out (assoc-ref outputs "out")))
@@ -103,24 +99,13 @@
                  '("--without-cxx-binding")
                  '()))
         #:tests? #f                               ; no "check" target
-        #:phases ,(if (%current-target-system)
-
-                      `(alist-cons-before         ; cross build
-                        'configure 'patch-makefile-SHELL
-                        ,patch-makefile-phase
-                        (alist-cons-after
-                         'install 'post-install ,post-install-phase
-                         %standard-phases))
-
-                      `(alist-cons-after          ; native build
-                        'install 'post-install ,post-install-phase
-                        (alist-cons-before
-                         'configure 'patch-makefile-SHELL
-                         ,patch-makefile-phase
-                         (alist-replace
-                          'configure
-                          ,configure-phase
-                          %standard-phases))))))
+        #:phases (modify-phases %standard-phases
+                   (add-after 'install 'post-install
+                              ,post-install-phase)
+                   (add-before 'configure 'patch-makefile-SHELL
+                               ,patch-makefile-phase)
+                   (add-after 'unpack 'remove-unneeded-shebang
+                              ,remove-shebang-phase))))
      (self-native-input? #t)                      ; for `tic'
      (synopsis "Terminal emulation (termcap, terminfo) library")
      (description



reply via email to

[Prev in Thread] Current Thread [Next in Thread]