From patchwork Fri Sep 29 09:16:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Pierre De Jesus DIAZ X-Patchwork-Id: 54405 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 5EE1727BBEA; Fri, 29 Sep 2023 10:19:15 +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.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED 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 4E15427BBE2 for ; Fri, 29 Sep 2023 10:19:14 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qm9ds-0005xX-6Q; Fri, 29 Sep 2023 05:18:36 -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 1qm9dH-0005Ui-VE for guix-patches@gnu.org; Fri, 29 Sep 2023 05:18:00 -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 1qm9d8-0003uT-U1 for guix-patches@gnu.org; Fri, 29 Sep 2023 05:17:53 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qm9dN-0004m9-Bq; Fri, 29 Sep 2023 05:18:05 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#66263] [PATCH 07/23] gnu: Add AVR phases to cross-gcc-build-phases. Resent-From: Jean-Pierre De Jesus DIAZ Original-Sender: "Debbugs-submit" Resent-CC: efraim@flashner.co.il, vagrant@debian.org, maxim.cournoyer@gmail.com, guix-patches@gnu.org Resent-Date: Fri, 29 Sep 2023 09:18:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66263 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 66263@debbugs.gnu.org Cc: Jean-Pierre De Jesus DIAZ , efraim@flashner.co.il, vagrant@debian.org, maxim.cournoyer@gmail.com X-Debbugs-Original-Xcc: efraim@flashner.co.il, vagrant@debian.org, maxim.cournoyer@gmail.com Received: via spool by 66263-submit@debbugs.gnu.org id=B66263.169597904918124 (code B ref 66263); Fri, 29 Sep 2023 09:18:05 +0000 Received: (at 66263) by debbugs.gnu.org; 29 Sep 2023 09:17:29 +0000 Received: from localhost ([127.0.0.1]:55199 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qm9cm-0004i8-KC for submit@debbugs.gnu.org; Fri, 29 Sep 2023 05:17:28 -0400 Received: from mail-lj1-x229.google.com ([2a00:1450:4864:20::229]:55575) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qm9cN-0004dy-7f for 66263@debbugs.gnu.org; Fri, 29 Sep 2023 05:17:11 -0400 Received: by mail-lj1-x229.google.com with SMTP id 38308e7fff4ca-2c00e1d4c08so224297401fa.3 for <66263@debbugs.gnu.org>; Fri, 29 Sep 2023 02:16:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foundationdevices.com; s=google; t=1695979002; x=1696583802; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=v8cpt2jTu38Jk6y5Yzrz2fJnsovdFNlpDLG20zKhlEM=; b=T2xqI+cKggZ1I6slqxY/StL7p5UX9l0oYxorG8TI2/LbmcvCotZzcJuxU7yk72h38L yJRqc2nZINcCpNZlLWg4b6m65EWmasuhoIvIa7a2U8/AyL4g5pQWVnttXvpOkfDrp/vH 6ZlSbf2wQfc9P8B0ygI0QD3NP91KE09UXYSGr3i2a9EhKZ6Zei7LljQoU3+mjWQ1iDtq vE29FACP4v+FNSWG7iCUehFLoY/Xs2hjXdOJe8a03z7M7aNDRKtS3U6ij6Dxri825HRF LMeNr9vFDW98DTkUOUizNlDi8JOJaNGk6m8PTXSWTqQgOr3FnYi7dNa3EywFgtHBgvLq yvgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695979002; x=1696583802; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=v8cpt2jTu38Jk6y5Yzrz2fJnsovdFNlpDLG20zKhlEM=; b=SsIYXvR/BvjnYAwHXGEgcSzdxr7ysRWyKNhAVacYyyGqzVSYmM9U9H1VHP7tdyxccP vwJH79uy6XOI49XEAY2vdLMF4T9FYLufmmiCP0r9jc0nBEehGZQHGmwRyDIsH3uiBMYM 9sK9d1eNZ6JbVMclTs4eXwIshQlv0J0lDZ20mMH0pyZdWpiwGIf511fYAm362fg+uojr Gmv6vWpEJz715kVBAP5uBSkPrKoWG5ZphsyjqLR5bia5Q+ssnD72PttRUrfqSFuBkAnt kxNt1uFbMCovEC/Z1yq9XCH/G4E5iOXSWDxFUEYPxk3Bc3GClJT4d2n9MY93unjYrhsQ hueA== X-Gm-Message-State: AOJu0YxqeJfk3ecCtlNCWg9zAU2/91EIAfo3bp8vTWcRPIYJty6XWcRx 6s7d9O0lpQTGhEKsNCcd1Hwq2ZtJRVx3ijbZ9J4FsQ== X-Google-Smtp-Source: AGHT+IEUlgd6IIt9k0Xf0IV0NpVgOxI2UYp5EBhkjcJYgy2OR+kJq28yqKdqhfRRrk4xFVqp4sNi4g== X-Received: by 2002:a05:6512:10cd:b0:503:5d8:da33 with SMTP id k13-20020a05651210cd00b0050305d8da33mr3496990lfg.20.1695979002409; Fri, 29 Sep 2023 02:16:42 -0700 (PDT) Received: from omen15.home ([89.131.29.87]) by smtp.gmail.com with ESMTPSA id k15-20020a7bc40f000000b004013797efb6sm1020933wmi.9.2023.09.29.02.16.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 02:16:42 -0700 (PDT) Date: Fri, 29 Sep 2023 11:16:11 +0200 Message-Id: <20230929091627.7820-7-jean@foundationdevices.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230929091627.7820-1-jean@foundationdevices.com> References: <20230929091627.7820-1-jean@foundationdevices.com> 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: , Reply-to: Jean-Pierre De Jesus DIAZ X-ACL-Warn: , Jean-Pierre De Jesus DIAZ via Guix-patches X-Patchwork-Original-From: Jean-Pierre De Jesus DIAZ via Guix-patches via From: Jean-Pierre De Jesus DIAZ 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 * gnu/build/cross-toolchain.scm (set-cross-path/avr): New procedure. * gnu/build/cross-toolchain.scm (cross-gcc-build-phases): Add case for AVR target. --- gnu/build/cross-toolchain.scm | 41 +++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/gnu/build/cross-toolchain.scm b/gnu/build/cross-toolchain.scm index 9746be3e50..8de62be593 100644 --- a/gnu/build/cross-toolchain.scm +++ b/gnu/build/cross-toolchain.scm @@ -97,6 +97,31 @@ (define (cross? x) ;; We're building the sans-libc cross-compiler, so nothing to do. #t))) +(define* (set-cross-path/avr #:key inputs #:allow-other-keys) + (match (assoc-ref inputs "libc") + ((? string? libc) + (define (cross? x) + ;; Return #t if X is a cross-libc. + (string-prefix? libc x)) + + (let ((cpath (string-append libc "/avr/include"))) + (for-each (cut setenv <> cpath) + %gcc-cross-include-paths)) + + (setenv "CROSS_LIBRARY_PATH" + (string-append libc "/avr/lib")) + + (for-each (lambda (var) + (and=> (getenv var) + (lambda (value) + (let* ((path (search-path-as-string->list value)) + (native-path (list->search-path-as-string + (remove cross? path) ":"))) + (setenv var native-path))))) + (cons "LIBRARY_PATH" %gcc-include-paths))) + ;; AVR sans-libc cross-compiler. + (else #t))) + (define* (set-cross-path/mingw #:key inputs target #:allow-other-keys) "Add the cross MinGW headers to CROSS_C_*_INCLUDE_PATH, and remove them from C_*INCLUDE_PATH." @@ -174,13 +199,15 @@ (define* (cross-gcc-build-phases target a target triplet." (modify-phases phases (add-before 'configure 'set-cross-path - ;; This mingw32 target checking logic should match that of target-mingw? - ;; in (guix utils), but (guix utils) is too large too copy over to the - ;; build side entirely and for now we have no way to select variables to - ;; copy over. See (gnu packages cross-base) for more details. - (if (string-suffix? "-mingw32" target) - (cut set-cross-path/mingw #:target target <...>) - set-cross-path)) + (cond + ;; This mingw32 target checking logic should match that of target-mingw? + ;; in (guix utils), but (guix utils) is too large too copy over to the + ;; build side entirely and for now we have no way to select variables to + ;; copy over. See (gnu packages cross-base) for more details. + ((string-suffix? "-mingw32" target) + (cut set-cross-path/mingw #:target target <...>)) + ((string-prefix? "avr" target) set-cross-path/avr) + (else set-cross-path))) (add-after 'install 'make-cross-binutils-visible (cut make-cross-binutils-visible #:target target <...>)) (replace 'install install-strip)))