From patchwork Fri Dec 22 12:37:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jean-Pierre De Jesus DIAZ X-Patchwork-Id: 57982 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 E510227BBEA; Fri, 22 Dec 2023 12:38:11 +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 300EB27BBE2 for ; Fri, 22 Dec 2023 12:38:08 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rGemt-0007Ip-JI; Fri, 22 Dec 2023 07:37:59 -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 1rGems-0007Gw-1Y for guix-patches@gnu.org; Fri, 22 Dec 2023 07:37: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 1rGemr-0005Ur-Mc for guix-patches@gnu.org; Fri, 22 Dec 2023 07:37:57 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rGemw-0001vP-64 for guix-patches@gnu.org; Fri, 22 Dec 2023 07:38:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#67969] [PATCH 2/4] guix: scons: Support cross-compilation. Resent-From: Jean-Pierre De Jesus DIAZ Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 22 Dec 2023 12:38:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67969 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 67969@debbugs.gnu.org Cc: Jean-Pierre De Jesus DIAZ Received: via spool by 67969-submit@debbugs.gnu.org id=B67969.17032486637347 (code B ref 67969); Fri, 22 Dec 2023 12:38:02 +0000 Received: (at 67969) by debbugs.gnu.org; 22 Dec 2023 12:37:43 +0000 Received: from localhost ([127.0.0.1]:46201 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rGemd-0001uP-0x for submit@debbugs.gnu.org; Fri, 22 Dec 2023 07:37:43 -0500 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]:50513) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rGemW-0001tp-VR for 67969@debbugs.gnu.org; Fri, 22 Dec 2023 07:37:40 -0500 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-336990fb8fbso228867f8f.1 for <67969@debbugs.gnu.org>; Fri, 22 Dec 2023 04:37:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foundationdevices.com; s=google; t=1703248646; x=1703853446; 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=GSughBSORD/DpH+iWHfeiqUQImhFigvazjjneul+ngQ=; b=MkZPVgiFy3bhhKhPwmTanl4V2r8wwxqf2aDmCUktMIq+7ycI5+xMG0eh+73kJ5G5Ri FBqAjv6RyUXw/9NIisFd9vnnxlD2mETnhM0JbUeIrrC0qJ78VfIKx2Q0nKoRn8Z/mFDL 5pbzmYwGlACGpeqZy0M8ReoH2T8evey4Hnmy5u3blUkPiKXDWR9AWqZ2K0SB19FqXQmD G5Uvn2PHt+VqUpUIOdr/+d8WJ+Dj5P/iMcz6kGATTHQoCwkZVruwWRaRHaer+VBLZ1py 4ejbsnU3GgnfTW8SMyQ8QMbgPK3wHPs79/wqEu7rhuqUs9BRBJF4UeagmalFqdbhfJXu +sgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703248646; x=1703853446; 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=GSughBSORD/DpH+iWHfeiqUQImhFigvazjjneul+ngQ=; b=WUijwdA24ZFsTS3XshcUSXzCabgGQ7dLSx1bgSE1nxPiEodxovStNxX2/ssRSQ2EeR iprbhQhiIFslUho+6MJQdaE1l+DWxEYyV99TtusdicSIMWDiOA/iXrRi3m4d4GNTsc2J 15hCiyrN2lzRdtXZHK/oiYTylOo+8q2QXfjEL8f6JvrNimxUOy++qnrwcRIOvK452mib I1i84mcMxSXKGmrzK51WeVSGYEGiG6cyq5D/GgzMQB1jG78C0BdQasc5ybcrnVwRpxal 3FW59gkgqHehngbUYXfrJL+gLIqht3Nqy/HV0tXycBgdaNR/GQzSh60QSU29YQ+F1Gxd E7Rw== X-Gm-Message-State: AOJu0YwGcgoRqYiMw0pETrZQwG23KRWPldiFBepSNC2yPvKE3JrWR5Vg X+EaRPuzIwMxwC2aBYEds3HOcnDIuaOYa03zgViHRxDgt/4Nqw== X-Google-Smtp-Source: AGHT+IGwyCVFMLTR9myTvDFmkTCH67pFQv8K+cvuMqm95ywKocQAXb9Gh3dymZEhtR5Kn0A4P8yF1w== X-Received: by 2002:a5d:6703:0:b0:336:64ba:39e7 with SMTP id o3-20020a5d6703000000b0033664ba39e7mr832870wru.102.1703248646360; Fri, 22 Dec 2023 04:37:26 -0800 (PST) Received: from jeandudey.home ([89.131.29.87]) by smtp.gmail.com with ESMTPSA id s23-20020adf9797000000b00336813bb588sm4258959wrb.111.2023.12.22.04.37.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 04:37:26 -0800 (PST) Date: Fri, 22 Dec 2023 13:37:15 +0100 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: References: 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 * guix/build-system/scons.scm (lower): Add cross compilation support. * guix/build-system/scons.scm (scons-build-cross): New procedure. Change-Id: I90413c4b573f17455b007672f701ac81f514e057 --- guix/build-system/scons.scm | 107 ++++++++++++++++++++++++++++++------ 1 file changed, 91 insertions(+), 16 deletions(-) diff --git a/guix/build-system/scons.scm b/guix/build-system/scons.scm index 6cbffcab63..3db007901c 100644 --- a/guix/build-system/scons.scm +++ b/guix/build-system/scons.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2017 Arun Isaac ;;; Copyright © 2021 Ludovic Courtès +;;; Copyright © 2023 Foundation Devices, Inc. ;;; ;;; This file is part of GNU Guix. ;;; @@ -56,22 +57,28 @@ (define* (lower name (define private-keywords '(#:target #:scons #:inputs #:native-inputs)) - (and (not target) ;XXX: no cross-compilation - (bag - (name name) - (system system) - (host-inputs `(,@(if source - `(("source" ,source)) - '()) - ,@inputs - - ;; Keep the standard inputs of 'gnu-build-system'. - ,@(standard-packages))) - (build-inputs `(("scons" ,scons) - ,@native-inputs)) - (outputs outputs) - (build scons-build) - (arguments (strip-keyword-arguments private-keywords arguments))))) + (bag + (name name) + (system system) + (target target) + (build-inputs `(("scons" ,scons) + ,@(if source + `(("source" ,source)) + '()) + ,@native-inputs + + ,@(if target '() inputs) + ,@(if target + (standard-cross-packages target 'host) + '()) + ,@(standard-packages system))) + (host-inputs (if target inputs '())) + (target-inputs (if target + (standard-cross-packages target 'target) + '())) + (outputs outputs) + (build (if target scons-build-cross scons-build)) + (arguments (strip-keyword-arguments private-keywords arguments)))) (define* (scons-build name inputs #:key @@ -122,6 +129,74 @@ (define* (scons-build name inputs #:graft? #f #:guile-for-build guile)) +(define* (scons-build-cross name + #:key + target + build-inputs target-inputs host-inputs + guile source + (tests? #f) + (scons-flags ''()) + (build-targets #~'()) + (test-target "test") + (install-targets #~'("install")) + (phases '%standard-phases) + (outputs '("out")) + (search-paths '()) + (native-search-paths '()) + (system (%current-system)) + (build (nix-system->gnu-triplet system)) + (imported-modules %scons-build-system-modules) + (modules '((guix build scons-build-system) + (guix build utils)))) + (define builder + #~(begin + (use-modules #$@(sexp->gexp modules)) + + (define %build-host-inputs + #+(input-tuples->gexp build-inputs)) + + (define %build-target-inputs + (append #$(input-tuples->gexp host-inputs) + #+(input-tuples->gexp target-inputs))) + + (define %build-inputs + (append %build-host-inputs %build-target-inputs)) + + (define %outputs + #$(outputs->gexp outputs)) + + (scons-build #:name #$name + #:source #+source + #:scons-flags #$(if (pair? scons-flags) + (sexp->gexp scons-flags) + scons-flags) + #:system #$system + #:build #$build + #:target #$target + #:build-targets #$build-targets + #:test-target #$test-target + #:tests? #$tests? + #:install-targets #$install-targets + #:phases #$(if (pair? phases) + (sexp->gexp phases) + phases) + #:outputs %outputs + #:inputs %build-target-inputs + #:native-inputs %build-host-inputs + #:search-paths '#$(sexp->gexp + (map search-path-specification->sexp + search-paths)) + #:native-search-paths '#$(sexp->gexp + (map search-path-specification->sexp + native-search-paths))))) + + (gexp->derivation name builder + #:system system + #:target target + #:graft? #f + #:modules imported-modules + #:guile-for-build guile)) + (define scons-build-system (build-system (name 'scons)