aboutsummaryrefslogtreecommitdiff
path: root/gnu/system/locale.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/system/locale.scm')
-rw-r--r--gnu/system/locale.scm49
1 files changed, 15 insertions, 34 deletions
diff --git a/gnu/system/locale.scm b/gnu/system/locale.scm
index 3bb9f950a8..75cb855b59 100644
--- a/gnu/system/locale.scm
+++ b/gnu/system/locale.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -19,10 +19,8 @@
(define-module (gnu system locale)
#:use-module (guix gexp)
#:use-module (guix store)
- #:use-module (guix monads)
#:use-module (guix records)
#:use-module (guix packages)
- #:use-module (guix utils)
#:use-module (gnu packages base)
#:use-module (gnu packages compression)
#:use-module (srfi srfi-26)
@@ -85,24 +83,15 @@ or #f on failure."
(define* (localedef-command locale
#:key (libc (canonical-package glibc)))
"Return a gexp that runs 'localedef' from LIBC to build LOCALE."
- (define (maybe-version-directory)
- ;; XXX: For libc prior to 2.22, GuixSD did not store locale data in a
- ;; version-specific sub-directory. Check whether this is the case.
- ;; TODO: Remove this hack once libc 2.21 is buried.
- (let ((version (package-version libc)))
- (if (version>=? version "2.22")
- (list version "/")
- '())))
-
#~(begin
(format #t "building locale '~a'...~%"
#$(locale-definition-name locale))
- (zero? (system* (string-append #$libc "/bin/localedef")
+ (zero? (system* (string-append #+libc "/bin/localedef")
"--no-archive" "--prefix" #$output
"-i" #$(locale-definition-source locale)
"-f" #$(locale-definition-charset locale)
(string-append #$output "/"
- #$@(maybe-version-directory)
+ #$(package-version libc) "/"
#$(locale-definition-name locale))))))
(define* (single-locale-directory locales
@@ -119,12 +108,7 @@ of LIBC."
#~(begin
(mkdir #$output)
- ;; XXX: For libcs < 2.22, locale data is stored in the top-level
- ;; directory.
- ;; TODO: Remove this hack once libc 2.21 is buried.
- #$(if (version>=? version "2.22")
- #~(mkdir (string-append #$output "/" #$version))
- #~(symlink "." (string-append #$output "/" #$version)))
+ (mkdir (string-append #$output "/" #$version))
;; 'localedef' executes 'gzip' to access compressed locale sources.
(setenv "PATH" (string-append #$gzip "/bin"))
@@ -133,8 +117,7 @@ of LIBC."
(and #$@(map (cut localedef-command <> #:libc libc)
locales)))))
- (gexp->derivation (string-append "locale-" version) build
- #:local-build? #t))
+ (computed-file (string-append "locale-" version) build))
(define* (locale-directory locales
#:key (libcs %default-locale-libcs))
@@ -148,18 +131,16 @@ data format changes between libc versions."
((libc)
(single-locale-directory locales #:libc libc))
((libcs ..1)
- (mlet %store-monad ((dirs (mapm %store-monad
- (lambda (libc)
- (single-locale-directory locales
- #:libc libc))
- libcs)))
- (gexp->derivation "locale-multiple-versions"
- (with-imported-modules '((guix build union))
- #~(begin
- (use-modules (guix build union))
- (union-build #$output (list #$@dirs))))
- #:local-build? #t
- #:substitutable? #f)))))
+ (let ((dirs (map (lambda (libc)
+ (single-locale-directory locales #:libc libc))
+ libcs)))
+ (computed-file "locale-multiple-versions"
+ (with-imported-modules '((guix build union))
+ #~(begin
+ (use-modules (guix build union))
+ (union-build #$output (list #$@dirs))))
+ #:options '(#:local-build? #t
+ #:substitutable? #f))))))
(define %default-locale-libcs
;; The libcs for which we build locales by default.