diff options
author | Ludovic Courtès <ludo@gnu.org> | 2023-09-21 15:57:10 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2024-08-31 10:42:46 +0200 |
commit | 61c6d0bdd84d4c8b25a94e206d89539f4dcfbbbb (patch) | |
tree | a988f962ee64d52e0164c81c18cc178b170cdddb | |
parent | 1487b3f53c3426f634f286b3493197b4e9993176 (diff) | |
download | guix-61c6d0bdd84d4c8b25a94e206d89539f4dcfbbbb.tar.gz guix-61c6d0bdd84d4c8b25a94e206d89539f4dcfbbbb.zip |
gnu: glibc-utf8-locales: Generalize and use gexps.
Previously code was dependent on the ‘name’ field of the GLIBC package.
* gnu/packages/base.scm (make-glibc-utf8-locales): Use gexps. Replace
references to ‘%build-inputs’ by calls to ‘which’. Replace reference to
‘version’ by (package-version this-package).
Change-Id: I1e7003047aa85df74069b233191ab331b5f887b6
-rw-r--r-- | gnu/packages/base.scm | 75 |
1 files changed, 40 insertions, 35 deletions
diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm index 94a38a67c0..f025fd114a 100644 --- a/gnu/packages/base.scm +++ b/gnu/packages/base.scm @@ -1410,47 +1410,52 @@ to the @code{share/locale} sub-directory of this package.") (define*-public (make-glibc-utf8-locales glibc #:key (locales %default-utf8-locales) (name "glibc-utf8-locales")) - (define default-locales? (equal? locales %default-utf8-locales)) + (define default-locales? + (equal? locales %default-utf8-locales)) + (package (name name) (version (package-version glibc)) (source #f) (build-system trivial-build-system) (arguments - `(#:modules ((guix build utils)) - #:builder (begin - (use-modules (guix build utils)) - - (let* ((libc (assoc-ref %build-inputs "glibc")) - (gzip (assoc-ref %build-inputs "gzip")) - (out (assoc-ref %outputs "out")) - (localedir (string-append out "/lib/locale/" - ,(version-major+minor version)))) - ;; 'localedef' needs 'gzip'. - (setenv "PATH" (string-append libc "/bin:" gzip "/bin")) - - (mkdir-p localedir) - (for-each (lambda (locale) - (define file - ;; Use the "normalized codeset" by - ;; default--e.g., "en_US.utf8". - (string-append localedir "/" locale ".utf8")) - - (invoke "localedef" "--no-archive" - "--prefix" localedir - "-i" locale - "-f" "UTF-8" file) - - ;; For backward compatibility with Guix - ;; <= 0.8.3, add "xx_YY.UTF-8". - (symlink (string-append locale ".utf8") - (string-append localedir "/" - locale ".UTF-8"))) - ',locales) - #t)))) - (native-inputs - `(("glibc" ,glibc) - ("gzip" ,gzip))) + (list #:modules '((guix build utils)) + #:builder + #~(begin + (use-modules (guix build utils)) + + (let* ((libc (dirname + (search-input-file %build-inputs + "/bin/localedef"))) + (gzip (dirname + (search-input-file %build-inputs + "/bin/gzip"))) + (out #$output) + (localedir (string-append out "/lib/locale/" + #$(version-major+minor + (package-version this-package))))) + ;; 'localedef' needs 'gzip'. + (setenv "PATH" (string-append libc ":" gzip "")) + + (mkdir-p localedir) + (for-each (lambda (locale) + (define file + ;; Use the "normalized codeset" by + ;; default--e.g., "en_US.utf8". + (string-append localedir "/" locale ".utf8")) + + (invoke "localedef" "--no-archive" + "--prefix" localedir + "-i" locale + "-f" "UTF-8" file) + + ;; For backward compatibility with Guix + ;; <= 0.8.3, add "xx_YY.UTF-8". + (symlink (string-append locale ".utf8") + (string-append localedir "/" + locale ".UTF-8"))) + '#$locales))))) + (native-inputs (list glibc gzip)) (synopsis (if default-locales? (P_ "Small sample of UTF-8 locales") (P_ "Customized sample of UTF-8 locales"))) |