all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Thiago Jung Bauermann via Guix-patches via <guix-patches@gnu.org>
To: 49672@debbugs.gnu.org
Cc: Thiago Jung Bauermann <bauermann@kolabnow.com>
Subject: [bug#49672] [PATCH 7/9] bootloader: grub: Fix mix of GNU triplet and Nix system identifier
Date: Tue, 20 Jul 2021 22:00:41 -0300	[thread overview]
Message-ID: <20210721010043.632012-7-bauermann@kolabnow.com> (raw)
In-Reply-To: <20210721010043.632012-1-bauermann@kolabnow.com>

‘install-grub-efi-netboot’ calls ‘nix-system->gnu-triplet’ on
‘%current-target-system’, but that parameter already contains a GNU triplet
identifier.

There’s no bug in practice because ‘install-grub-efi-netboot’ only uses the
arch part of the identifier, which is the same for both. Nevertheless, it’s
best to fix the confusion.

Therefore, define a ‘current-target-gnu-triplet’ procedure which returns
the GNU triplet identifier for the current target – whether we are
cross-building or not – and use it in ‘install-grub-efi-netboot’.

Also take the opportunity to use the new procedure in packages ‘gcc-4.7’,
‘rust-1.19’ and ‘mplayer’, which have the same logic as the new procedure.

* gnu/bootloader/grub.scm (install-grub-efi-netboot): Use
‘current-target-gnu-triplet’.
* gnu/packages/gcc.scm (gcc-4.7)[configure-flags]: Likewise.
* gnu/packages/rust.scm (rust-1.19)[arguments]<#:phases>: Likewise.
* gnu/packages/video.scm (mplayer)[arguments]<#:phases>: Likewise.
* guix/utils.scm (current-target-gnu-triplet): Define new procedure.
---
 gnu/bootloader/grub.scm | 5 +----
 gnu/packages/gcc.scm    | 5 +----
 gnu/packages/rust.scm   | 4 +---
 gnu/packages/video.scm  | 4 +---
 guix/utils.scm          | 7 +++++++
 5 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm
index ce146aba3c60..fe82a3c1e9ed 100644
--- a/gnu/bootloader/grub.scm
+++ b/gnu/bootloader/grub.scm
@@ -610,10 +610,7 @@ fi~%"))))
 (define (install-grub-efi-netboot subdir)
   "Define a grub-efi-netboot bootloader installer for installation in SUBDIR,
 which is usually efi/Guix or efi/boot."
-  (let* ((system (string-split (nix-system->gnu-triplet
-                                (or (%current-target-system)
-                                    (%current-system)))
-                               #\-))
+  (let* ((system (string-split (current-target-gnu-triplet) #\-))
          (arch (first system))
          (boot-efi-link (match system
                           ;; These are the supportend systems and the names
diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index 2fe30b13210e..4adcb5fc0d69 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -138,10 +138,7 @@ where the OS part is overloaded to denote a specific ABI---into GCC
                             "--without-headers")))
 
                    ;; Pass the right options for the target triplet.
-                   (let ((triplet
-                          (or (%current-target-system)
-                              (nix-system->gnu-triplet (%current-system)))))
-                     (gcc-configure-flags-for-triplet triplet))
+                   (gcc-configure-flags-for-triplet (current-target-gnu-triplet))
 
                    (maybe-target-tools))))))
     (hidden-package
diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm
index 73f94a3929bd..c8bb4d158711 100644
--- a/gnu/packages/rust.scm
+++ b/gnu/packages/rust.scm
@@ -402,9 +402,7 @@ test = { path = \"../libtest\" }
          (replace 'install
            (lambda* (#:key inputs outputs #:allow-other-keys)
              (let* ((out (assoc-ref outputs "out"))
-                    (target-system ,(or (%current-target-system)
-                                        (nix-system->gnu-triplet
-                                         (%current-system))))
+                    (target-system ,(current-target-gnu-triplet))
                     (out-libs (string-append out "/lib/rustlib/"
                                              target-system "/lib")))
                                         ;(setenv "CFG_PREFIX" out)
diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
index 6cf8b90ffa95..375e2297b889 100644
--- a/gnu/packages/video.scm
+++ b/gnu/packages/video.scm
@@ -2032,9 +2032,7 @@ streaming protocols.")
                            '("--target=mips3-linux"))
                           (_ (list (string-append
                                     "--target="
-                                    (or (%current-target-system)
-                                        (nix-system->gnu-triplet
-                                         (%current-system)))))))
+                                    (current-target-gnu-triplet)))))
                       "--disable-iwmmxt")))))))
     (home-page "https://www.mplayerhq.hu")
     (synopsis "Audio and video player")
diff --git a/guix/utils.scm b/guix/utils.scm
index 4072dea89051..61da05137186 100644
--- a/guix/utils.scm
+++ b/guix/utils.scm
@@ -78,6 +78,7 @@
             %current-system
             %current-target-system
             current-target-nix-system
+            current-target-gnu-triplet
             package-name->name+version
             target-mingw?
             target-arm32?
@@ -527,6 +528,12 @@ cross-building or not."
   (or (and=> (%current-target-system) gnu-triplet->nix-system)
       (%current-system)))
 
+(define (current-target-gnu-triplet)
+  "Return the GNU triplet identifier for the current target, whether we are
+cross-building or not."
+  (or (%current-target-system)
+      (nix-system->gnu-triplet (%current-system))))
+
 (define* (package-name->name+version spec
                                      #:optional (delimiter #\@))
   "Given SPEC, a package name like \"foo@0.9.1b\", return two values: \"foo\"




  parent reply	other threads:[~2021-07-21  1:02 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-21  0:46 [bug#49672] [PATCH 0/9] Target check fixes and cleanups Thiago Jung Bauermann via Guix-patches via
2021-07-21  1:00 ` [bug#49672] [PATCH 1/9] gnu: Fix check of ‘%current-system’ and ‘%current-target-system’ Thiago Jung Bauermann via Guix-patches via
2021-07-21  1:00   ` [bug#49672] [PATCH 2/9] utils: Add ‘current-target-nix-system’ helper Thiago Jung Bauermann via Guix-patches via
2021-07-21  1:00   ` [bug#49672] [PATCH 3/9] gnu: Query membership in ‘supported-systems’ list with Nix identifier Thiago Jung Bauermann via Guix-patches via
2021-07-21  1:00   ` [bug#49672] [PATCH 4/9] gnu: Use ‘current-target-nix-system’ in pattern matches Thiago Jung Bauermann via Guix-patches via
2021-07-21  1:00   ` [bug#49672] [PATCH 5/9] gnu: Use ‘current-target-nix-system’ in prefix checks Thiago Jung Bauermann via Guix-patches via
2021-07-21  1:00   ` [bug#49672] [PATCH 6/9] gnu: Fix GNU/Linux system detection Thiago Jung Bauermann via Guix-patches via
2021-07-21  1:00   ` Thiago Jung Bauermann via Guix-patches via [this message]
2021-07-21  1:00   ` [bug#49672] [PATCH 8/9] gnu: ustr: Don’t pass default argument Thiago Jung Bauermann via Guix-patches via
2021-07-21  1:00   ` [bug#49672] [PATCH 9/9] gnu: Use existing target helpers from ‘(guix utils)’ Thiago Jung Bauermann via Guix-patches via
2021-11-07 11:23 ` [bug#49672] [PATCH 0/9] Target check fixes and cleanups Maxime Devos
2021-11-12  0:56   ` Thiago Jung Bauermann via Guix-patches via
2022-03-27 21:40 ` [bug#49672] [PATCH v2 0/6] Target check fixes for cross compilation Thiago Jung Bauermann via Guix-patches via
2022-03-27 21:40   ` [bug#49672] [PATCH v2 1/6] gnu: Fix GNU/Linux system detection Thiago Jung Bauermann via Guix-patches via
2022-03-27 21:40   ` [bug#49672] [PATCH v2 2/6] gnu: libgc: Use default argument in ‘target-hurd?’ call Thiago Jung Bauermann via Guix-patches via
2022-03-27 21:40   ` [bug#49672] [PATCH v2 3/6] utils: Introduce the ‘current-target-nix-system’ procedure Thiago Jung Bauermann via Guix-patches via
2022-03-27 21:40   ` [bug#49672] [PATCH v2 4/6] gnu: Use ‘current-target-nix-system’ for matches Thiago Jung Bauermann via Guix-patches via
2022-03-27 21:40   ` [bug#49672] [PATCH v2 5/6] gnu: Query membership in ‘supported-systems’ list with Nix identifier Thiago Jung Bauermann via Guix-patches via
2022-03-27 21:40   ` [bug#49672] [PATCH v2 6/6] gnu: Fix check of ‘%current-system’ and ‘%current-target-system’ Thiago Jung Bauermann via Guix-patches via
2022-03-28 12:10   ` [bug#49672] [PATCH v2 0/6] Target check fixes for cross compilation Maxime Devos
2022-03-29  0:12     ` Thiago Jung Bauermann via Guix-patches via
2022-04-29  4:17   ` Thiago Jung Bauermann via Guix-patches via

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210721010043.632012-7-bauermann@kolabnow.com \
    --to=guix-patches@gnu.org \
    --cc=49672@debbugs.gnu.org \
    --cc=bauermann@kolabnow.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.