aboutsummaryrefslogtreecommitdiff
path: root/guix/build
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-02-26 23:36:55 +0100
committerLudovic Courtès <ludo@gnu.org>2015-02-26 23:36:55 +0100
commit5335c56e8eb1953d7e14130896fea35309231134 (patch)
treeb1e475c944e8d4d69d799220033440ec4e5445f4 /guix/build
parentf84218acae6cb323c6c9f7d5957531dae9b9912f (diff)
downloadgnu-guix-5335c56e8eb1953d7e14130896fea35309231134.tar
gnu-guix-5335c56e8eb1953d7e14130896fea35309231134.tar.gz
build-system/gnu: Add 'install-locale' phase.
* guix/build/gnu-build-system.scm (install-locale): New procedure. (%standard-phases): Add it. * guix/build-system/gnu.scm (gnu-build): Add #:locale and pass it to the build script. (gnu-cross-build): Likewise.
Diffstat (limited to 'guix/build')
-rw-r--r--guix/build/gnu-build-system.scm25
1 files changed, 24 insertions, 1 deletions
diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm
index 25df711170..c3cc3ce70a 100644
--- a/guix/build/gnu-build-system.scm
+++ b/guix/build/gnu-build-system.scm
@@ -94,6 +94,29 @@
#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)
+ (format (current-error-port) "using '~a' locale for category ~a~%"
+ locale 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
@@ -454,7 +477,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