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.
This commit is contained in:
Ludovic Courtès 2015-08-19 22:43:15 +02:00
parent 7b06688048
commit bfaaffb06a
1 changed files with 18 additions and 33 deletions

View File

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