From bc6e8168155ea017aece23b3a6f099de4a2d2d47 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miguel=20=C3=81ngel=20Arruga=20Vivas?=
<rosen644835@gmail.com>
Date: Fri, 26 Apr 2019 11:56:43 +0200
Subject: [PATCH 3/4] gnu: grub: Add locale output for bootloading.
* gnu/packages/bootloaders.scm (grub): Add needed modules and new output
generated with new phase 'install-locale-folder.
---
gnu/packages/bootloaders.scm | 33 +++++++++++++++++++++++++++++----
1 file changed, 29 insertions(+), 4 deletions(-)
@@ -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-dir lang?))
+ (locale-out (assoc-ref outputs "locale")))
+ (mkdir-p locale-out)
+ (for-each (lambda (lang)
+ (let ((from (string-append locale "/" lang))
+ (to (string-append out-path "/"
+ 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