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.
This commit is contained in:
Ludovic Courtès 2015-02-26 23:36:55 +01:00
parent f84218acae
commit 5335c56e8e
2 changed files with 29 additions and 2 deletions

View File

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -278,6 +278,7 @@ standard packages used as implicit inputs of the GNU build system."
(strip-directories ''("lib" "lib64" "libexec" (strip-directories ''("lib" "lib64" "libexec"
"bin" "sbin")) "bin" "sbin"))
(phases '%standard-phases) (phases '%standard-phases)
(locale "en_US.UTF-8")
(system (%current-system)) (system (%current-system))
(imported-modules %default-modules) (imported-modules %default-modules)
(modules %default-modules) (modules %default-modules)
@ -328,6 +329,7 @@ are allowed to refer to."
#:search-paths ',(map search-path-specification->sexp #:search-paths ',(map search-path-specification->sexp
search-paths) search-paths)
#:phases ,phases #:phases ,phases
#:locale ,locale
#:configure-flags ,configure-flags #:configure-flags ,configure-flags
#:make-flags ,make-flags #:make-flags ,make-flags
#:out-of-source? ,out-of-source? #:out-of-source? ,out-of-source?
@ -410,6 +412,7 @@ is one of `host' or `target'."
(strip-directories ''("lib" "lib64" "libexec" (strip-directories ''("lib" "lib64" "libexec"
"bin" "sbin")) "bin" "sbin"))
(phases '%standard-phases) (phases '%standard-phases)
(locale "en_US.UTF-8")
(system (%current-system)) (system (%current-system))
(imported-modules '((guix build gnu-build-system) (imported-modules '((guix build gnu-build-system)
(guix build utils))) (guix build utils)))
@ -473,6 +476,7 @@ platform."
search-path-specification->sexp search-path-specification->sexp
native-search-paths) native-search-paths)
#:phases ,phases #:phases ,phases
#:locale ,locale
#:configure-flags ,configure-flags #:configure-flags ,configure-flags
#:make-flags ,make-flags #:make-flags ,make-flags
#:out-of-source? ,out-of-source? #:out-of-source? ,out-of-source?

View File

@ -94,6 +94,29 @@
#t) #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) (define* (unpack #:key source #:allow-other-keys)
"Unpack SOURCE in the working directory, and change directory within the "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 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. ;; Standard build phases, as a list of symbol/procedure pairs.
(let-syntax ((phases (syntax-rules () (let-syntax ((phases (syntax-rules ()
((_ p ...) `((p . ,p) ...))))) ((_ p ...) `((p . ,p) ...)))))
(phases set-paths unpack (phases set-paths install-locale unpack
patch-usr-bin-file patch-usr-bin-file
patch-source-shebangs configure patch-generated-file-shebangs patch-source-shebangs configure patch-generated-file-shebangs
build check install build check install