From d8462c2b980eb8fc5eff3d97292bffea63a89ea9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20=C3=81ngel=20Arruga=20Vivas?= Date: Fri, 26 Apr 2019 11:56:43 +0200 Subject: [PATCH 3/4] gnu: grub: Add locale output. * gnu/packages/bootloaders.scm (grub): Add new phase 'install-locale-folder to generate new output used for bootloader localization. --- gnu/packages/bootloaders.scm | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm index 6e6e69ff3b..71411ca954 100644 --- a/gnu/packages/bootloaders.scm +++ b/gnu/packages/bootloaders.scm @@ -94,7 +94,10 @@ "grub-efi-fat-serial-number.patch")))) (build-system gnu-build-system) (arguments - `(#:phases (modify-phases %standard-phases + `(#:modules ((ice-9 ftw) + (guix build utils) + (guix build gnu-build-system)) + #:phases (modify-phases %standard-phases (add-after 'unpack 'patch-stuff (lambda* (#:key inputs #:allow-other-keys) (substitute* "grub-core/Makefile.in" @@ -127,7 +130,30 @@ (substitute* "Makefile.in" (("grub_cmd_date grub_cmd_set_date grub_cmd_sleep") "grub_cmd_date grub_cmd_sleep")) - #t))) + #t)) + (add-after 'install 'install-locale-folder + (lambda* (#:key outputs #:allow-other-keys) + ;; XXX: Better checks are needed here + (define (lang? file) + (not (or (string=? file ".") (string=? file "..")))) + (define (make-lang-installer to) + (lambda (in-file stat flag) + (if (eq? flag 'regular) + (copy-file in-file to) + #t))) + + (let* ((out (assoc-ref outputs "out")) + (locale (string-append out "/share/locale")) + (langs (scandir locale lang?)) + (locale-out (assoc-ref outputs "locale"))) + (mkdir-p locale-out) + (for-each (lambda (lang) + (let ((from (string-append locale "/" lang)) + (to (string-append locale-out "/" + lang ".mo"))) + (ftw from (make-lang-installer to)))) + langs) + #t)))) ;; Disable tests on ARM and AARCH64 platforms. #:tests? ,(not (any (cute string-prefix? <> (or (%current-target-system) (%current-system))) @@ -183,6 +209,7 @@ ("parted" ,parted) ("qemu" ,qemu-minimal-2.10) ("xorriso" ,xorriso))) + (outputs '("out" "locale")) (home-page "https://www.gnu.org/software/grub/") (synopsis "GRand Unified Boot loader") (description @@ -249,8 +276,6 @@ menu to select one of the installed operating systems.") ,@(package-inputs grub-efi))) (arguments (substitute-keyword-arguments (package-arguments grub-efi) - ((#:modules modules `((guix build utils) (guix build gnu-build-system))) - `((ice-9 ftw) ,@modules)) ((#:phases phases) `(modify-phases ,phases (add-after 'install 'install-non-efi -- 2.21.0