From patchwork Tue Nov 28 11:34:54 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: 56893 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 3632B27BBEA; Tue, 28 Nov 2023 11:37:09 +0000 (GMT) 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 23B5A27BBE2 for ; Tue, 28 Nov 2023 11:37:08 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r7wOi-0006wk-Tv; Tue, 28 Nov 2023 06:37:00 -0500 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 1r7wOg-0006uM-4A for guix-patches@gnu.org; Tue, 28 Nov 2023 06:36:58 -0500 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 1r7wOf-0008BY-Rf for guix-patches@gnu.org; Tue, 28 Nov 2023 06:36:57 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r7wOl-0003O6-M9 for guix-patches@gnu.org; Tue, 28 Nov 2023 06:37:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#66263] [PATCH v1 11/22] gnu: cross-toolchain: Add set-cross-path for AVR. References: <20230929091333.7623-1-jean@foundationdevices.com> In-Reply-To: <20230929091333.7623-1-jean@foundationdevices.com> Resent-From: Jean-Pierre De Jesus DIAZ Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 28 Nov 2023 11:37:03 +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: moreinfo patch To: 66263@debbugs.gnu.org Cc: Jean-Pierre De Jesus DIAZ , Jean-Pierre De Jesus DIAZ Received: via spool by 66263-submit@debbugs.gnu.org id=B66263.170117139012833 (code B ref 66263); Tue, 28 Nov 2023 11:37:03 +0000 Received: (at 66263) by debbugs.gnu.org; 28 Nov 2023 11:36:30 +0000 Received: from localhost ([127.0.0.1]:45624 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r7wOD-0003Ko-HZ for submit@debbugs.gnu.org; Tue, 28 Nov 2023 06:36:29 -0500 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]:57785) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r7wO1-0003JG-2F for 66263@debbugs.gnu.org; Tue, 28 Nov 2023 06:36:17 -0500 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-40b472f98b1so14155685e9.3 for <66263@debbugs.gnu.org>; Tue, 28 Nov 2023 03:36:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foundationdevices.com; s=google; t=1701171364; x=1701776164; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=SDcAjDE+JRIcWSFKW2WQRLdBfQCIGmenM+35bV5+iUU=; b=Jj+ciL2zgz/g8s9lrfRudUdVCxaiNmdYB6x5V6p0VWtjv0I3a1AhHaC4+qWoLoCMaJ SxX1k3dLBDAFwUyncpY42YBUaGyxDCLewtaYId/gloA4/31TJrf0dE6l09sKamvikrs2 qwNOmfiY1xp4B/GcDITQyhBZlWC5FbgL7FTsmsFT927+D+tGf+XC0Zkr0vvJ/yy3IsSm bIJ6fwLZz+Cii2krn33II/B6F7vt1VE5xUqRx5B68JpgdWC4OVj2QGWVD6vPRx+Q56VA edWXs+WXStsAQ8rWNeiZlGoKBZxR5D5oIZ1HSDXFrXqHMbk40xVDo4TMdV7pOvQdSuN3 zDTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701171364; x=1701776164; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=SDcAjDE+JRIcWSFKW2WQRLdBfQCIGmenM+35bV5+iUU=; b=cX2qcPI0SytzDPVCwoZqRdHzLVa0bKbAT5oXJNl+jOOB3/nZpy9SLpTIh2saEnsnqu d+OmX37G4Dw7OETDQqkknZcrcItTJ1QXIZxS47l8O7XK/giGSulapkxrG8tC5ZDU2Ky3 FKRyfTXYs6bj6wcTr/wXgxx5gHzbnIV1QsxekslvQlQg9gTWwFxMTHLyp4h3qDrjCFlf Sf2BYG1SaNfao39a+FTPNZ175KDcNOsasZAII6qMc4m0vOv41/hoSNOpodhgCdYDCOqZ MVsd6SGfydaP3E0Nb5UkUtz27WvatOmlcRNj0fFxui1yEvt29ALL0lr2mxOnG/lapUlj 2Wfg== X-Gm-Message-State: AOJu0YyKFK0O4mB0DwX9k9fSQgRGzGLP2tFqTGwKhMeo/c1yz6qBVoaQ vAxS5ZWJX+y9o7cM1NZW9OIohCi3ee0Ph641FKw= X-Google-Smtp-Source: AGHT+IH47aNWYwt5PRGsN9xmB0L7fg40tQI9eo2swmWDthbegwykWNyl6VZP9EIvNWgRTGCKH2QxoQ== X-Received: by 2002:a05:600c:5118:b0:3f6:9634:c8d6 with SMTP id o24-20020a05600c511800b003f69634c8d6mr10900305wms.18.1701171364023; Tue, 28 Nov 2023 03:36:04 -0800 (PST) Received: from jeandudey.home ([89.131.29.87]) by smtp.gmail.com with ESMTPSA id f7-20020a05600c154700b0040b4cb14d40sm1848769wmg.19.2023.11.28.03.36.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 03:36:03 -0800 (PST) Date: Tue, 28 Nov 2023 12:34:54 +0100 Message-ID: <20231128113510.11214-11-jean@foundationdevices.com> 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: , 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) [string-prefix? "avr"]: Return set-cross-path/avr procedure. Signed-off-by: Jean-Pierre De Jesus DIAZ Change-Id: I00bd39236ac2e31fef02164a7fffc8b56a166f0d --- gnu/build/cross-toolchain.scm | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/gnu/build/cross-toolchain.scm b/gnu/build/cross-toolchain.scm index 085b88a2c3..6f5e3b0f57 100644 --- a/gnu/build/cross-toolchain.scm +++ b/gnu/build/cross-toolchain.scm @@ -170,6 +170,31 @@ (define (unpacked-mingw-dir) (cons "LIBRARY_PATH" %gcc-include-paths)) #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 (install-strip . _) "Install a stripped GCC." ;; Unlike our 'strip' phase, this will do the right thing for @@ -188,9 +213,11 @@ (define* (cross-gcc-build-phases target ;; 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 + ((string-suffix? "-mingw32" target) + (cut set-cross-path/mingw #:target target <...>)) + ((string-prefix? "avr" target) set-cross-path/avr) + (#t set-cross-path))) (add-after 'install 'make-cross-binutils-visible (cut make-cross-binutils-visible #:target target <...>)) (replace 'install install-strip)))