utils: Adjust 'wrap-program'.

* guix/build/utils.scm (wrap-program): Fix computation of PROG-REAL and
  PROG-TMP when PROG is an absolute file name.  Add "$@" in the
  generated script, and quote PROG-REAL.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
master
Nikita Karetnikov 2013-04-28 16:08:23 +00:00 committed by Ludovic Courtès
parent 867df0eeb6
commit 01155b1808
1 changed files with 3 additions and 3 deletions

View File

@ -680,8 +680,8 @@ contents:
This is useful for scripts that expect particular programs to be in $PATH, for
programs that expect particular shared libraries to be in $LD_LIBRARY_PATH, or
modules in $GUILE_LOAD_PATH, etc."
(let ((prog-real (string-append "." prog "-real"))
(prog-tmp (string-append "." prog "-tmp")))
(let ((prog-real (string-append (dirname prog) "/." (basename prog) "-real"))
(prog-tmp (string-append (dirname prog) "/." (basename prog) "-tmp")))
(define (export-variable lst)
;; Return a string that exports an environment variable.
(match lst
@ -709,7 +709,7 @@ modules in $GUILE_LOAD_PATH, etc."
(with-output-to-file prog-tmp
(lambda ()
(format #t
"#!~a~%~a~%exec ~a~%"
"#!~a~%~a~%exec \"~a\" \"$@\"~%"
(which "bash")
(string-join (map export-variable vars)
"\n")