Package: guix-patches;
Reported by: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
Date: Fri, 22 Dec 2023 12:37:02 UTC
Severity: normal
Tags: patch
Done: Mathieu Othacehe <mathieu <at> meije.mail-host-address-is-not-set>
Bug is archived. No further changes may be made.
Message #11 received at 67969 <at> debbugs.gnu.org (full text, mbox):
From: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com> To: 67969 <at> debbugs.gnu.org Cc: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com> Subject: [PATCH 2/4] guix: scons: Support cross-compilation. Date: Fri, 22 Dec 2023 13:37:15 +0100
* 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 <arunisaac <at> systemreboot.net> ;;; Copyright © 2021 Ludovic Courtès <ludo <at> gnu.org> +;;; Copyright © 2023 Foundation Devices, Inc. <hello <at> foundationdevices.com> ;;; ;;; 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) -- 2.41.0
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.