gnu: grub: Enable building on powerpc64le-linux.

* gnu/packages/bootloaders.scm (grub)[arguments]: Adjust configure-flags
when building for powerpc64le-linux to use clang.  When building for
powerpc64le-linux add a phase to skip 2 tests.
[native-inputs]: When building for powerpc64le-linux add clang.

Change-Id: I26ce37e7b864964ede5c9fd73a5a2d4cb89ada45
This commit is contained in:
Efraim Flashner 2024-07-18 23:33:32 +03:00
parent 447be4aff8
commit 4ee2a660e5
No known key found for this signature in database
GPG key ID: 41AAE7DCCA3D8351

View file

@ -53,6 +53,7 @@ (define-module (gnu packages bootloaders)
#:use-module (gnu packages gcc)
#:use-module (gnu packages gettext)
#:use-module (gnu packages linux)
#:use-module (gnu packages llvm)
#:use-module (gnu packages man)
#:use-module (gnu packages mtools)
#:use-module (gnu packages ncurses)
@ -132,7 +133,17 @@ (define-public grub
;; Counterintuitively, this *disables* a spurious Python dependency by
;; calling the true binary instead. Python is only needed during
;; bootstrapping (for genptl.py), not when building from a release.
#~(list "PYTHON=true")
#~(append
(list "PYTHON=true")
;; This needs to be compiled with clang for powerpc64le.
(if #$(and=> (%current-target-system)
target-ppc64le?)
(list "TARGET_CC=powerpc64le-linux-gnu-clang")
'())
(if #$(and (target-ppc64le? (%current-system))
(not (%current-target-system)))
(list "CC=clang")
'()))
;; GRUB fails to load modules stripped with --strip-unneeded.
#:strip-flags
@ -185,6 +196,13 @@ (define-public grub
(substitute* "Makefile.in"
(("grub_cmd_date grub_cmd_set_date grub_cmd_sleep")
"grub_cmd_date grub_cmd_sleep"))))
#$@(if (target-ppc64le?)
#~((add-before 'check 'skip-tests
(lambda _
(substitute* "Makefile.in"
((" grub_cmd_date ") " ")
((" pseries_test ") " ")))))
#~())
(add-before 'check 'disable-pixel-perfect-test
(lambda _
;; This test compares many screenshots rendered with an older
@ -204,6 +222,15 @@ (define-public grub
;; is required for generating alternative keyboard layouts.
console-setup)
;; 64-bit PowerPC hardware boots in big-endian mode and then for
;; powerpc64le it switches to little-endian mode. Therefore we
;; need a compiler which can generate both big-endian and
;; little-endian binaries for the bootloader and the utilities
;; and building with clang is the easiest option.
(if (target-ppc64le?)
(list clang)
'())
;; Depend on LVM2 for libdevmapper, used by 'grub-probe' and
;; 'grub-install' to recognize mapped devices (LUKS, etc.)
(if (member (or (%current-target-system)