1
Fork 0
mirror of https://https.git.savannah.gnu.org/git/guix.git/ synced 2025-07-15 11:30:44 +02:00

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
This commit is contained in:
Ludovic Courtès 2023-09-21 15:57:10 +02:00
parent 1487b3f53c
commit 61c6d0bdd8
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -1410,47 +1410,52 @@ to the @code{share/locale} sub-directory of this package.")
(define*-public (make-glibc-utf8-locales glibc #:key (define*-public (make-glibc-utf8-locales glibc #:key
(locales %default-utf8-locales) (locales %default-utf8-locales)
(name "glibc-utf8-locales")) (name "glibc-utf8-locales"))
(define default-locales? (equal? locales %default-utf8-locales)) (define default-locales?
(equal? locales %default-utf8-locales))
(package (package
(name name) (name name)
(version (package-version glibc)) (version (package-version glibc))
(source #f) (source #f)
(build-system trivial-build-system) (build-system trivial-build-system)
(arguments (arguments
`(#:modules ((guix build utils)) (list #:modules '((guix build utils))
#:builder (begin #:builder
(use-modules (guix build utils)) #~(begin
(use-modules (guix build utils))
(let* ((libc (assoc-ref %build-inputs "glibc")) (let* ((libc (dirname
(gzip (assoc-ref %build-inputs "gzip")) (search-input-file %build-inputs
(out (assoc-ref %outputs "out")) "/bin/localedef")))
(localedir (string-append out "/lib/locale/" (gzip (dirname
,(version-major+minor version)))) (search-input-file %build-inputs
;; 'localedef' needs 'gzip'. "/bin/gzip")))
(setenv "PATH" (string-append libc "/bin:" gzip "/bin")) (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) (mkdir-p localedir)
(for-each (lambda (locale) (for-each (lambda (locale)
(define file (define file
;; Use the "normalized codeset" by ;; Use the "normalized codeset" by
;; default--e.g., "en_US.utf8". ;; default--e.g., "en_US.utf8".
(string-append localedir "/" locale ".utf8")) (string-append localedir "/" locale ".utf8"))
(invoke "localedef" "--no-archive" (invoke "localedef" "--no-archive"
"--prefix" localedir "--prefix" localedir
"-i" locale "-i" locale
"-f" "UTF-8" file) "-f" "UTF-8" file)
;; For backward compatibility with Guix ;; For backward compatibility with Guix
;; <= 0.8.3, add "xx_YY.UTF-8". ;; <= 0.8.3, add "xx_YY.UTF-8".
(symlink (string-append locale ".utf8") (symlink (string-append locale ".utf8")
(string-append localedir "/" (string-append localedir "/"
locale ".UTF-8"))) locale ".UTF-8")))
',locales) '#$locales)))))
#t)))) (native-inputs (list glibc gzip))
(native-inputs
`(("glibc" ,glibc)
("gzip" ,gzip)))
(synopsis (if default-locales? (synopsis (if default-locales?
(P_ "Small sample of UTF-8 locales") (P_ "Small sample of UTF-8 locales")
(P_ "Customized sample of UTF-8 locales"))) (P_ "Customized sample of UTF-8 locales")))