From patchwork Sat May 7 16:11:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mathieu Othacehe X-Patchwork-Id: 39139 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id CA31427BBEA; Sat, 7 May 2022 17:12:12 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 1D17627BBE9 for ; Sat, 7 May 2022 17:12:12 +0100 (BST) Received: from localhost ([::1]:44972 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nnN2R-00067y-8l for patchwork@mira.cbaines.net; Sat, 07 May 2022 12:12:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37670) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnN2I-00067Y-C1 for guix-patches@gnu.org; Sat, 07 May 2022 12:12:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:58911) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nnN2I-00038K-2x for guix-patches@gnu.org; Sat, 07 May 2022 12:12:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nnN2H-0006N1-Us for guix-patches@gnu.org; Sat, 07 May 2022 12:12:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#55220] [PATCH v2 1/6] platform: Introduce new platforms. Resent-From: Mathieu Othacehe Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 07 May 2022 16:12:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55220 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 55220@debbugs.gnu.org Cc: Mathieu Othacehe Received: via spool by 55220-submit@debbugs.gnu.org id=B55220.165193990524391 (code B ref 55220); Sat, 07 May 2022 16:12:01 +0000 Received: (at 55220) by debbugs.gnu.org; 7 May 2022 16:11:45 +0000 Received: from localhost ([127.0.0.1]:52787 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nnN1x-0006L6-K9 for submit@debbugs.gnu.org; Sat, 07 May 2022 12:11:45 -0400 Received: from eggs.gnu.org ([209.51.188.92]:44330) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nnN1w-0006Ki-2Y for 55220@debbugs.gnu.org; Sat, 07 May 2022 12:11:40 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:41068) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnN1q-00032B-T4 for 55220@debbugs.gnu.org; Sat, 07 May 2022 12:11:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=5z+xZLiNqZjKj33SElfsgp99LiTd7JigOuZWl79mnfk=; b=N+vox5wuwYsJNGpDmX2a LMlnTGFAiv+NLI55VzMPlr9LLEkMRFRACjxMLTNHs6zPwv/86Oh1RWRMqc/8asXhSJtYcyqL+6/mj FxMQpP+VcZLkQnEpSX9D7iEdOb5IbDMK7do8kS8i6w8Z39XK5nnemR0duNRGrXpfqZjc7JDqI6WtH iqRwBcTsWSgq60/pf50IRokdoIKWBLo7QP6iHrUpCXK2w6kUoFSQ5BMGOD4md0gAMLuE5p7pYA9ij njNXmCO1NlXF3JC1ODpvLXzPdkk/lC8Fx/LULYpkP9u4folQVQ5PtjGZX6dIfWY5by0Jcxt8MOfgw YS62QG/8blgUBg==; Received: from 71.125.192.77.rev.sfr.net ([77.192.125.71]:40324 helo=localhost.localdomain) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nnN1q-0004uM-FF; Sat, 07 May 2022 12:11:34 -0400 From: Mathieu Othacehe Date: Sat, 7 May 2022 18:11:21 +0200 Message-Id: <20220507161126.14553-2-othacehe@gnu.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220507161126.14553-1-othacehe@gnu.org> References: <20220507161126.14553-1-othacehe@gnu.org> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/platforms/intel.scm: New file. * gnu/platforms/mips.scm: Ditto. * gnu/platforms/powerpc.scm: Ditto. * gnu/platforms/riscv.scm: Ditto. * gnu/platforms/s390.scm: Ditto. * gnu/local.mk (GNU_SYSTEM_MODULES): Add them. Signed-off-by: Mathieu Othacehe --- gnu/local.mk | 5 ++++ gnu/platforms/intel.scm | 48 +++++++++++++++++++++++++++++++++++++++ gnu/platforms/mips.scm | 29 +++++++++++++++++++++++ gnu/platforms/powerpc.scm | 36 +++++++++++++++++++++++++++++ gnu/platforms/riscv.scm | 29 +++++++++++++++++++++++ gnu/platforms/s390.scm | 29 +++++++++++++++++++++++ 6 files changed, 176 insertions(+) create mode 100644 gnu/platforms/intel.scm create mode 100644 gnu/platforms/mips.scm create mode 100644 gnu/platforms/powerpc.scm create mode 100644 gnu/platforms/riscv.scm create mode 100644 gnu/platforms/s390.scm diff --git a/gnu/local.mk b/gnu/local.mk index c100b97cc1..b8ce581a5d 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -633,6 +633,11 @@ GNU_SYSTEM_MODULES = \ \ %D%/platforms/arm.scm \ %D%/platforms/hurd.scm \ + %D%/platforms/intel.scm \ + %D%/platforms/mips.scm \ + %D%/platforms/powerpc.scm \ + %D%/platforms/riscv.scm \ + %D%/platforms/s390.scm \ \ %D%/services.scm \ %D%/services/admin.scm \ diff --git a/gnu/platforms/intel.scm b/gnu/platforms/intel.scm new file mode 100644 index 0000000000..ee9fe003a7 --- /dev/null +++ b/gnu/platforms/intel.scm @@ -0,0 +1,48 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2022 Mathieu Othacehe +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (gnu platforms intel) + #:use-module (gnu platform) + #:use-module (gnu packages linux) + #:use-module (guix records) + #:export (intel32-linux + intel64-linux + intel32-mingw + intel64-mingw)) + +(define intel32-linux + (platform + (target "i686-linux-gnu") + (system "i686-linux") + (linux-architecture "i386"))) + +(define intel64-linux + (platform + (target "x86_64-linux-gnu") + (system "x86_64-linux") + (linux-architecture "x86_64"))) + +(define intel32-mingw + (platform + (target "i686-w64-mingw32") + (system #f))) + +(define intel64-mingw + (platform + (target "x86_64-w64-mingw32") + (system #f))) diff --git a/gnu/platforms/mips.scm b/gnu/platforms/mips.scm new file mode 100644 index 0000000000..84a492699d --- /dev/null +++ b/gnu/platforms/mips.scm @@ -0,0 +1,29 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2022 Mathieu Othacehe +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (gnu platforms mips) + #:use-module (gnu platform) + #:use-module (gnu packages linux) + #:use-module (guix records) + #:export (mips64-linux)) + +(define mips64-linux + (platform + (target "mips64el-linux-gnu") + (system "mips64el-linux") + (linux-architecture "mips"))) diff --git a/gnu/platforms/powerpc.scm b/gnu/platforms/powerpc.scm new file mode 100644 index 0000000000..8fadfe88de --- /dev/null +++ b/gnu/platforms/powerpc.scm @@ -0,0 +1,36 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2022 Mathieu Othacehe +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (gnu platforms powerpc) + #:use-module (gnu platform) + #:use-module (gnu packages linux) + #:use-module (guix records) + #:export (powerpc-linux + powerpc64le-linux)) + +(define powerpc-linux + (platform + (target "powerpc-linux-gnu") + (system "powerpc-linux") + (linux-architecture "powerpc"))) + +(define powerpc64le-linux + (platform + (target "powerpc64le-linux-gnu") + (system "powerpc64le-linux") + (linux-architecture "powerpc"))) diff --git a/gnu/platforms/riscv.scm b/gnu/platforms/riscv.scm new file mode 100644 index 0000000000..29a34402a2 --- /dev/null +++ b/gnu/platforms/riscv.scm @@ -0,0 +1,29 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2022 Mathieu Othacehe +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (gnu platforms riscv) + #:use-module (gnu platform) + #:use-module (gnu packages linux) + #:use-module (guix records) + #:export (riscv64-linux)) + +(define riscv64-linux + (platform + (target "riscv64-linux-gnu") + (system "riscv64-linux") + (linux-architecture "riscv"))) diff --git a/gnu/platforms/s390.scm b/gnu/platforms/s390.scm new file mode 100644 index 0000000000..c8caafbe45 --- /dev/null +++ b/gnu/platforms/s390.scm @@ -0,0 +1,29 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2022 Mathieu Othacehe +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (gnu platforms s390) + #:use-module (gnu platform) + #:use-module (gnu packages linux) + #:use-module (guix records) + #:export (s390x-linux)) + +(define s390x-linux + (platform + (target "s390x-linux-gnu") + (system "s390x-linux") + (linux-architecture "s390"))) From patchwork Sat May 7 16:11:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Othacehe X-Patchwork-Id: 39143 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id BD34527BBE9; Sat, 7 May 2022 17:12:29 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 3D3D327BBEA for ; Sat, 7 May 2022 17:12:29 +0100 (BST) Received: from localhost ([::1]:45702 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nnN2i-0006eh-Eg for patchwork@mira.cbaines.net; Sat, 07 May 2022 12:12:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37672) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnN2I-00067h-OD for guix-patches@gnu.org; Sat, 07 May 2022 12:12:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:58912) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nnN2I-00038S-Fu for guix-patches@gnu.org; Sat, 07 May 2022 12:12:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nnN2I-0006N8-BP for guix-patches@gnu.org; Sat, 07 May 2022 12:12:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#55220] [PATCH v2 2/6] platform: Add discovery support. Resent-From: Mathieu Othacehe Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 07 May 2022 16:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55220 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 55220@debbugs.gnu.org Cc: Mathieu Othacehe Received: via spool by 55220-submit@debbugs.gnu.org id=B55220.165193990724406 (code B ref 55220); Sat, 07 May 2022 16:12:02 +0000 Received: (at 55220) by debbugs.gnu.org; 7 May 2022 16:11:47 +0000 Received: from localhost ([127.0.0.1]:52795 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nnN22-0006LY-AR for submit@debbugs.gnu.org; Sat, 07 May 2022 12:11:46 -0400 Received: from eggs.gnu.org ([209.51.188.92]:44334) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nnN20-0006Kn-H8 for 55220@debbugs.gnu.org; Sat, 07 May 2022 12:11:44 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:41092) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnN1v-00032N-98 for 55220@debbugs.gnu.org; Sat, 07 May 2022 12:11:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=3V5APXjzhmLTWK9RABEXykFLvecakNsvos0LnxZYYJc=; b=GIj0bf2IrBQN4hvsi0Ir K8sAPVwgjhk8He2x/8+x2KtYwC0GGOxoAo6TZ+MA4aZVcGvmlgzheG72vg7j0Lkw1WETy/5SDZV1b LJlZJTP/YP6AmJY8H9lZXukRLN3Dh2gOMDOEldWl0o6lJ8JoW2eCHryaoxGWsrTtt/ocGwweEWe3k 6U08kFHBuTdz17KaBHhMfKsOgM4O4IJKY3ZVTvLCEE0bSehrkFRDCSI6hlzZgRmcJY0EtDLLKJFaB xZu8vlouNqwsJVaOJzsIe+hJlGNjLSlbbNXpkEuXHGwCQjHY7V5cwaFZGgSteHIKfB/Vwr5lQGJZN RawbwhkNhbMFqQ==; Received: from 71.125.192.77.rev.sfr.net ([77.192.125.71]:40324 helo=localhost.localdomain) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nnN1r-0004uM-3n; Sat, 07 May 2022 12:11:38 -0400 From: Mathieu Othacehe Date: Sat, 7 May 2022 18:11:22 +0200 Message-Id: <20220507161126.14553-3-othacehe@gnu.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220507161126.14553-1-othacehe@gnu.org> References: <20220507161126.14553-1-othacehe@gnu.org> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/platform.scm (platform-modules, systems, targets, lookup-platform-by-system, lookup-platform-by-target, lookup-platform-by-target-or-system platform-system->target, platform-target->system): New procedures. (%platforms): New variable. Signed-off-by: Mathieu Othacehe --- gnu/platform.scm | 101 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 98 insertions(+), 3 deletions(-) diff --git a/gnu/platform.scm b/gnu/platform.scm index bb6519c71a..4c5211e107 100644 --- a/gnu/platform.scm +++ b/gnu/platform.scm @@ -17,22 +17,117 @@ ;;; along with GNU Guix. If not, see . (define-module (gnu platform) + #:use-module (guix discovery) + #:use-module (guix memoization) #:use-module (guix records) + #:use-module (guix ui) + #:use-module (srfi srfi-1) #:export (platform platform? platform-target platform-system - platform-linux-architecture)) + platform-linux-architecture + + platform-modules + platforms + lookup-platform-by-system + lookup-platform-by-target + lookup-platform-by-target-or-system + platform-system->target + platform-target->system + + systems + targets)) ;;; ;;; Platform record. ;;; -;; Description of a platform supported by the GNU system. +;; Description of a platform supported by GNU Guix. +;; +;; The 'target' field must be a valid GNU triplet as defined here: +;; https://www.gnu.org/software/autoconf/manual/autoconf-2.68/html_node/Specifying-Target-Triplets.html. +;; It is used for cross-compilation purposes. +;; +;; The 'system' field is the name of the corresponding system as defined in +;; the (gnu packages bootstrap) module. It can be for instance +;; "aarch64-linux" or "armhf-linux". It is used to emulate a different host +;; architecture, for instance i686-linux on x86_64-linux-gnu, or armhf-linux +;; on x86_64-linux, using the QEMU binfmt transparent emulation mechanism. +;; +;; The 'linux-architecture' is only relevant if the kernel is Linux. In that +;; case, it corresponds to the ARCH variable used when building Linux. (define-record-type* platform make-platform platform? (target platform-target) ;"x86_64-linux-gnu" (system platform-system) ;"x86_64-linux" - (linux-architecture platform-linux-architecture ;"amd64" + (linux-architecture platform-linux-architecture ;"x86" (default #f))) + +;;; +;;; Platforms. +;;; + +(define (platform-modules) + "Return the list of platform modules." + (all-modules (map (lambda (entry) + `(,entry . "gnu/platforms")) + %load-path) + #:warn warn-about-load-error)) + +(define platforms + ;; The list of publically-known platforms. + (memoize + (lambda () + (fold-module-public-variables (lambda (obj result) + (if (platform? obj) + (cons obj result) + result)) + '() + (platform-modules))))) + +(define (lookup-platform-by-system system) + "Return the platform corresponding to the given SYSTEM." + (find (lambda (platform) + (let ((s (platform-system platform))) + (and (string? s) (string=? s system)))) + (platforms))) + +(define (lookup-platform-by-target target) + "Return the platform corresponding to the given TARGET." + (find (lambda (platform) + (let ((t (platform-target platform))) + (and (string? t) (string=? t target)))) + (platforms))) + +(define (lookup-platform-by-target-or-system target-or-system) + "Return the platform corresponding to the given TARGET or SYSTEM." + (or (lookup-platform-by-target target-or-system) + (lookup-platform-by-system target-or-system))) + +(define (platform-system->target system) + "Return the target matching the given SYSTEM if it exists or false +otherwise." + (let ((platform (lookup-platform-by-system system))) + (and=> platform platform-target))) + +(define (platform-target->system target) + "Return the system matching the given TARGET if it exists or false +otherwise." + (let ((platform (lookup-platform-by-target system))) + (and=> platform platform-system))) + + +;;; +;;; Systems & Targets. +;;; + +(define (systems) + "Return the list of supported systems." + (delete-duplicates + (filter-map platform-system (platforms)))) + +(define (targets) + "Return the list of supported targets." + (map platform-target (platforms))) From patchwork Sat May 7 16:11:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Othacehe X-Patchwork-Id: 39140 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id E5FE127BBEA; Sat, 7 May 2022 17:12:13 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id ABC9A27BBE9 for ; Sat, 7 May 2022 17:12:13 +0100 (BST) Received: from localhost ([::1]:45026 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nnN2S-0006AM-Sk for patchwork@mira.cbaines.net; Sat, 07 May 2022 12:12:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37674) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnN2J-00067p-4R for guix-patches@gnu.org; Sat, 07 May 2022 12:12:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:58913) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nnN2I-00038Y-SA for guix-patches@gnu.org; Sat, 07 May 2022 12:12:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nnN2I-0006NG-Nl for guix-patches@gnu.org; Sat, 07 May 2022 12:12:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#55220] [PATCH v2 3/6] ci: Do not rely on hardcoded cross-targets lists. Resent-From: Mathieu Othacehe Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 07 May 2022 16:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55220 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 55220@debbugs.gnu.org Cc: Mathieu Othacehe Received: via spool by 55220-submit@debbugs.gnu.org id=B55220.165193990724421 (code B ref 55220); Sat, 07 May 2022 16:12:02 +0000 Received: (at 55220) by debbugs.gnu.org; 7 May 2022 16:11:47 +0000 Received: from localhost ([127.0.0.1]:52799 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nnN22-0006La-Om for submit@debbugs.gnu.org; Sat, 07 May 2022 12:11:47 -0400 Received: from eggs.gnu.org ([209.51.188.92]:44336) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nnN21-0006Ku-7T for 55220@debbugs.gnu.org; Sat, 07 May 2022 12:11:45 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:41098) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnN1w-00032o-2A for 55220@debbugs.gnu.org; Sat, 07 May 2022 12:11:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=qjBL13rKtG9zMnPoNlMBKnYEpm5ekMk+toRUAUm0KA4=; b=N+5AVQZ7yqMLuZCDn86V S0ob60deypb0v5KvYtW9A85O5+/FRPuxb0D5C7uloH4gkLsBJ/hgpj/QCDHZEqG7sAdHN0Z8VplDG /PGfIiKuFzQ84SVbe+8aVTlm58/QlJYwTKpHUdktEk2SKvIIoWJVIDzsTwoe94lZJVVvX4NYZ5WCo 1a1MkmbSw5VR5Chgu13tEvDwdLKFggKIhPV+vSpwBZRtkxHgBmODnkZY42Px4cNr2DYwwBKr5FtIF CUuvvZXXmVR4Onw2VNdQCN5XkajR/qdt6MvpamYi9HB904lTyQcxONOzfTE57Qxi0CSqSzjlgM6Hw bkFOnv/D71G8qg==; Received: from 71.125.192.77.rev.sfr.net ([77.192.125.71]:40324 helo=localhost.localdomain) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nnN1v-0004uM-Io; Sat, 07 May 2022 12:11:39 -0400 From: Mathieu Othacehe Date: Sat, 7 May 2022 18:11:23 +0200 Message-Id: <20220507161126.14553-4-othacehe@gnu.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220507161126.14553-1-othacehe@gnu.org> References: <20220507161126.14553-1-othacehe@gnu.org> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/ci.scm (%cross-targets): Remove it ... (cross-jobs): ... and use the targets procedure instead. * etc/release-manifest.scm: Adapt it. Signed-off-by: Mathieu Othacehe --- etc/release-manifest.scm | 4 ++-- gnu/ci.scm | 15 ++------------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/etc/release-manifest.scm b/etc/release-manifest.scm index e7e64efda4..1098f491ba 100644 --- a/etc/release-manifest.scm +++ b/etc/release-manifest.scm @@ -23,7 +23,7 @@ (use-modules (gnu packages) (guix packages) (guix profiles) - ((gnu ci) #:select (%cross-targets)) + ((gnu platform) #:select (targets)) ((gnu services xorg) #:select (%default-xorg-modules)) (guix utils) (srfi srfi-1) @@ -144,7 +144,7 @@ (define %cross-manifest %packages-to-cross-build))) ;; XXX: Important bits like libsigsegv and libffi don't support ;; RISCV at the moment, so don't require RISCV support. - (delete "riscv64-linux-gnu" %cross-targets)))) + (delete "riscv64-linux-gnu" (targets))))) (define %cross-bootstrap-manifest (manifest diff --git a/gnu/ci.scm b/gnu/ci.scm index 35fd583f75..9de1b54fc8 100644 --- a/gnu/ci.scm +++ b/gnu/ci.scm @@ -55,6 +55,7 @@ (define-module (gnu ci) #:use-module (gnu packages multiprecision) #:use-module (gnu packages make-bootstrap) #:use-module (gnu packages package-management) + #:use-module (gnu platform) #:use-module (gnu system) #:use-module (gnu system image) #:use-module (gnu system vm) @@ -71,7 +72,6 @@ (define-module (gnu ci) image->job %core-packages - %cross-targets channel-source->package arguments->systems @@ -169,17 +169,6 @@ (define (packages-to-cross-build target) (drop-right %core-packages 6) %core-packages)) -(define %cross-targets - '("mips64el-linux-gnu" - "arm-linux-gnueabihf" - "aarch64-linux-gnu" - "powerpc-linux-gnu" - "powerpc64le-linux-gnu" - "riscv64-linux-gnu" - "i586-pc-gnu" ;aka. GNU/Hurd - "i686-w64-mingw32" - "x86_64-w64-mingw32")) - (define (cross-jobs store system) "Return a list of cross-compilation jobs for SYSTEM." (define (from-32-to-64? target) @@ -221,7 +210,7 @@ (define (either proc1 proc2 proc3) package target system)) (packages-to-cross-build target))) (remove (either from-32-to-64? same? pointless?) - %cross-targets))) + (targets)))) (define* (guix-jobs store systems #:key source commit) "Return a list of jobs for Guix itself." From patchwork Sat May 7 16:11:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Othacehe X-Patchwork-Id: 39141 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id A34B627BBEA; Sat, 7 May 2022 17:12:26 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 70B5127BBE9 for ; Sat, 7 May 2022 17:12:25 +0100 (BST) Received: from localhost ([::1]:45612 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nnN2e-0006b6-Kp for patchwork@mira.cbaines.net; Sat, 07 May 2022 12:12:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37676) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnN2J-00067x-Gx for guix-patches@gnu.org; Sat, 07 May 2022 12:12:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:58914) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nnN2J-00038e-8J for guix-patches@gnu.org; Sat, 07 May 2022 12:12:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nnN2J-0006NN-3p for guix-patches@gnu.org; Sat, 07 May 2022 12:12:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#55220] [PATCH v2 4/6] scripts: Add --list-systems and --list-targets options. Resent-From: Mathieu Othacehe Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 07 May 2022 16:12:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55220 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 55220@debbugs.gnu.org Cc: Mathieu Othacehe Received: via spool by 55220-submit@debbugs.gnu.org id=B55220.165193991124447 (code B ref 55220); Sat, 07 May 2022 16:12:03 +0000 Received: (at 55220) by debbugs.gnu.org; 7 May 2022 16:11:51 +0000 Received: from localhost ([127.0.0.1]:52803 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nnN25-0006MC-MX for submit@debbugs.gnu.org; Sat, 07 May 2022 12:11:50 -0400 Received: from eggs.gnu.org ([209.51.188.92]:44340) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nnN21-0006L0-R4 for 55220@debbugs.gnu.org; Sat, 07 May 2022 12:11:46 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:41102) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnN1w-000337-Kv for 55220@debbugs.gnu.org; Sat, 07 May 2022 12:11:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=/uecfqvupGrF8DjJjM1E6XMwaZaJYr26Pt+jnmpXjk0=; b=ePG2Uk00/Tr2FaIXxK/y TyuuzgG42by8chgc1Hm86q8t9ccu4b4ADoUSUySfiWQAMKtSC7APoWYQoduasBLl8nfrvMPiO0E23 IuuPE26Qddt2UdSyMgHSi1r7IsIlLjf7L3uI2cguLL6BklWIUnG5q7uxn6lvFqqbQYTRTP2xyuRwO c4lVrXSNON6chuYE5k4w5kyrp0anwORI+da69MgtD4Y0gwpcNhEa9y676M4i2rZulxa2aURxWVP4I jjyfhfNdzIw5wgZ2Wf1hlqFW7kAbCnRe2jKg99Sl7wmoGewM1Wj93K0yM8CmjOLPSnmlKKkk2LpDb JwzKCqZNTAo7iw==; Received: from 71.125.192.77.rev.sfr.net ([77.192.125.71]:40324 helo=localhost.localdomain) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nnN1w-0004uM-6j; Sat, 07 May 2022 12:11:40 -0400 From: Mathieu Othacehe Date: Sat, 7 May 2022 18:11:24 +0200 Message-Id: <20220507161126.14553-5-othacehe@gnu.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220507161126.14553-1-othacehe@gnu.org> References: <20220507161126.14553-1-othacehe@gnu.org> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches Also factorize the --system and --target build options. Check that the passed system and target arguments are known platforms. * doc/guix.texi (Additional Build Options): Document the new --list-systems and --list-targets options. * guix/scripts/build.scm (show-cross-build-options-help, show-emulated-build-options-help, list-systems, list-targets): New procedures. (%standard-cross-build-options, %standard-emulated-build-options): New variables. (show-help): Remove --system and --target entries and use show-cross-build-options-help and show-emulated-build-options-help procedures instead. (%options): Remove --system and --target entries and use %standard-cross-build-options and %standard-emulated-build-options variables instead. * guix/scripts/archive.scm (show-help, %options): Adapt them. * guix/scripts/environment.scm: Ditto. * guix/scripts/graph.scm: Ditto. * guix/scripts/pack.scm: Ditto. * guix/scripts/pull.scm: Ditto. * guix/scripts/size.scm: Ditto. * guix/scripts/weather.scm: Ditto. Signed-off-by: Mathieu Othacehe --- doc/guix.texi | 8 ++++ guix/scripts/archive.scm | 20 +++------ guix/scripts/build.scm | 84 ++++++++++++++++++++++++++++++------ guix/scripts/environment.scm | 11 ++--- guix/scripts/graph.scm | 15 +++---- guix/scripts/pack.scm | 20 +++------ guix/scripts/pull.scm | 12 +++--- guix/scripts/size.scm | 13 +++--- guix/scripts/weather.scm | 11 +++-- 9 files changed, 120 insertions(+), 74 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 5399584cb0..6757c105dc 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -12025,6 +12025,14 @@ Cross-build for @var{triplet}, which must be a valid GNU triplet, such as @code{"aarch64-linux-gnu"} (@pxref{Specifying Target Triplets, GNU configuration triplets,, autoconf, Autoconf}). +@item --list-systems +List all the supported systems, than can be passed as an argument to +@option{--system}. + +@item --list-targets +List all the supported targets, than can be passed as an argument to +@option{--target}. + @anchor{build-check} @item --check @cindex determinism, checking diff --git a/guix/scripts/archive.scm b/guix/scripts/archive.scm index f8678aa5f9..1e961c84e6 100644 --- a/guix/scripts/archive.scm +++ b/guix/scripts/archive.scm @@ -93,14 +93,14 @@ (define (show-help) (display (G_ " -S, --source build the packages' source derivations")) (display (G_ " - -s, --system=SYSTEM attempt to build for SYSTEM--e.g., \"i686-linux\"")) - (display (G_ " - --target=TRIPLET cross-build for TRIPLET--e.g., \"armel-linux-gnu\"")) - (display (G_ " -v, --verbosity=LEVEL use the given verbosity LEVEL")) (newline) (show-build-options-help) + (newline) + (show-cross-build-options-help) + (newline) + (show-native-build-options-help) (newline) (display (G_ " @@ -166,14 +166,6 @@ (define %options (option '(#\S "source") #f #f (lambda (opt name arg result) (alist-cons 'source? #t result))) - (option '(#\s "system") #t #f - (lambda (opt name arg result) - (alist-cons 'system arg - (alist-delete 'system result eq?)))) - (option '("target") #t #f - (lambda (opt name arg result) - (alist-cons 'target arg - (alist-delete 'target result eq?)))) (option '(#\e "expression") #t #f (lambda (opt name arg result) (alist-cons 'expression arg result))) @@ -186,7 +178,9 @@ (define %options (lambda (opt name arg result) (alist-cons 'dry-run? #t result))) - %standard-build-options)) + (append %standard-build-options + %standard-cross-build-options + %standard-native-build-options))) (define (derivation-from-expression store str package-derivation system source?) diff --git a/guix/scripts/build.scm b/guix/scripts/build.scm index d9cdb6e5e0..a09c54451f 100644 --- a/guix/scripts/build.scm +++ b/guix/scripts/build.scm @@ -47,6 +47,7 @@ (define-module (guix scripts build) #:use-module (srfi srfi-35) #:use-module (srfi srfi-37) #:use-module (gnu packages) + #:use-module (gnu platform) #:use-module ((guix status) #:select (with-status-verbosity)) #:use-module ((guix progress) #:select (current-terminal-columns)) #:use-module ((guix build syscalls) #:select (terminal-columns)) @@ -54,9 +55,15 @@ (define-module (guix scripts build) #:export (log-url %standard-build-options + %standard-cross-build-options + %standard-native-build-options + set-build-options-from-command-line set-build-options-from-command-line* + show-build-options-help + show-cross-build-options-help + show-native-build-options-help guix-build register-root @@ -184,6 +191,18 @@ (define (show-build-options-help) (display (G_ " --debug=LEVEL produce debugging output at LEVEL"))) +(define (show-cross-build-options-help) + (display (G_ " + --list-targets list available targets")) + (display (G_ " + --target=TRIPLET cross-build for TRIPLET--e.g., \"aarch64-linux-gnu\""))) + +(define (show-native-build-options-help) + (display (G_ " + --list-systems list available systems")) + (display (G_ " + -s, --system=SYSTEM attempt to build for SYSTEM--e.g., \"i686-linux\""))) + (define (set-build-options-from-command-line store opts) "Given OPTS, an alist as returned by 'args-fold' given '%standard-build-options', set the corresponding build options on STORE." @@ -319,6 +338,52 @@ (define %standard-build-options (leave (G_ "not a number: '~a' option argument: ~a~%") name arg))))))) +(define (list-systems) + "Print the available systems." + (display (G_ "The available systems are:\n")) + (newline) + (format #t "~{ - ~a ~%~}" + (sort (systems) stringthings-to-build opts) "Read the arguments from OPTS and return a list of high-level objects to diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm index 07b54cd89b..3216235937 100644 --- a/guix/scripts/environment.scm +++ b/guix/scripts/environment.scm @@ -96,8 +96,6 @@ (define (show-environment-options-help) (display (G_ " --search-paths display needed environment variable definitions")) (display (G_ " - -s, --system=SYSTEM attempt to build for SYSTEM--e.g., \"i686-linux\"")) - (display (G_ " -r, --root=FILE make FILE a symlink to the result, and register it as a garbage collector root")) (display (G_ " @@ -145,6 +143,8 @@ (define (show-help) (newline) (show-build-options-help) (newline) + (show-native-build-options-help) + (newline) (show-transformation-options-help) (newline) (display (G_ " @@ -226,10 +226,6 @@ (define %options (option '(#\n "dry-run") #f #f (lambda (opt name arg result) (alist-cons 'dry-run? #t result))) - (option '(#\s "system") #t #f - (lambda (opt name arg result) - (alist-cons 'system arg - (alist-delete 'system result eq?)))) (option '(#\C "container") #f #f (lambda (opt name arg result) (alist-cons 'container? #t result))) @@ -273,7 +269,8 @@ (define %options (alist-cons 'bootstrap? #t result))) (append %transformation-options - %standard-build-options))) + %standard-build-options + %standard-native-build-options))) (define (pick-all alist key) "Return a list of values in ALIST associated with KEY." diff --git a/guix/scripts/graph.scm b/guix/scripts/graph.scm index 535875c858..2f102180c9 100644 --- a/guix/scripts/graph.scm +++ b/guix/scripts/graph.scm @@ -39,7 +39,9 @@ (define-module (guix scripts graph) options->transformation %transformation-options)) #:use-module ((guix scripts build) - #:select (%standard-build-options)) + #:select (%standard-build-options + %standard-native-build-options + show-native-build-options-help)) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) #:use-module (srfi srfi-34) @@ -504,10 +506,6 @@ (define %options (option '(#\e "expression") #t #f (lambda (opt name arg result) (alist-cons 'expression arg result))) - (option '(#\s "system") #t #f - (lambda (opt name arg result) - (alist-cons 'system arg - (alist-delete 'system result eq?)))) (find (lambda (option) (member "load-path" (option-names option))) %standard-build-options) @@ -519,7 +517,8 @@ (define %options (lambda args (show-version-and-exit "guix graph"))) - %transformation-options)) + (append %transformation-options + %standard-native-build-options))) (define (show-help) ;; TRANSLATORS: Here 'dot' is the name of a program; it must not be @@ -540,8 +539,6 @@ (define (show-help) --path display the shortest path between the given nodes")) (display (G_ " -e, --expression=EXPR consider the package EXPR evaluates to")) - (display (G_ " - -s, --system=SYSTEM consider the graph for SYSTEM--e.g., \"i686-linux\"")) (newline) (display (G_ " -L, --load-path=DIR prepend DIR to the package module search path")) @@ -553,6 +550,8 @@ (define (show-help) (display (G_ " -V, --version display version information and exit")) (newline) + (show-native-build-options-help) + (newline) (show-bug-report-information)) (define %default-options diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm index 32f0d3abb1..d3ee69840c 100644 --- a/guix/scripts/pack.scm +++ b/guix/scripts/pack.scm @@ -1244,17 +1244,9 @@ (define %options (option '(#\m "manifest") #t #f (lambda (opt name arg result) (alist-cons 'manifest arg result))) - (option '(#\s "system") #t #f - (lambda (opt name arg result) - (alist-cons 'system arg - (alist-delete 'system result eq?)))) (option '("entry-point") #t #f (lambda (opt name arg result) (alist-cons 'entry-point arg result))) - (option '("target") #t #f - (lambda (opt name arg result) - (alist-cons 'target arg - (alist-delete 'target result eq?)))) (option '(#\C "compression") #t #f (lambda (opt name arg result) (alist-cons 'compressor (lookup-compressor arg) @@ -1305,13 +1297,19 @@ (define %options (append %deb-format-options %transformation-options - %standard-build-options))) + %standard-build-options + %standard-cross-build-options + %standard-native-build-options))) (define (show-help) (display (G_ "Usage: guix pack [OPTION]... PACKAGE... Create a bundle of PACKAGE.\n")) (show-build-options-help) (newline) + (show-cross-build-options-help) + (newline) + (show-native-build-options-help) + (newline) (show-transformation-options-help) (newline) (show-deb-format-options) @@ -1325,10 +1323,6 @@ (define (show-help) (display (G_ " -e, --expression=EXPR consider the package EXPR evaluates to")) (display (G_ " - -s, --system=SYSTEM attempt to build for SYSTEM--e.g., \"i686-linux\"")) - (display (G_ " - --target=TRIPLET cross-build for TRIPLET--e.g., \"armel-linux-gnu\"")) - (display (G_ " -C, --compression=TOOL compress using TOOL--e.g., \"lzip\"")) (display (G_ " -S, --symlink=SPEC create symlinks to the profile according to SPEC")) diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm index 7402782ff3..11a1bf0734 100644 --- a/guix/scripts/pull.scm +++ b/guix/scripts/pull.scm @@ -118,12 +118,13 @@ (define (show-help) -p, --profile=PROFILE use PROFILE instead of ~/.config/guix/current")) (display (G_ " -v, --verbosity=LEVEL use the given verbosity LEVEL")) - (display (G_ " - -s, --system=SYSTEM attempt to build for SYSTEM--e.g., \"i686-linux\"")) (display (G_ " --bootstrap use the bootstrap Guile to build the new Guix")) (newline) (show-build-options-help) + (newline) + (show-native-build-options-help) + (newline) (display (G_ " -h, --help display this help and exit")) (display (G_ " @@ -184,10 +185,6 @@ (define %options (lambda (opt name arg result) (alist-cons 'profile (canonicalize-profile arg) result))) - (option '(#\s "system") #t #f - (lambda (opt name arg result) - (alist-cons 'system arg - (alist-delete 'system result eq?)))) (option '(#\n "dry-run") #f #f (lambda (opt name arg result) (alist-cons 'dry-run? #t result))) @@ -208,7 +205,8 @@ (define %options (lambda args (show-version-and-exit "guix pull"))) - %standard-build-options)) + (append %standard-build-options + %standard-native-build-options))) (define (warn-about-backward-updates channel start commit relation) "Warn about non-forward updates of CHANNEL from START to COMMIT, without diff --git a/guix/scripts/size.scm b/guix/scripts/size.scm index e46983382a..5bb970443c 100644 --- a/guix/scripts/size.scm +++ b/guix/scripts/size.scm @@ -235,8 +235,6 @@ (define (show-help) (display (G_ " --substitute-urls=URLS fetch substitute from URLS if they are authorized")) - (display (G_ " - -s, --system=SYSTEM consider packages for SYSTEM--e.g., \"i686-linux\"")) ;; TRANSLATORS: "closure" and "self" must not be translated. (display (G_ " --sort=KEY sort according to KEY--\"closure\" or \"self\"")) @@ -251,15 +249,13 @@ (define (show-help) (display (G_ " -V, --version display version information and exit")) (newline) + (show-native-build-options-help) + (newline) (show-bug-report-information)) (define %options ;; Specifications of the command-line options. - (list (option '(#\s "system") #t #f - (lambda (opt name arg result) - (alist-cons 'system arg - (alist-delete 'system result eq?)))) - (option '("substitute-urls") #t #f + (cons* (option '("substitute-urls") #t #f (lambda (opt name arg result . rest) (apply values (alist-cons 'substitute-urls @@ -287,7 +283,8 @@ (define %options (exit 0))) (option '(#\V "version") #f #f (lambda args - (show-version-and-exit "guix size"))))) + (show-version-and-exit "guix size"))) + %standard-native-build-options)) (define %default-options `((system . ,(%current-system)) diff --git a/guix/scripts/weather.scm b/guix/scripts/weather.scm index adba614b8c..b7d8165262 100644 --- a/guix/scripts/weather.scm +++ b/guix/scripts/weather.scm @@ -40,6 +40,7 @@ (define-module (guix scripts weather) #:use-module (guix ci) #:use-module (guix sets) #:use-module (guix graph) + #:use-module (guix scripts build) #:autoload (guix scripts graph) (%bag-node-type) #:use-module (gnu packages) #:use-module (web uri) @@ -339,18 +340,18 @@ (define (show-help) COUNT dependents")) (display (G_ " --display-missing display the list of missing substitutes")) - (display (G_ " - -s, --system=SYSTEM consider substitutes for SYSTEM--e.g., \"i686-linux\"")) (newline) (display (G_ " -h, --help display this help and exit")) (display (G_ " -V, --version display version information and exit")) (newline) + (show-native-build-options-help) + (newline) (show-bug-report-information)) (define %options - (list (option '(#\h "help") #f #f + (cons* (option '(#\h "help") #f #f (lambda args (show-help) (exit 0))) @@ -380,9 +381,7 @@ (define %options (option '("display-missing") #f #f (lambda (opt name arg result) (alist-cons 'display-missing? #t result))) - (option '(#\s "system") #t #f - (lambda (opt name arg result) - (alist-cons 'system arg result))))) + %standard-native-build-options)) (define %default-options `((substitute-urls . ,%default-substitute-urls))) From patchwork Sat May 7 16:11:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Othacehe X-Patchwork-Id: 39146 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id AB4B727BBE9; Sat, 7 May 2022 17:12:43 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 12FB027BBEB for ; Sat, 7 May 2022 17:12:42 +0100 (BST) Received: from localhost ([::1]:46366 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nnN2v-00077o-7Z for patchwork@mira.cbaines.net; Sat, 07 May 2022 12:12:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37678) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnN2J-00068U-Sy for guix-patches@gnu.org; Sat, 07 May 2022 12:12:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:58915) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nnN2J-00038k-KQ for guix-patches@gnu.org; Sat, 07 May 2022 12:12:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nnN2J-0006NV-GL for guix-patches@gnu.org; Sat, 07 May 2022 12:12:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#55220] [PATCH v2 5/6] platform: Add glibc-dynamic-linker field. Resent-From: Mathieu Othacehe Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 07 May 2022 16:12:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55220 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 55220@debbugs.gnu.org Cc: Mathieu Othacehe Received: via spool by 55220-submit@debbugs.gnu.org id=B55220.165193991124456 (code B ref 55220); Sat, 07 May 2022 16:12:03 +0000 Received: (at 55220) by debbugs.gnu.org; 7 May 2022 16:11:51 +0000 Received: from localhost ([127.0.0.1]:52805 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nnN26-0006MG-SH for submit@debbugs.gnu.org; Sat, 07 May 2022 12:11:51 -0400 Received: from eggs.gnu.org ([209.51.188.92]:44342) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nnN22-0006L4-HQ for 55220@debbugs.gnu.org; Sat, 07 May 2022 12:11:47 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:41106) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnN1x-00033f-9t for 55220@debbugs.gnu.org; Sat, 07 May 2022 12:11:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=iJ2hUUxT8dVix1N0+ohoD9UTEm2bdNNKZrFFXsOBfdw=; b=gpgbkUT76M5JlVcXDROv FVHE1/ekDzNQdRrHZ7CsBic1epLIRRZCChzS7gncO/fNxGHNnXQURNVvJa3fnnXxT56CffuQ106UH CAtdJoEV9c4MoVWw4nXnAoBO68Sy5EC3wosr1e1+gj77qkQvL87RjJg2mO3hNncLoBgpeuvFA60gU CIXLZbSsXdz7WSIF+wcXrdKqkWIzBG4XxYvNhIRNWxtC5yebxqRBPhWYYH0znuE5Q8CdKJ/oDWMrA x8mEoE7B+UxLB6+g+6EGb3Ya728u5/mDIeXw7qIXLBu/wqHFiSoaswXvynS3UmQgteDNBJje5K+++ Uxzf4Fhz0OBBBg==; Received: from 71.125.192.77.rev.sfr.net ([77.192.125.71]:40324 helo=localhost.localdomain) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nnN1w-0004uM-Sv; Sat, 07 May 2022 12:11:41 -0400 From: Mathieu Othacehe Date: Sat, 7 May 2022 18:11:25 +0200 Message-Id: <20220507161126.14553-6-othacehe@gnu.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220507161126.14553-1-othacehe@gnu.org> References: <20220507161126.14553-1-othacehe@gnu.org> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/platform.scm ()[glibc-dynamic-linker]: New field. (platform-glibc-dynamic-linker, lookup-platform-by-system): New procedures. * gnu/platforms/arm.scm (armhf-linux, aarch64-linux): Add the glibc-dynamic-linker field. * gnu/platforms/hurd.scm (hurd): Ditto. * gnu/platforms/intel.scm (intel32-linux, intel64-linux, intel32-mingw, intel64-linux): Ditto. * gnu/platforms/mips.scm (mips64el-linux): Ditto. * gnu/platforms/powerpc.scm (powerpc-linux, powerpc64-linux): Ditto. * gnu/platforms/riscv.scm (riscv64-linux): Ditto. * gnu/platforms/s390.scm (riscv64-linux): Ditto. * gnu/packages/bootstrap.scm (glibc-dynamic-linker): Adapt it. --- gnu/packages/bootstrap.scm | 47 ++++++++++++++++++-------------------- gnu/platform.scm | 14 ++++++++---- gnu/platforms/arm.scm | 6 +++-- gnu/platforms/hurd.scm | 3 ++- gnu/platforms/intel.scm | 12 ++++++---- gnu/platforms/mips.scm | 3 ++- gnu/platforms/powerpc.scm | 6 +++-- gnu/platforms/riscv.scm | 3 ++- gnu/platforms/s390.scm | 3 ++- 9 files changed, 56 insertions(+), 41 deletions(-) diff --git a/gnu/packages/bootstrap.scm b/gnu/packages/bootstrap.scm index 8bd0c4eaf3..5337617a53 100644 --- a/gnu/packages/bootstrap.scm +++ b/gnu/packages/bootstrap.scm @@ -26,6 +26,7 @@ (define-module (gnu packages bootstrap) #:use-module (guix licenses) #:use-module (gnu packages) + #:use-module (gnu platform) #:use-module (guix packages) #:use-module (guix download) #:use-module (guix build-system) @@ -314,33 +315,29 @@ (define* (glibc-dynamic-linker (%current-system)))) "Return the name of Glibc's dynamic linker for SYSTEM." ;; See the 'SYSDEP_KNOWN_INTERPRETER_NAMES' cpp macro in libc. - (cond ((string=? system "x86_64-linux") "/lib/ld-linux-x86-64.so.2") - ((string=? system "i686-linux") "/lib/ld-linux.so.2") - ((string=? system "armhf-linux") "/lib/ld-linux-armhf.so.3") - ((string=? system "mips64el-linux") "/lib/ld.so.1") - ((string=? system "i586-gnu") "/lib/ld.so.1") - ((string=? system "i686-gnu") "/lib/ld.so.1") - ((string=? system "aarch64-linux") "/lib/ld-linux-aarch64.so.1") - ((string=? system "powerpc-linux") "/lib/ld.so.1") - ((string=? system "powerpc64-linux") "/lib/ld64.so.1") - ((string=? system "powerpc64le-linux") "/lib/ld64.so.2") - ((string=? system "alpha-linux") "/lib/ld-linux.so.2") - ((string=? system "s390x-linux") "/lib/ld64.so.1") - ((string=? system "riscv64-linux") "/lib/ld-linux-riscv64-lp64d.so.1") + (let ((platform (lookup-platform-by-system system))) + (cond + ((platform? platform) + (platform-glibc-dynamic-linker platform)) - ;; XXX: This one is used bare-bones, without a libc, so add a case - ;; here just so we can keep going. - ((string=? system "arm-elf") "no-ld.so") - ((string=? system "arm-eabi") "no-ld.so") - ((string=? system "xtensa-elf") "no-ld.so") - ((string=? system "avr") "no-ld.so") - ((string=? system "propeller-elf") "no-ld.so") - ((string=? system "i686-mingw") "no-ld.so") - ((string=? system "x86_64-mingw") "no-ld.so") - ((string=? system "vc4-elf") "no-ld.so") + ;; TODO: Define those as platforms. + ((string=? system "i686-gnu") "/lib/ld.so.1") + ((string=? system "powerpc64-linux") "/lib/ld64.so.1") + ((string=? system "alpha-linux") "/lib/ld-linux.so.2") - (else (error "dynamic linker name not known for this system" - system)))) + ;; XXX: This one is used bare-bones, without a libc, so add a case + ;; here just so we can keep going. + ((string=? system "arm-elf") "no-ld.so") + ((string=? system "arm-eabi") "no-ld.so") + ((string=? system "xtensa-elf") "no-ld.so") + ((string=? system "avr") "no-ld.so") + ((string=? system "propeller-elf") "no-ld.so") + ((string=? system "i686-mingw") "no-ld.so") + ((string=? system "x86_64-mingw") "no-ld.so") + ((string=? system "vc4-elf") "no-ld.so") + + (else (error "dynamic linker name not known for this system" + system))))) ;;; diff --git a/gnu/platform.scm b/gnu/platform.scm index 4c5211e107..fdc3685e7c 100644 --- a/gnu/platform.scm +++ b/gnu/platform.scm @@ -27,6 +27,7 @@ (define-module (gnu platform) platform-target platform-system platform-linux-architecture + platform-glibc-dynamic-linker platform-modules platforms @@ -58,12 +59,17 @@ (define-module (gnu platform) ;; ;; The 'linux-architecture' is only relevant if the kernel is Linux. In that ;; case, it corresponds to the ARCH variable used when building Linux. +;; +;; The 'glibc-dynamic-linker' field is the name of Glibc's dynamic linker for +;; the corresponding system. (define-record-type* platform make-platform platform? - (target platform-target) ;"x86_64-linux-gnu" - (system platform-system) ;"x86_64-linux" - (linux-architecture platform-linux-architecture ;"x86" - (default #f))) + (target platform-target) + (system platform-system) + (linux-architecture platform-linux-architecture + (default #f)) + (glibc-dynamic-linker platform-glibc-dynamic-linker)) + ;;; ;;; Platforms. diff --git a/gnu/platforms/arm.scm b/gnu/platforms/arm.scm index 1e61741a35..bf68b2d00f 100644 --- a/gnu/platforms/arm.scm +++ b/gnu/platforms/arm.scm @@ -27,10 +27,12 @@ (define armv7-linux (platform (target "arm-linux-gnueabihf") (system "armhf-linux") - (linux-architecture "arm"))) + (linux-architecture "arm") + (glibc-dynamic-linker "/lib/ld-linux-armhf.so.3"))) (define aarch64-linux (platform (target "aarch64-linux-gnu") (system "aarch64-linux") - (linux-architecture "arm64"))) + (linux-architecture "arm64") + (glibc-dynamic-linker "/lib/ld-linux-aarch64.so.1"))) diff --git a/gnu/platforms/hurd.scm b/gnu/platforms/hurd.scm index 0e5c58fd08..328e9818ad 100644 --- a/gnu/platforms/hurd.scm +++ b/gnu/platforms/hurd.scm @@ -25,4 +25,5 @@ (define-module (gnu platforms hurd) (define hurd (platform (target "i586-pc-gnu") - (system "i586-gnu"))) + (system "i586-gnu") + (glibc-dynamic-linker "/lib/ld.so.1"))) diff --git a/gnu/platforms/intel.scm b/gnu/platforms/intel.scm index ee9fe003a7..5b58d953ae 100644 --- a/gnu/platforms/intel.scm +++ b/gnu/platforms/intel.scm @@ -29,20 +29,24 @@ (define intel32-linux (platform (target "i686-linux-gnu") (system "i686-linux") - (linux-architecture "i386"))) + (linux-architecture "i386") + (glibc-dynamic-linker "/lib/ld-linux.so.2"))) (define intel64-linux (platform (target "x86_64-linux-gnu") (system "x86_64-linux") - (linux-architecture "x86_64"))) + (linux-architecture "x86_64") + (glibc-dynamic-linker "/lib/ld-linux-x86-64.so.2"))) (define intel32-mingw (platform (target "i686-w64-mingw32") - (system #f))) + (system #f) + (glibc-dynamic-linker #f))) (define intel64-mingw (platform (target "x86_64-w64-mingw32") - (system #f))) + (system #f) + (glibc-dynamic-linker #f))) diff --git a/gnu/platforms/mips.scm b/gnu/platforms/mips.scm index 84a492699d..174657da13 100644 --- a/gnu/platforms/mips.scm +++ b/gnu/platforms/mips.scm @@ -26,4 +26,5 @@ (define mips64-linux (platform (target "mips64el-linux-gnu") (system "mips64el-linux") - (linux-architecture "mips"))) + (linux-architecture "mips") + (glibc-dynamic-linker "/lib/ld.so.1"))) diff --git a/gnu/platforms/powerpc.scm b/gnu/platforms/powerpc.scm index 8fadfe88de..1d0b5cb666 100644 --- a/gnu/platforms/powerpc.scm +++ b/gnu/platforms/powerpc.scm @@ -27,10 +27,12 @@ (define powerpc-linux (platform (target "powerpc-linux-gnu") (system "powerpc-linux") - (linux-architecture "powerpc"))) + (linux-architecture "powerpc") + (glibc-dynamic-linker "/lib/ld.so.1"))) (define powerpc64le-linux (platform (target "powerpc64le-linux-gnu") (system "powerpc64le-linux") - (linux-architecture "powerpc"))) + (linux-architecture "powerpc") + (glibc-dynamic-linker "/lib/ld64.so.2"))) diff --git a/gnu/platforms/riscv.scm b/gnu/platforms/riscv.scm index 29a34402a2..c2b4850e55 100644 --- a/gnu/platforms/riscv.scm +++ b/gnu/platforms/riscv.scm @@ -26,4 +26,5 @@ (define riscv64-linux (platform (target "riscv64-linux-gnu") (system "riscv64-linux") - (linux-architecture "riscv"))) + (linux-architecture "riscv") + (glibc-dynamic-linker "/lib/ld-linux-riscv64-lp64d.so.1"))) diff --git a/gnu/platforms/s390.scm b/gnu/platforms/s390.scm index c8caafbe45..d3b1133974 100644 --- a/gnu/platforms/s390.scm +++ b/gnu/platforms/s390.scm @@ -26,4 +26,5 @@ (define s390x-linux (platform (target "s390x-linux-gnu") (system "s390x-linux") - (linux-architecture "s390"))) + (linux-architecture "s390") + (glibc-dynamic-linker "/lib/ld64.so.1"))) From patchwork Sat May 7 16:11:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Othacehe X-Patchwork-Id: 39145 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 28EB827BBEA; Sat, 7 May 2022 17:12:43 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id D470527BBE9 for ; Sat, 7 May 2022 17:12:41 +0100 (BST) Received: from localhost ([::1]:46338 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nnN2u-00076y-TF for patchwork@mira.cbaines.net; Sat, 07 May 2022 12:12:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37680) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnN2K-00069U-9H for guix-patches@gnu.org; Sat, 07 May 2022 12:12:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:58916) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nnN2K-00038p-09 for guix-patches@gnu.org; Sat, 07 May 2022 12:12:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nnN2J-0006Nc-SG for guix-patches@gnu.org; Sat, 07 May 2022 12:12:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#55220] [PATCH v2 6/6] linux: Remove system->linux-architecture procedure. Resent-From: Mathieu Othacehe Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 07 May 2022 16:12:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55220 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 55220@debbugs.gnu.org Cc: Mathieu Othacehe Received: via spool by 55220-submit@debbugs.gnu.org id=B55220.165193991224463 (code B ref 55220); Sat, 07 May 2022 16:12:03 +0000 Received: (at 55220) by debbugs.gnu.org; 7 May 2022 16:11:52 +0000 Received: from localhost ([127.0.0.1]:52807 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nnN27-0006MP-Mf for submit@debbugs.gnu.org; Sat, 07 May 2022 12:11:52 -0400 Received: from eggs.gnu.org ([209.51.188.92]:44346) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nnN24-0006LD-5H for 55220@debbugs.gnu.org; Sat, 07 May 2022 12:11:48 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:41108) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnN1z-00033k-0H for 55220@debbugs.gnu.org; Sat, 07 May 2022 12:11:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=IDHYNZ2s7hxWtRWuy1i5G+tA0WHEafKWM632k9zuSCM=; b=THrLyci1YomKWIffGDx+ CHySB2R3884ZQNyKBygrfRqTTgBbq+RkI/EaearvEzooU67HVUY4We1Z/HpkEX5RJ7vBnTcX4vuPh UVp8YJbwA55wVHmitivAXeg6+QbjNerc/ZKGBMEvMk3UyDM9meB9n8zHCc8A9l3UISxA0ycmtXL83 0k75+peBDO191hTQ0Dy615v3ykYPHyKFKqsdq0S3mKXgAz+2eB3tJ2m7+mmqOvuf0vKNEWu8IBqjx gQbmFyYj0C1HtVdNUdWzEcyZX8yrxCy4K6xKBDGhXGDamynI6VXxvYzzSxHP57cIdCBoB/iiXC/v+ bWBvkcnWErkSJw==; Received: from 71.125.192.77.rev.sfr.net ([77.192.125.71]:40324 helo=localhost.localdomain) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nnN1x-0004uM-Jb; Sat, 07 May 2022 12:11:41 -0400 From: Mathieu Othacehe Date: Sat, 7 May 2022 18:11:26 +0200 Message-Id: <20220507161126.14553-7-othacehe@gnu.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220507161126.14553-1-othacehe@gnu.org> References: <20220507161126.14553-1-othacehe@gnu.org> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/packages/linux.scm (system->linux-architecture): Remove it. (make-linux-libre-headers*, make-linux-libre*): Adapt them. * guix/build-system/linux-module.scm (system->arch): Adapt it. * gnu/packages/instrumentation.scm (uftrace): Ditto. * gnu/packages/cross-base.scm (cross-kernel-headers): Ditto. * gnu/packages/bioinformatics.scm (ncbi-vdb): Ditto. * doc/guix.texi (Porting to a new platform): Update it. --- doc/guix.texi | 30 ++++++++++++++------------ gnu/packages/bioinformatics.scm | 11 ++++++---- gnu/packages/cross-base.scm | 4 +++- gnu/packages/instrumentation.scm | 8 ++++--- gnu/packages/linux.scm | 34 +++++++++++------------------- guix/build-system/linux-module.scm | 4 ++-- 6 files changed, 45 insertions(+), 46 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 6757c105dc..1dc1474ec7 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -39896,20 +39896,22 @@ one: guix build --target=armv5tel-linux-gnueabi bootstrap-tarballs @end example -For this to work, the @code{glibc-dynamic-linker} procedure in -@code{(gnu packages bootstrap)} must be augmented to return the right -file name for libc's dynamic linker on that platform; likewise, -@code{system->linux-architecture} in @code{(gnu packages linux)} must be -taught about the new platform. - -Once these are built, the @code{(gnu packages bootstrap)} module needs -to be updated to refer to these binaries on the target platform. That -is, the hashes and URLs of the bootstrap tarballs for the new platform -must be added alongside those of the currently supported platforms. The -bootstrap Guile tarball is treated specially: it is expected to be -available locally, and @file{gnu/local.mk} has rules to download it for -the supported architectures; a rule for the new platform must be added -as well. +For this to work, it is first required to register a new platform as +defined in the @code{(gnu platform)} module. A platform is making the +connection between a GNU triplet (@pxref{Specifying Target Triplets, GNU +configuration triplets,, autoconf, Autoconf}), the equivalent +@var{system} in Nix notation, the name of the +@var{glibc-dynamic-linker}, and the corresponding Linux architecture +name if applicable. + +Once the bootstrap tarball are built, the @code{(gnu packages +bootstrap)} module needs to be updated to refer to these binaries on the +target platform. That is, the hashes and URLs of the bootstrap tarballs +for the new platform must be added alongside those of the currently +supported platforms. The bootstrap Guile tarball is treated specially: +it is expected to be available locally, and @file{gnu/local.mk} has +rules to download it for the supported architectures; a rule for the new +platform must be added as well. In practice, there may be some complications. First, it may be that the extended GNU triplet that specifies an ABI (like the @code{eabi} suffix diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm index ae35087964..d23f5fa9e0 100644 --- a/gnu/packages/bioinformatics.scm +++ b/gnu/packages/bioinformatics.scm @@ -161,6 +161,7 @@ (define-module (gnu packages bioinformatics) #:use-module (gnu packages wget) #:use-module (gnu packages xml) #:use-module (gnu packages xorg) + #:use-module (gnu platform) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) #:use-module (ice-9 match)) @@ -6576,10 +6577,12 @@ (define-public ncbi-vdb ;; architecture name ("i386") instead of the target system prefix ;; ("i686"). (mkdir (string-append (assoc-ref outputs "out") "/ilib")) - (copy-recursively (string-append "build/ncbi-vdb/linux/gcc/" - ,(system->linux-architecture - (or (%current-target-system) - (%current-system))) + (copy-recursively (string-append + "build/ncbi-vdb/linux/gcc/" + ,(platform-linux-architecture + (lookup-platform-by-target-or-system + (or (%current-target-system) + (%current-system)))) "/rel/ilib") (string-append (assoc-ref outputs "out") "/ilib")) diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm index 66412b9e92..427fefbcd2 100644 --- a/gnu/packages/cross-base.scm +++ b/gnu/packages/cross-base.scm @@ -30,6 +30,7 @@ (define-module (gnu packages cross-base) #:use-module (gnu packages linux) #:use-module (gnu packages hurd) #:use-module (gnu packages mingw) + #:use-module (gnu platform) #:use-module (guix packages) #:use-module (guix download) #:use-module (guix utils) @@ -345,7 +346,8 @@ (define xlinux-headers `(modify-phases ,phases (replace 'build (lambda _ - (setenv "ARCH" ,(system->linux-architecture target)) + (setenv "ARCH" ,(platform-linux-architecture + (lookup-platform-by-target target))) (format #t "`ARCH' set to `~a' (cross compiling)~%" (getenv "ARCH")) diff --git a/gnu/packages/instrumentation.scm b/gnu/packages/instrumentation.scm index ab986bfcc7..1271619ad6 100644 --- a/gnu/packages/instrumentation.scm +++ b/gnu/packages/instrumentation.scm @@ -42,6 +42,7 @@ (define-module (gnu packages instrumentation) #:use-module (gnu packages swig) #:use-module (gnu packages tbb) #:use-module (gnu packages xml) + #:use-module (gnu platform) #:use-module (guix build-system cmake) #:use-module (guix build-system copy) #:use-module (guix build-system gnu) @@ -312,9 +313,10 @@ (define-public uftrace (modify-phases %standard-phases (replace 'configure (lambda* (#:key outputs target #:allow-other-keys) - (let ((arch ,(system->linux-architecture - (or (%current-target-system) - (%current-system))))) + (let ((arch ,(platform-linux-architecture + (lookup-platform-by-target-or-system + (or (%current-target-system) + (%current-system)))))) (setenv "ARCH" (cond ((string=? arch "arm64") "aarch64") diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index 828bd4e208..c5d30f937b 100644 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -158,6 +158,7 @@ (define-module (gnu packages linux) #:use-module (gnu packages groff) #:use-module (gnu packages selinux) #:use-module (gnu packages swig) + #:use-module (gnu platform) #:use-module (guix build-system cmake) #:use-module (guix build-system copy) #:use-module (guix build-system gnu) @@ -181,20 +182,6 @@ (define-module (gnu packages linux) #:use-module (ice-9 match) #:use-module (ice-9 regex)) -(define-public (system->linux-architecture arch) - "Return the Linux architecture name for ARCH, a Guix system name such as -\"x86_64-linux\" or a target triplet such as \"arm-linux-gnueabihf\"." - (let ((arch (car (string-split arch #\-)))) - (cond ((string=? arch "i686") "i386") - ((string-prefix? "mips" arch) "mips") - ((string-prefix? "arm" arch) "arm") - ((string-prefix? "aarch64" arch) "arm64") - ((string-prefix? "alpha" arch) "alpha") - ((string-prefix? "powerpc" arch) "powerpc") ;including "powerpc64le" - ((string-prefix? "s390" arch) "s390") - ((string-prefix? "riscv" arch) "riscv") - (else arch)))) - (define-public (system->defconfig system) "Some systems (notably powerpc-linux) require a special target for kernel defconfig. Return the appropriate make target if applicable, otherwise return @@ -567,9 +554,10 @@ (define (make-linux-libre-headers* version gnu-revision source) (delete 'configure) (replace 'build (lambda _ - (let ((arch ,(system->linux-architecture - (or (%current-target-system) - (%current-system)))) + (let ((arch ,(platform-linux-architecture + (lookup-platform-by-target-or-system + (or (%current-target-system) + (%current-system))))) (defconfig ,(system->defconfig (or (%current-target-system) (%current-system)))) @@ -807,8 +795,9 @@ (define* (make-linux-libre* version gnu-revision source supported-systems ,@(match (and configuration-file (configuration-file - (system->linux-architecture - (or (%current-target-system) (%current-system))) + (platform-linux-architecture + (lookup-platform-by-target-or-system + (or (%current-target-system) (%current-system)))) #:variant (version-major+minor version))) (#f ;no config for this platform '()) @@ -839,9 +828,10 @@ (define* (make-linux-libre* version gnu-revision source supported-systems (setenv "KBUILD_BUILD_HOST" "guix") ;; Set ARCH and CROSS_COMPILE. - (let ((arch #$(system->linux-architecture - (or (%current-target-system) - (%current-system))))) + (let ((arch #$(platform-linux-architecture + (lookup-platform-by-target-or-system + (or (%current-target-system) + (%current-system)))))) (setenv "ARCH" arch) (format #t "`ARCH' set to `~a'~%" (getenv "ARCH")) diff --git a/guix/build-system/linux-module.scm b/guix/build-system/linux-module.scm index e82a9ca65c..761ebe25b1 100644 --- a/guix/build-system/linux-module.scm +++ b/guix/build-system/linux-module.scm @@ -50,8 +50,8 @@ (define (default-linux) (module-ref module 'linux-libre))) (define (system->arch system) - (let ((module (resolve-interface '(gnu packages linux)))) - ((module-ref module 'system->linux-architecture) system))) + (let ((module (resolve-interface '(gnu platform)))) + ((module-ref module 'lookup-platform-by-target-or-system) system))) (define (make-linux-module-builder linux) (package