From 56402ca868d1a1cfda402a743e59972bb4822f54 Mon Sep 17 00:00:00 2001 From: Josselin Poiret Date: Sun, 26 May 2024 16:07:33 +0200 Subject: gnu: make-glibc-locales: Modernize. * gnu/packages/base.scm (make-glibc-locales): Switch to G-Expressions. Change-Id: I10efbded72c3e01261a8651fec0a7d9ea29fadad --- gnu/packages/base.scm | 81 +++++++++++++++++++++++++-------------------------- 1 file changed, 40 insertions(+), 41 deletions(-) (limited to 'gnu/packages') diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm index eefff3d241..e0b1687a9a 100644 --- a/gnu/packages/base.scm +++ b/gnu/packages/base.scm @@ -1385,48 +1385,47 @@ to the @code{share/locale} sub-directory of this package.") `((gnu build locale) ,@%default-gnu-imported-modules)) ((#:phases phases) - `(modify-phases ,phases - (replace 'build - (lambda _ - (invoke "make" "localedata/install-locales" - "-j" (number->string (parallel-job-count))))) - (add-after 'build 'symlink-normalized-codesets - (lambda* (#:key outputs #:allow-other-keys) - ;; The above phase does not install locales with names using - ;; the "normalized codeset." Thus, create symlinks like: - ;; en_US.utf8 -> en_US.UTF-8 - (define (locale-directory? file stat) - (and (file-is-directory? file) - (string-index (basename file) #\_) - (string-rindex (basename file) #\.))) - - (let* ((out (assoc-ref outputs "out")) - (locales (find-files out locale-directory? - #:directories? #t))) - (for-each (lambda (directory) - (let*-values (((base) - (basename directory)) - ((name codeset) - (locale->name+codeset base)) - ((normalized) - (normalize-codeset codeset))) - (unless (string=? codeset normalized) - (symlink base - (string-append (dirname directory) - "/" name "." - normalized))))) - locales)))) - (delete 'install) - (delete 'install-utf8-c-locale) - (delete 'move-static-libs))) + #~(modify-phases #$phases + (replace 'build + (lambda _ + (invoke "make" "localedata/install-locales" + "-j" (number->string (parallel-job-count))))) + (add-after 'build 'symlink-normalized-codesets + (lambda* (#:key outputs #:allow-other-keys) + ;; The above phase does not install locales with names using + ;; the "normalized codeset." Thus, create symlinks like: + ;; en_US.utf8 -> en_US.UTF-8 + (define (locale-directory? file stat) + (and (file-is-directory? file) + (string-index (basename file) #\_) + (string-rindex (basename file) #\.))) + + (let* ((locales (find-files #$output locale-directory? + #:directories? #t))) + (for-each (lambda (directory) + (let*-values (((base) + (basename directory)) + ((name codeset) + (locale->name+codeset base)) + ((normalized) + (normalize-codeset codeset))) + (unless (string=? codeset normalized) + (symlink base + (string-append (dirname directory) + "/" name "." + normalized))))) + locales)))) + (delete 'install) + (delete 'install-utf8-c-locale) + (delete 'move-static-libs))) ((#:configure-flags flags) - `(append ,flags - ;; Use $(libdir)/locale/X.Y as is the case by default. - (list (string-append "libc_cv_complocaledir=" - (assoc-ref %outputs "out") - "/lib/locale/" - ,(version-major+minor - (package-version glibc))))))))) + #~(append #$flags + ;; Use $(libdir)/locale/X.Y as is the case by default. + (list (string-append "libc_cv_complocaledir=" + #$output + "/lib/locale/" + #$(version-major+minor + (package-version glibc))))))))) (properties `((upstream-name . "glibc"))))) (define %default-utf8-locales -- cgit v1.2.3