From c089511288820cfb3efc5295e572be24aa83f068 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 21 Dec 2012 22:31:25 +0100 Subject: build-system/gnu: Patch shebangs in all the source; patch SHELL in makefiles. * guix/build/utils.scm (call-with-ascii-input-file): New procedure. (patch-shebang): Use it. (patch-makefile-SHELL): New procedure. * guix/build/gnu-build-system.scm (patch-source-shebangs): Patch all the files, not just executables; remove `po/Makefile.in.in' patching. (patch-generated-files): Rename to... (patch-generated-file-shebangs): ... this. Patch executables and makefiles. (%standard-phases): Adjust accordingly. * distro/packages/autotools.scm (libtool): Remove call to `patch-shebang'. * distro/packages/base.scm (gcc-4.7): Likewise. (guile-final): Remove hack to skip `test-command-line-encoding2'. * distro/packages/bash.scm (bash): Remove `pre-configure-phase'. * distro/packages/readline.scm (readline): Likewise. * distro/packages/ncurses.scm (ncurses): Remove `pre-install-phase'. --- guix/build/gnu-build-system.scm | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'guix/build/gnu-build-system.scm') diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm index 18c66e5256..b5eaa26bf5 100644 --- a/guix/build/gnu-build-system.scm +++ b/guix/build/gnu-build-system.scm @@ -84,24 +84,26 @@ (chdir (first-subdirectory ".")))) (define* (patch-source-shebangs #:key source #:allow-other-keys) - ;; Patch shebangs in executable source files. Most scripts honor - ;; $SHELL and $CONFIG_SHELL, but some don't, such as `mkinstalldirs' - ;; or Automake's `missing' script. + "Patch shebangs in all source files; this includes non-executable +files such as `.in' templates. Most scripts honor $SHELL and +$CONFIG_SHELL, but some don't, such as `mkinstalldirs' or Automake's +`missing' script." + (for-each patch-shebang + (remove file-is-directory? (find-files "." ".*")))) + +(define (patch-generated-file-shebangs . rest) + "Patch shebangs in generated files, including `SHELL' variables in +makefiles." + ;; Patch executable files, some of which might have been generated by + ;; `configure'. (for-each patch-shebang (filter (lambda (file) (and (executable-file? file) (not (file-is-directory? file)))) (find-files "." ".*"))) - ;; Gettext-generated po/Makefile.in.in does not honor $SHELL. - (let ((bash (search-path (search-path-as-string->list (getenv "PATH")) - "bash"))) - (when (file-exists? "po/Makefile.in.in") - (substitute* "po/Makefile.in.in" - (("^SHELL[[:blank:]]*=.*$") - (string-append "SHELL = " bash "\n")))))) - -(define patch-generated-files patch-source-shebangs) + ;; Patch `SHELL' in generated makefiles. + (for-each patch-makefile-SHELL (find-files "." "^(GNU)?[mM]akefile$"))) (define* (patch #:key (patches '()) (patch-flags '("--batch" "-p1")) #:allow-other-keys) @@ -253,7 +255,7 @@ (let-syntax ((phases (syntax-rules () ((_ p ...) `((p . ,p) ...))))) (phases set-paths unpack patch - patch-source-shebangs configure patch-generated-files + patch-source-shebangs configure patch-generated-file-shebangs build check install patch-shebangs strip))) -- cgit v1.2.3