From patchwork Thu May 16 15:06:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christopher Baines X-Patchwork-Id: 27534 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 4EC5F27BBEA; Thu, 16 May 2024 16:07:57 +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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, SPF_HELO_PASS 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 D492627BBE2 for ; Thu, 16 May 2024 16:07:56 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s7chO-0002CB-3f; Thu, 16 May 2024 11:07:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s7chE-0002Ax-9w for guix-patches@gnu.org; Thu, 16 May 2024 11:07:04 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s7chC-0000Ey-2o; Thu, 16 May 2024 11:07:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s7chC-0007m8-T8; Thu, 16 May 2024 11:07:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#70985] [PATCH 1/4] guix: packages: Add new &package-unsupported-target-error. References: <878r09ol8z.fsf@cbaines.net> In-Reply-To: <878r09ol8z.fsf@cbaines.net> Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, rekado@elephly.net, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Thu, 16 May 2024 15:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70985 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 70985@debbugs.gnu.org Cc: Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 70985-submit@debbugs.gnu.org id=B70985.171587200629840 (code B ref 70985); Thu, 16 May 2024 15:07:02 +0000 Received: (at 70985) by debbugs.gnu.org; 16 May 2024 15:06:46 +0000 Received: from localhost ([127.0.0.1]:49221 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s7cgv-0007lD-SN for submit@debbugs.gnu.org; Thu, 16 May 2024 11:06:46 -0400 Received: from mira.cbaines.net ([212.71.252.8]:43536) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s7cgt-0007ku-FU for 70985@debbugs.gnu.org; Thu, 16 May 2024 11:06:43 -0400 Received: from localhost (unknown [45.67.83.153]) by mira.cbaines.net (Postfix) with ESMTPSA id 4B31E27BBE2 for <70985@debbugs.gnu.org>; Thu, 16 May 2024 16:06:10 +0100 (BST) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id 23d91321 for <70985@debbugs.gnu.org>; Thu, 16 May 2024 15:06:08 +0000 (UTC) From: Christopher Baines Date: Thu, 16 May 2024 16:06:03 +0100 Message-ID: <3828bc238a8cc400f9686fe6856c665c31e927dd.1715871966.git.mail@cbaines.net> X-Mailer: git-send-email 2.41.0 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-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches Some packages don't support cross building to specific targets, so add a error type to signal this. * guix/packages.scm (&package-unsupported-target-error): New condition type. [package-unsupported-target-error? package-unsupported-target-error-target): New procedures. * guix/ui.scm (call-with-error-handling): Handle this new condition type. Change-Id: Ib47813399e04b20d616a95f545b6aabe25736e92 --- guix/packages.scm | 7 +++++++ guix/ui.scm | 7 +++++++ 2 files changed, 14 insertions(+) base-commit: 5a624adfd7b14c3717237d137bd0766c77f0f570 diff --git a/guix/packages.scm b/guix/packages.scm index abe89cdb07..7fbb8d126b 100644 --- a/guix/packages.scm +++ b/guix/packages.scm @@ -173,6 +173,9 @@ (define-module (guix packages) package-error-invalid-input &package-cross-build-system-error package-cross-build-system-error? + &package-unsupported-target-error + package-unsupported-target-error? + package-unsupported-target-error-target package->bag bag->derivation @@ -850,6 +853,10 @@ (define-condition-type &package-cyclic-dependency-error &package-error (define-condition-type &package-cross-build-system-error &package-error package-cross-build-system-error?) +(define-condition-type &package-unsupported-target-error &package-error + package-unsupported-target-error? + (target package-unsupported-target-error-target)) + (define* (package-full-name package #:optional (delimiter "@")) "Return the full name of PACKAGE--i.e., `NAME@VERSION'. By specifying DELIMITER (a string), you can customize what will appear between the name and diff --git a/guix/ui.scm b/guix/ui.scm index d82fa533cc..0bb1b3b3ba 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -756,6 +756,13 @@ (define (call-with-error-handling thunk) (location->string loc) (package-full-name package) (build-system-name system)))) + ((package-unsupported-target-error? c) + (let* ((package (package-error-package c)) + (loc (package-location package))) + (leave (G_ "~a: ~a: does not support target `~a'~%") + (location->string loc) + (package-full-name package) + (package-unsupported-target-error-target c)))) ((gexp-input-error? c) (let ((input (gexp-error-invalid-input c))) (leave (G_ "~s: invalid G-expression input~%") From patchwork Thu May 16 15:06:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christopher Baines X-Patchwork-Id: 27531 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 AC06A27BBEA; Thu, 16 May 2024 16:07:25 +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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, SPF_HELO_PASS autolearn=ham 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 29C6C27BBE2 for ; Thu, 16 May 2024 16:07:25 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s7chK-0002Bu-7W; Thu, 16 May 2024 11:07:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s7chE-0002Av-9e for guix-patches@gnu.org; Thu, 16 May 2024 11:07:04 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s7chB-0000Dw-2I for guix-patches@gnu.org; Thu, 16 May 2024 11:07:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s7chD-0007mE-AP for guix-patches@gnu.org; Thu, 16 May 2024 11:07:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#70985] [PATCH 2/4] gnu: tls: Raise conditions from target->openssl-target. Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 16 May 2024 15:07:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70985 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 70985@debbugs.gnu.org Received: via spool by 70985-submit@debbugs.gnu.org id=B70985.171587200629846 (code B ref 70985); Thu, 16 May 2024 15:07:03 +0000 Received: (at 70985) by debbugs.gnu.org; 16 May 2024 15:06:46 +0000 Received: from localhost ([127.0.0.1]:49223 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s7cgw-0007lF-8A for submit@debbugs.gnu.org; Thu, 16 May 2024 11:06:46 -0400 Received: from mira.cbaines.net ([212.71.252.8]:43538) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s7cgt-0007kv-UM for 70985@debbugs.gnu.org; Thu, 16 May 2024 11:06:44 -0400 Received: from localhost (unknown [45.67.83.153]) by mira.cbaines.net (Postfix) with ESMTPSA id CE87A27BBE9 for <70985@debbugs.gnu.org>; Thu, 16 May 2024 16:06:10 +0100 (BST) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id 7177d07f for <70985@debbugs.gnu.org>; Thu, 16 May 2024 15:06:08 +0000 (UTC) From: Christopher Baines Date: Thu, 16 May 2024 16:06:04 +0100 Message-ID: <1f3d2facacce8938a74c241e051dc43550327cee.1715871966.git.mail@cbaines.net> X-Mailer: git-send-email 2.41.0 In-Reply-To: <3828bc238a8cc400f9686fe6856c665c31e927dd.1715871966.git.mail@cbaines.net> References: <3828bc238a8cc400f9686fe6856c665c31e927dd.1715871966.git.mail@cbaines.net> 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-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches Rather than rasising generic errors. * gnu/packages/tls.scm (target->openssl-target): Raise conditions rather than generic errors. (openssl-1.1): Call target->openssl-target with the package. Change-Id: I13c63328cdf6bc177b20879805246ad94ff2665b --- gnu/packages/tls.scm | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/gnu/packages/tls.scm b/gnu/packages/tls.scm index 719da8e113..f04e171a9b 100644 --- a/gnu/packages/tls.scm +++ b/gnu/packages/tls.scm @@ -84,7 +84,9 @@ (define-module (gnu packages tls) #:use-module (gnu packages time) #:use-module (gnu packages version-control) #:use-module (gnu packages base) - #:use-module (srfi srfi-1)) + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-34) + #:use-module (srfi srfi-35)) (define-public libtasn1 (package @@ -390,7 +392,7 @@ (define-public guile2.2-gnutls (modify-inputs (package-inputs guile-gnutls) (replace "guile" guile-2.2))))) -(define (target->openssl-target target) +(define (target->openssl-target pkg target) "Return the value to set CONFIGURE_TARGET_ARCH to when cross-compiling OpenSSL for TARGET." ;; Keep this code outside the build code, @@ -411,7 +413,10 @@ (define (target->openssl-target target) ((target-linux? target) "linux") (else - (error "unsupported openssl target kernel")))) + (raise (condition + (&package-unsupported-target-error + (package pkg) + (target target))))))) (arch (cond ((target-x86-32? target) @@ -438,7 +443,10 @@ (define (target->openssl-target target) ((target-64bit? target) "generic64") (else - (error "unsupported openssl target architecture"))))) + (raise (condition + (&package-unsupported-target-error + (package pkg) + (target target)))))))) (string-append kernel "-" arch)))) (define-public openssl-1.1 @@ -488,6 +496,7 @@ (define-public openssl-1.1 (setenv "CROSS_COMPILE" (string-append target "-")) (setenv "CONFIGURE_TARGET_ARCH" #$(target->openssl-target + this-package (%current-target-system)))))) #~()) #$@(if (target-hurd?) From patchwork Thu May 16 15:06:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christopher Baines X-Patchwork-Id: 27532 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 E01E027BBEA; Thu, 16 May 2024 16:07:32 +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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, SPF_HELO_PASS autolearn=ham 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 63AF227BBE2 for ; Thu, 16 May 2024 16:07:32 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s7chK-0002Bp-4C; Thu, 16 May 2024 11:07:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s7chC-0002Ag-52 for guix-patches@gnu.org; Thu, 16 May 2024 11:07:02 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s7chA-0000Dq-DT; Thu, 16 May 2024 11:07:00 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s7chC-0007m0-DJ; Thu, 16 May 2024 11:07:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#70985] [PATCH 3/4] gnu: cross-libc*: Raise conditions rather than returning #f. Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-CC: ludo@gnu.org, guix-patches@gnu.org Resent-Date: Thu, 16 May 2024 15:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70985 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 70985@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= X-Debbugs-Original-Xcc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 70985-submit@debbugs.gnu.org id=B70985.171587198029807 (code B ref 70985); Thu, 16 May 2024 15:07:02 +0000 Received: (at 70985) by debbugs.gnu.org; 16 May 2024 15:06:20 +0000 Received: from localhost ([127.0.0.1]:49214 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s7cgW-0007kh-FA for submit@debbugs.gnu.org; Thu, 16 May 2024 11:06:20 -0400 Received: from mira.cbaines.net ([212.71.252.8]:43534) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s7cgT-0007kb-3O for 70985@debbugs.gnu.org; Thu, 16 May 2024 11:06:18 -0400 Received: from localhost (unknown [45.67.83.153]) by mira.cbaines.net (Postfix) with ESMTPSA id 5954A27BBEA for <70985@debbugs.gnu.org>; Thu, 16 May 2024 16:06:11 +0100 (BST) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id 9605db93 for <70985@debbugs.gnu.org>; Thu, 16 May 2024 15:06:08 +0000 (UTC) From: Christopher Baines Date: Thu, 16 May 2024 16:06:05 +0100 Message-ID: <05efcc4bcf0dc4b270930747d215a97b2bd86761.1715871966.git.mail@cbaines.net> X-Mailer: git-send-email 2.41.0 In-Reply-To: <3828bc238a8cc400f9686fe6856c665c31e927dd.1715871966.git.mail@cbaines.net> References: <3828bc238a8cc400f9686fe6856c665c31e927dd.1715871966.git.mail@cbaines.net> 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-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches As this means that the error will be clearer for targets which are unsupported. * gnu/packages/cross-base.scm (cross-libc*): Raise conditions rather than returning #f. Change-Id: I820780ad738d85a98950de5608f3019e961ff7c8 --- gnu/packages/cross-base.scm | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm index 2cc5f52e47..0488e397ef 100644 --- a/gnu/packages/cross-base.scm +++ b/gnu/packages/cross-base.scm @@ -46,6 +46,8 @@ (define-module (gnu packages cross-base) #:use-module (guix gexp) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) + #:use-module (srfi srfi-34) + #:use-module (srfi srfi-35) #:use-module (ice-9 match) #:use-module (ice-9 regex) #:export (cross-binutils @@ -671,8 +673,8 @@ (define* (cross-libc* target (xbinutils (cross-binutils target)) (xheaders (cross-kernel-headers target))) "Return LIBC cross-built for TARGET, a GNU triplet. Use XGCC and XBINUTILS -and the cross tool chain. If TARGET doesn't have a standard C library #f is -returned." +and the cross tool chain. If TARGET doesn't have a standard C library an +exception is raised." (match target ((? target-mingw?) (let ((machine (substring target 0 (string-index target #\-)))) @@ -745,7 +747,11 @@ (define* (cross-libc* target ((? target-avr?) (make-avr-libc #:xbinutils xbinutils #:xgcc xgcc)) - (else #f))) + (else + (raise (condition + (&package-unsupported-target-error + (package libc) + (target target))))))) (define* (cross-gcc-toolchain/implementation target #:key From patchwork Thu May 16 15:06:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Christopher Baines X-Patchwork-Id: 27533 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 0E33027BBEA; Thu, 16 May 2024 16:07:53 +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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, SPF_HELO_PASS autolearn=ham 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 1C15527BBE2 for ; Thu, 16 May 2024 16:07:52 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s7chM-0002Bw-5w; Thu, 16 May 2024 11:07:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s7chE-0002Au-9K for guix-patches@gnu.org; Thu, 16 May 2024 11:07:04 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s7chB-0000Dy-FW for guix-patches@gnu.org; Thu, 16 May 2024 11:07:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s7chD-0007mL-O8 for guix-patches@gnu.org; Thu, 16 May 2024 11:07:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#70985] [PATCH 4/4] guix: build-system: meson: Don't error on unsupported targets. Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 16 May 2024 15:07:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70985 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 70985@debbugs.gnu.org Received: via spool by 70985-submit@debbugs.gnu.org id=B70985.171587201229859 (code B ref 70985); Thu, 16 May 2024 15:07:03 +0000 Received: (at 70985) by debbugs.gnu.org; 16 May 2024 15:06:52 +0000 Received: from localhost ([127.0.0.1]:49227 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s7ch1-0007lW-Sl for submit@debbugs.gnu.org; Thu, 16 May 2024 11:06:52 -0400 Received: from mira.cbaines.net ([212.71.252.8]:43540) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s7cgu-0007l6-UL for 70985@debbugs.gnu.org; Thu, 16 May 2024 11:06:45 -0400 Received: from localhost (unknown [45.67.83.153]) by mira.cbaines.net (Postfix) with ESMTPSA id D948A27BBEB for <70985@debbugs.gnu.org>; Thu, 16 May 2024 16:06:11 +0100 (BST) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id c8131ea3 for <70985@debbugs.gnu.org>; Thu, 16 May 2024 15:06:08 +0000 (UTC) From: Christopher Baines Date: Thu, 16 May 2024 16:06:06 +0100 Message-ID: <1f217c47d4494a29035dd136c2672771990c0eb0.1715871966.git.mail@cbaines.net> X-Mailer: git-send-email 2.41.0 In-Reply-To: <3828bc238a8cc400f9686fe6856c665c31e927dd.1715871966.git.mail@cbaines.net> References: <3828bc238a8cc400f9686fe6856c665c31e927dd.1715871966.git.mail@cbaines.net> 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-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches Rather than raising generic errors. * guix/build-system/meson.scm (make-machine-alist): Return #f if the triplet is unsupported. (lower): Return #f if the machine alist is #f. Change-Id: If6a1f8d1c2073e43107406ac186aa9c845005a95 --- guix/build-system/meson.scm | 115 +++++++++++++++++++----------------- 1 file changed, 62 insertions(+), 53 deletions(-) diff --git a/guix/build-system/meson.scm b/guix/build-system/meson.scm index bf9ca15ecc..b321417773 100644 --- a/guix/build-system/meson.scm +++ b/guix/build-system/meson.scm @@ -46,39 +46,46 @@ (define (make-machine-alist triplet) "Make an association list describing what should go into the ‘host_machine’ section of the cross file when cross-compiling for TRIPLET." - `((system . ,(cond ((target-hurd? triplet) "gnu") - ((target-linux? triplet) "linux") - ((target-mingw? triplet) "windows") - ((target-avr? triplet) "none") - (#t (error "meson: unknown operating system")))) - (cpu_family . ,(cond ((target-x86-32? triplet) "x86") + (let ((system + (cond + ((target-hurd? triplet) "gnu") + ((target-linux? triplet) "linux") + ((target-mingw? triplet) "windows") + ((target-avr? triplet) "none") + (else #f))) + (cpu-family + (cond ((target-x86-32? triplet) "x86") + ((target-x86-64? triplet) "x86_64") + ((target-arm32? triplet) "arm") + ((target-aarch64? triplet) "aarch64") + ((target-avr? triplet) "avr") + ((target-mips64el? triplet) "mips64") + ((target-powerpc? triplet) + (if (target-64bit? triplet) + "ppc64" + "ppc")) + ((target-riscv64? triplet) "riscv64") + (else #f)))) + (and system + cpu-family + `((system . ,system) + (cpu_family . ,cpu-family) + (cpu . ,(cond ((target-x86-32? triplet) ; i386, ..., i686 + (substring triplet 0 4)) ((target-x86-64? triplet) "x86_64") - ((target-arm32? triplet) "arm") - ((target-aarch64? triplet) "aarch64") + ((target-aarch64? triplet) "armv8-a") + ((target-arm32? triplet) "armv7") ((target-avr? triplet) "avr") - ((target-mips64el? triplet) "mips64") - ((target-powerpc? triplet) - (if (target-64bit? triplet) - "ppc64" - "ppc")) - ((target-riscv64? triplet) "riscv64") - (#t (error "meson: unknown architecture")))) - (cpu . ,(cond ((target-x86-32? triplet) ; i386, ..., i686 - (substring triplet 0 4)) - ((target-x86-64? triplet) "x86_64") - ((target-aarch64? triplet) "armv8-a") - ((target-arm32? triplet) "armv7") - ((target-avr? triplet) "avr") - ;; According to #mesonbuild on OFTC, there does not appear - ;; to be an official-ish list of CPU types recognised by - ;; Meson, the "cpu" field is not used by Meson itself and - ;; most software doesn't look at this field, except perhaps - ;; for selecting optimisations, so set it to something - ;; arbitrary. - (#t "strawberries"))) - (endian . ,(if (target-little-endian? triplet) - "little" - "big")))) + ;; According to #mesonbuild on OFTC, there does not appear + ;; to be an official-ish list of CPU types recognised by + ;; Meson, the "cpu" field is not used by Meson itself and + ;; most software doesn't look at this field, except perhaps + ;; for selecting optimisations, so set it to something + ;; arbitrary. + (#t "strawberries"))) + (endian . ,(if (target-little-endian? triplet) + "little" + "big")))))) (define (make-binaries-alist triplet) "Make an associatoin list describing what should go into @@ -146,29 +153,31 @@ (define* (lower name '() '(#:target)))) - (bag - (name name) - (system system) (target target) - (build-inputs `(("meson" ,meson) - ("ninja" ,ninja) - ,@native-inputs - ,@(if target '() inputs) - ;; Keep the standard inputs of 'gnu-build-system'. - ,@(if target - (standard-cross-packages target 'host) + (and + (make-machine-alist target) + (bag + (name name) + (system system) (target target) + (build-inputs `(("meson" ,meson) + ("ninja" ,ninja) + ,@native-inputs + ,@(if target '() inputs) + ;; Keep the standard inputs of 'gnu-build-system'. + ,@(if target + (standard-cross-packages target 'host) + '()) + ,@(standard-packages))) + (host-inputs `(,@(if source + `(("source" ,source)) '()) - ,@(standard-packages))) - (host-inputs `(,@(if source - `(("source" ,source)) - '()) - ,@(if target inputs '()))) - ;; Keep the standard inputs of 'gnu-buid-system'. - (target-inputs (if target - (standard-cross-packages target 'target) - '())) - (outputs outputs) - (build (if target meson-cross-build meson-build)) - (arguments (strip-keyword-arguments private-keywords arguments)))) + ,@(if target inputs '()))) + ;; Keep the standard inputs of 'gnu-buid-system'. + (target-inputs (if target + (standard-cross-packages target 'target) + '())) + (outputs outputs) + (build (if target meson-cross-build meson-build)) + (arguments (strip-keyword-arguments private-keywords arguments))))) (define* (meson-build name inputs #:key