diff options
author | Ludovic Courtès <ludo@gnu.org> | 2015-03-04 14:07:23 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2015-03-04 14:07:23 +0100 |
commit | 1289062522e3d08259740e59243c6cd0642a9916 (patch) | |
tree | 65857ae41001e3b33db621073cf1504de601dda1 /guix/build/gnu-build-system.scm | |
parent | cb4d3d863b3fb44d97b3b568ff9e6cfe38f1f630 (diff) | |
parent | da699774d4d839a45daa3ae3b9189331c490b315 (diff) | |
download | gnu-guix-1289062522e3d08259740e59243c6cd0642a9916.tar gnu-guix-1289062522e3d08259740e59243c6cd0642a9916.tar.gz |
Merge branch 'core-updates'.
Diffstat (limited to 'guix/build/gnu-build-system.scm')
-rw-r--r-- | guix/build/gnu-build-system.scm | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm index 2880168273..5ae537150f 100644 --- a/guix/build/gnu-build-system.scm +++ b/guix/build/gnu-build-system.scm @@ -94,6 +94,33 @@ #t) +(define* (install-locale #:key + (locale "en_US.UTF-8") + (locale-category LC_ALL) + #:allow-other-keys) + "Try to install LOCALE; emit a warning if that fails. The main goal is to +use a UTF-8 locale so that Guile correctly interprets UTF-8 file names. + +This phase must typically happen after 'set-paths' so that $LOCPATH has a +chance to be set." + (catch 'system-error + (lambda () + (setlocale locale-category locale) + + ;; While we're at it, pass it to sub-processes. + (setenv (locale-category->string locale-category) locale) + + (format (current-error-port) "using '~a' locale for category ~s~%" + locale (locale-category->string locale-category)) + #t) + (lambda args + ;; This is known to fail for instance in early bootstrap where locales + ;; are not available. + (format (current-error-port) + "warning: failed to install '~a' locale: ~a~%" + locale (strerror (system-error-errno args))) + #t))) + (define* (unpack #:key source #:allow-other-keys) "Unpack SOURCE in the working directory, and change directory within the source. When SOURCE is a directory, copy it in a sub-directory of the current @@ -108,7 +135,9 @@ working directory." (copy-recursively source "." #:keep-mtime? #t) #t) - (and (zero? (system* "tar" "xvf" source)) + (and (if (string-suffix? ".zip" source) + (zero? (system* "unzip" source)) + (zero? (system* "tar" "xvf" source))) (chdir (first-subdirectory "."))))) ;; See <http://bugs.gnu.org/17840>. @@ -452,7 +481,7 @@ DOCUMENTATION-COMPRESSOR-FLAGS." ;; Standard build phases, as a list of symbol/procedure pairs. (let-syntax ((phases (syntax-rules () ((_ p ...) `((p . ,p) ...))))) - (phases set-paths unpack + (phases set-paths install-locale unpack patch-usr-bin-file patch-source-shebangs configure patch-generated-file-shebangs build check install @@ -470,6 +499,9 @@ in order. Return #t if all the PHASES succeeded, #f otherwise." (setvbuf (current-output-port) _IOLBF) (setvbuf (current-error-port) _IOLBF) + ;; Encoding/decoding errors shouldn't be silent. + (fluid-set! %default-port-conversion-strategy 'error) + ;; The trick is to #:allow-other-keys everywhere, so that each procedure in ;; PHASES can pick the keyword arguments it's interested in. (every (match-lambda |