From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id SFuqB3zAb2I43QAAbAwnHQ (envelope-from ) for ; Mon, 02 May 2022 13:29:00 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id 8MOUB3zAb2JoZQEAauVa8A (envelope-from ) for ; Mon, 02 May 2022 13:29:00 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 9529118404 for ; Mon, 2 May 2022 13:28:59 +0200 (CEST) Received: from localhost ([::1]:40564 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nlUEc-0007jP-Bp for larch@yhetil.org; Mon, 02 May 2022 07:28:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46446) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlU63-0001gc-2H for guix-patches@gnu.org; Mon, 02 May 2022 07:20:21 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:41124) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nlU5z-0005Zu-Ge for guix-patches@gnu.org; Mon, 02 May 2022 07:20:06 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nlU5z-0005jZ-BX for guix-patches@gnu.org; Mon, 02 May 2022 07:20:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#55220] [PATCH 2/4] platform: Add discovery support. Resent-From: Mathieu Othacehe Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 02 May 2022 11:20: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.165149038321980 (code B ref 55220); Mon, 02 May 2022 11:20:03 +0000 Received: (at 55220) by debbugs.gnu.org; 2 May 2022 11:19:43 +0000 Received: from localhost ([127.0.0.1]:35014 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nlU5f-0005iP-5k for submit@debbugs.gnu.org; Mon, 02 May 2022 07:19:43 -0400 Received: from eggs.gnu.org ([209.51.188.92]:53106) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nlU5d-0005iB-4u for 55220@debbugs.gnu.org; Mon, 02 May 2022 07:19:41 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:54138) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlU5X-0005YR-Uq for 55220@debbugs.gnu.org; Mon, 02 May 2022 07:19:35 -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=FZ4gFvIl1e/fnCuOMWnJZYiycebBzWcidNNNtN37/Pc=; b=b5YVHvl2zcS6+jn5/lyR Rgt1jwNdg79w+1PJcfCN5Urac0t1w6HqCKvQWHDuGkMTZ7JWLq5W5bnG0C0SJmgrqytlUHSwqLdbc eS1+BKyuv97XWN1/fUgNurZNvgeo1btnTKe7pCZ0Ga4cL2ojv5a2endPfnI9G+xaNSg7WeHV/PMbp MbiwqDGj7h5CnRW0mHwIMftgwwyBvtR9ExARszFT/rqjoB4WyXdu3Ht2YsaD3cwRP0lqP1Dov+E0k 5sgx5fKf1S3/orApkk+Jps74TL5Mr7RRX5AmFyuCZVSrhhPNnMA+6RkaidvpS97pSy5uUqS4cAc81 Jprg5wVlAwJhNA==; Received: from 71.125.192.77.rev.sfr.net ([77.192.125.71]:33768 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 1nlU5L-0004xO-0o; Mon, 02 May 2022 07:19:26 -0400 From: Mathieu Othacehe Date: Mon, 2 May 2022 13:18:57 +0200 Message-Id: <20220502111859.13605-2-othacehe@gnu.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220502111859.13605-1-othacehe@gnu.org> References: <20220502111859.13605-1-othacehe@gnu.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1651490939; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=AqMgjo7If+RFEFdPVRWYACKhXd7DOLp2fZ4RrxuTuME=; b=qRdflrR9XoEbcqpKWT99N1R2MS6nloY55j4UQ2UHZVOIoYEkS+d9JR6SOrvB8F8j2Pi/Hr 6WUD5H+8lKmgb2Yw0QQPbc/i5Q/KjCjRYzbM9ox8tCj0a3ANRCw8NmfiItMU8Y65w5lqLY TJq1pgDX2BgGg/IgIeC90dNS04CRK4/V8fZUPHuD6TRtn1fkwTynlRO5M7yeEUSczdCmhg iGsAvDJ8Pdx68jPe3vwCF1kk8lhSmeHFziDwRnF68PzOShPljUygBNmWS0GX3ApgZ8klHh a9h/oWOI8wPvu7vJ2oUcodAgnzoRVm+75kukU/coc4XLkFQYS62YIhGUux3d9w== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1651490939; a=rsa-sha256; cv=none; b=R6WraAl5XufRdM3rIqUsYIMbn5mJEHJSrPbPXMf2tloNM+ktjSbG76xaTB3DAb3/gqHNsw MsIlRQ1oMOV/bsxvkQwhp6hcuxA6QlrlRIBKkNkLjopa4cC12Ni+5JpzSMVjEKFcxx/TXt G/oK9yiGBZnD3f8dlkoih+/f/VpDj5B83GiTZ0HHOYTHoc8DZXK6lIwTWELqnVS9d66+F6 kiNKbaCJqdf3j5PrctzeLBd4131lWMcjEZNkd4IU+0NsSYXpD2TDvWhvuXPrG/J02nyQXS kPdZk7uQ9Y7spZN91Tvtv24rx1H22IUgWf5si6bqyU6tCOfAOqO5HvHX/CW/HA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gnu.org header.s=fencepost-gnu-org header.b=b5YVHvl2; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -0.89 Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gnu.org header.s=fencepost-gnu-org header.b=b5YVHvl2; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 9529118404 X-Spam-Score: -0.89 X-Migadu-Scanner: scn1.migadu.com X-TUID: 9/rt0L9uQ9om * gnu/platform.scm (platform-modules, systems, targets): New procedures. (%platforms): New variable. Signed-off-by: Mathieu Othacehe --- gnu/platform.scm | 62 +++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 59 insertions(+), 3 deletions(-) diff --git a/gnu/platform.scm b/gnu/platform.scm index bb6519c71a..481467086a 100644 --- a/gnu/platform.scm +++ b/gnu/platform.scm @@ -17,22 +17,78 @@ ;;; along with GNU Guix. If not, see . (define-module (gnu platform) + #:use-module (guix discovery) #: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 + + 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. + (delay (fold-module-public-variables (lambda (obj result) + (if (platform? obj) + (cons obj result) + result)) + '() + (platform-modules)))) + + +;;; +;;; Systems & Targets. +;;; + +(define (systems) + "Return the list of supported systems." + (delete-duplicates + (filter-map platform-system (force %platforms)))) + +(define (targets) + "Return the list of supported targets." + (map platform-target (force %platforms))) -- 2.35.1