summaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
Diffstat (limited to 'guix')
-rw-r--r--guix/build/gnu-build-system.scm3
-rw-r--r--guix/build/utils.scm34
2 files changed, 26 insertions, 11 deletions
diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm
index b7b9fdac95..8fc6f86507 100644
--- a/guix/build/gnu-build-system.scm
+++ b/guix/build/gnu-build-system.scm
@@ -73,7 +73,8 @@
;; FIXME: Eventually move this to the `search-paths' field of the
;; `pkg-config' package.
(set-path-environment-variable "PKG_CONFIG_PATH"
- '("lib/pkgconfig" "lib64/pkgconfig")
+ '("lib/pkgconfig" "lib64/pkgconfig"
+ "share/pkgconfig")
(relevant-input-directories "PKG_CONFIG_PATH"))
;; Dump the environment variables as a shell script, for handy debugging.
diff --git a/guix/build/utils.scm b/guix/build/utils.scm
index 6921e31bdd..d17346607f 100644
--- a/guix/build/utils.scm
+++ b/guix/build/utils.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -51,7 +52,7 @@
fold-port-matches
remove-store-references))
-
+
;;;
;;; Directories.
;;;
@@ -426,7 +427,7 @@ bytes transferred and the continuation of the transfer as a thunk."
(stat:mtimensec stat)))
(define patch-shebang
- (let ((shebang-rx (make-regexp "^[[:blank:]]*([[:graph:]]+)(.*)$")))
+ (let ((shebang-rx (make-regexp "^[[:blank:]]*([[:graph:]]+)[[:blank:]]*([[:graph:]]*)(.*)$")))
(lambda* (file
#:optional
(path (search-path-as-string->list (getenv "PATH")))
@@ -465,16 +466,29 @@ FILE are kept unchanged."
(let ((line (false-if-exception (read-line p))))
(and=> (and line (regexp-exec shebang-rx line))
(lambda (m)
- (let* ((cmd (match:substring m 1))
- (bin (search-path path (basename cmd))))
+ (let* ((interp (match:substring m 1))
+ (arg1 (match:substring m 2))
+ (rest (match:substring m 3))
+ (has-env (string-suffix? "/env" interp))
+ (cmd (if has-env arg1 (basename interp)))
+ (bin (search-path path cmd)))
(if bin
- (if (string=? bin cmd)
+ (if (string=? bin interp)
#f ; nothing to do
- (begin
- (format (current-error-port)
- "patch-shebang: ~a: changing `~a' to `~a'~%"
- file cmd bin)
- (patch p bin (match:substring m 2))))
+ (if has-env
+ (begin
+ (format (current-error-port)
+ "patch-shebang: ~a: changing `~a' to `~a'~%"
+ file (string-append interp " " arg1) bin)
+ (patch p bin rest))
+ (begin
+ (format (current-error-port)
+ "patch-shebang: ~a: changing `~a' to `~a'~%"
+ file interp bin)
+ (patch p bin
+ (if (string-null? arg1)
+ ""
+ (string-append " " arg1 rest))))))
(begin
(format (current-error-port)
"patch-shebang: ~a: warning: no binary for interpreter `~a' found in $PATH~%"