* [bug#67969] [PATCH 0/4] guix: scons: Support cross-compilation.
@ 2023-12-22 12:36 Jean-Pierre De Jesus DIAZ via Guix-patches via
2023-12-22 12:37 ` [bug#67969] [PATCH 1/4] guix: scons-build: Cleanup keyword arguments Jean-Pierre De Jesus DIAZ via Guix-patches via
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: Jean-Pierre De Jesus DIAZ via Guix-patches via @ 2023-12-22 12:36 UTC (permalink / raw)
To: 67969; +Cc: Jean-Pierre De Jesus DIAZ
This removes the need to use `(gnu packages cross-base)' in
the `make-nsis' procedure at `(gnu packages installers)' by
making use of the `#:target' keyword argument.
As a result scons-build-system now supports cross-compilation,
although it is not very useful for general cross-compilation
as SCons doesn't have a standard way of setting the "target"
and each SConscript specifies which toolchain to use
manually, so it depends on a per package basis on how to
select the correct target as projects will generally take
some command line variables for that, like in the `make-nsis'
case.
Jean-Pierre De Jesus DIAZ (4):
guix: scons-build: Cleanup keyword arguments.
guix: scons: Support cross-compilation.
gnu: make-nsis: Use cross-compilation.
gnu: make-nsis: Adjust description acronym.
gnu/packages/installers.scm | 129 +++++++++++-------------------------
guix/build-system/scons.scm | 110 +++++++++++++++++++++++++-----
2 files changed, 132 insertions(+), 107 deletions(-)
base-commit: ca813173894360edef35a5d98878a3135e99e62a
--
2.41.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [bug#67969] [PATCH 1/4] guix: scons-build: Cleanup keyword arguments.
2023-12-22 12:36 [bug#67969] [PATCH 0/4] guix: scons: Support cross-compilation Jean-Pierre De Jesus DIAZ via Guix-patches via
@ 2023-12-22 12:37 ` Jean-Pierre De Jesus DIAZ via Guix-patches via
2023-12-22 12:37 ` [bug#67969] [PATCH 2/4] guix: scons: Support cross-compilation Jean-Pierre De Jesus DIAZ via Guix-patches via
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Jean-Pierre De Jesus DIAZ via Guix-patches via @ 2023-12-22 12:37 UTC (permalink / raw)
To: 67969; +Cc: Jean-Pierre De Jesus DIAZ
* guix/build-system/scons.scm (scons-build): Remove default value of #f
from keyword arguments since they are #f if they are not present.
Change-Id: I18cca8abb350c99c20e87d623cc9975570731dfc
---
guix/build-system/scons.scm | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/guix/build-system/scons.scm b/guix/build-system/scons.scm
index 046ddef740..6cbffcab63 100644
--- a/guix/build-system/scons.scm
+++ b/guix/build-system/scons.scm
@@ -75,7 +75,7 @@ (define* (lower name
(define* (scons-build name inputs
#:key
- (source #f)
+ guile source
(tests? #t)
(scons-flags ''())
(build-targets #~'())
@@ -85,7 +85,6 @@ (define* (scons-build name inputs
(outputs '("out"))
(search-paths '())
(system (%current-system))
- (guile #f)
(imported-modules %scons-build-system-modules)
(modules '((guix build scons-build-system)
(guix build utils))))
--
2.41.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [bug#67969] [PATCH 2/4] guix: scons: Support cross-compilation.
2023-12-22 12:36 [bug#67969] [PATCH 0/4] guix: scons: Support cross-compilation Jean-Pierre De Jesus DIAZ via Guix-patches via
2023-12-22 12:37 ` [bug#67969] [PATCH 1/4] guix: scons-build: Cleanup keyword arguments Jean-Pierre De Jesus DIAZ via Guix-patches via
@ 2023-12-22 12:37 ` Jean-Pierre De Jesus DIAZ via Guix-patches via
2023-12-22 12:37 ` [bug#67969] [PATCH 3/4] gnu: make-nsis: Use cross-compilation Jean-Pierre De Jesus DIAZ via Guix-patches via
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Jean-Pierre De Jesus DIAZ via Guix-patches via @ 2023-12-22 12:37 UTC (permalink / raw)
To: 67969; +Cc: Jean-Pierre De Jesus DIAZ
* 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@systemreboot.net>
;;; Copyright © 2021 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2023 Foundation Devices, Inc. <hello@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
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [bug#67969] [PATCH 3/4] gnu: make-nsis: Use cross-compilation.
2023-12-22 12:36 [bug#67969] [PATCH 0/4] guix: scons: Support cross-compilation Jean-Pierre De Jesus DIAZ via Guix-patches via
2023-12-22 12:37 ` [bug#67969] [PATCH 1/4] guix: scons-build: Cleanup keyword arguments Jean-Pierre De Jesus DIAZ via Guix-patches via
2023-12-22 12:37 ` [bug#67969] [PATCH 2/4] guix: scons: Support cross-compilation Jean-Pierre De Jesus DIAZ via Guix-patches via
@ 2023-12-22 12:37 ` Jean-Pierre De Jesus DIAZ via Guix-patches via
2023-12-22 12:37 ` [bug#67969] [PATCH 4/4] gnu: make-nsis: Adjust description acronym Jean-Pierre De Jesus DIAZ via Guix-patches via
2023-12-22 14:43 ` [bug#67969] [PATCH 0/4] guix: scons: Support cross-compilation Jean-Pierre De Jesus Diaz via Guix-patches via
4 siblings, 0 replies; 7+ messages in thread
From: Jean-Pierre De Jesus DIAZ via Guix-patches via @ 2023-12-22 12:37 UTC (permalink / raw)
To: 67969; +Cc: Jean-Pierre De Jesus DIAZ
* gnu/packages/installers.scm (make-nsis): Use `#:target' keyword
argument in order to cross-compile the package.
Change-Id: I403254a08f43bcd21e475807ea592c2f3908ff6b
---
gnu/packages/installers.scm | 123 +++++++++++-------------------------
1 file changed, 37 insertions(+), 86 deletions(-)
diff --git a/gnu/packages/installers.scm b/gnu/packages/installers.scm
index 9879359be7..67e91b908d 100644
--- a/gnu/packages/installers.scm
+++ b/gnu/packages/installers.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2019 Carl Dong <contact@carldong.me>
+;;; Copyright © 2023 Foundation Devices, Inc. <hello@foundationdevices.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -21,17 +22,14 @@ (define-module (gnu packages installers)
#:use-module (gnu packages)
#:use-module (gnu packages build-tools)
#:use-module (gnu packages compression)
- #:use-module (gnu packages cross-base)
#:use-module (guix packages)
#:use-module (guix download)
+ #:use-module (guix gexp)
#:use-module (guix build-system scons)
#:use-module (guix utils))
(define (make-nsis machine target-arch nsis-target-type)
- (let* ((triplet (string-append machine "-" "w64-mingw32"))
- (xbinutils (cross-binutils triplet))
- (xlibc (cross-libc triplet))
- (xgcc (cross-gcc triplet #:libc xlibc)))
+ (let ((target (string-append machine "-" "w64-mingw32")))
(package
(name (string-append "nsis-" machine))
(version "3.09")
@@ -44,88 +42,41 @@ (define (make-nsis machine target-arch nsis-target-type)
"1qjnvhnj89a40ac10k2mbln0yqscdmawmgw71816i465x734dn0c"))
(patches (search-patches "nsis-env-passthru.patch"))))
(build-system scons-build-system)
- (native-inputs `(("xgcc" ,xgcc)
- ("xbinutils" ,xbinutils)
- ("mingw-w64" ,xlibc)))
- (inputs (list zlib))
(arguments
- `(#:scons ,scons-python2
- #:modules ((srfi srfi-1)
- (srfi srfi-26)
- (guix build utils)
- (guix build scons-build-system))
- #:tests? #f
- #:scons-flags `("UNICODE=yes"
- "SKIPUTILS=MakeLangId,Makensisw,NSIS Menu,SubStart,zip2exe"
- "SKIPDOC=COPYING"
- "STRIP_CP=no"
- ,(string-append "PREFIX=" %output)
- ,(string-append "TARGET_ARCH=" ,target-arch)
- ,(string-append "XGCC_W32_PREFIX=" ,triplet "-")
- ,(string-append "PREFIX_PLUGINAPI_INC=" (assoc-ref %build-inputs "mingw-w64") "/include/")
- ,(string-append "PREFIX_PLUGINAPI_LIB=" (assoc-ref %build-inputs "mingw-w64") "/lib/"))
- #:build-targets '("makensis"
- "stubs"
- "plugins"
- "utils")
- #:install-targets '("install-stubs"
- "install-plugins"
- "install-data"
- "install-utils"
- "install-compiler"
- "install-conf")
- #:phases (modify-phases %standard-phases
- (add-before 'build 'fix-env
- (lambda _
- (define* (filter-delimited-string delimited-string predicate #:optional (delimiter #\:))
- ;; Given a DELIMITED-STRING delimited by DELIMITER,
- ;; only keep items that satisfy PREDICATE
- (string-join
- (filter predicate (string-split delimited-string delimiter))
- (string delimiter)))
- (define (mingw-path? path)
- (string-prefix? (assoc-ref %build-inputs "mingw-w64") path))
- (for-each
- (lambda (env-name)
- (let ((env-val (getenv env-name)))
- ;; Remove all mingw-w64 paths from env vars meant
- ;; for native toolchain
- (setenv env-name
- (filter-delimited-string env-val (negate mingw-path?)))
- ;; Add the removed paths back into CROSS_-prefixed
- ;; version of env vars
- (setenv (string-append "CROSS_" env-name)
- (filter-delimited-string env-val mingw-path?))))
- '("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH" "LIBRARY_PATH"))
- ;; Hack to place mingw-w64 path at the end of search
- ;; paths. Could probably use a specfile and dirafter
- (setenv "CROSS_C_INCLUDE_PATH"
- (string-join
- `(,@(map (cut string-append
- (assoc-ref %build-inputs "xgcc")
- "/lib/gcc/" ,triplet "/"
- ,(package-version xgcc) <>)
- '("/include"
- "/include-fixed"))
- ,(getenv "CROSS_C_INCLUDE_PATH"))
- ":"))
- (setenv "CROSS_CPLUS_INCLUDE_PATH"
- (string-join
- `(,@(map (cut string-append (assoc-ref %build-inputs "xgcc") <>)
- `("/include/c++"
- ,(string-append "/include/c++/" ,triplet)
- "/include/c++/backward"
- ,@(map (cut string-append "/lib/gcc/" ,triplet "/" ,(package-version xgcc) <>)
- '("/include"
- "/include-fixed"))))
- ,(getenv "CROSS_CPLUS_INCLUDE_PATH"))
- ":"))))
- (add-before 'build 'fix-target-detection
- (lambda _
- ;; NSIS target detection is screwed up, manually change
- ;; it ourselves
- (substitute* "Source/build.cpp" (("m_target_type=TARGET_X86UNICODE")
- (string-append "m_target_type=" ,nsis-target-type))))))))
+ (list #:target target
+ #:scons scons-python2
+ #:tests? #f
+ #:scons-flags
+ #~(let ((xlibc (assoc-ref %build-inputs "cross-libc")))
+ (list "UNICODE=yes"
+ "SKIPUTILS=MakeLangId,Makensisw,NSIS Menu,SubStart,zip2exe"
+ "SKIPDOC=COPYING"
+ "STRIP_CP=no"
+ (string-append "PREFIX=" #$output)
+ (string-append "TARGET_ARCH=" #$target-arch)
+ (string-append "XGCC_W32_PREFIX=" #$target "-")
+ (string-append "PREFIX_PLUGINAPI_INC=" xlibc "/include/")
+ (string-append "PREFIX_PLUGINAPI_LIB=" xlibc "/lib/")))
+ #:build-targets #~'("makensis"
+ "stubs"
+ "plugins"
+ "utils")
+ #:install-targets #~'("install-stubs"
+ "install-plugins"
+ "install-data"
+ "install-utils"
+ "install-compiler"
+ "install-conf")
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-before 'build 'fix-target-detection
+ (lambda _
+ ;; NSIS target detection is screwed up, manually change
+ ;; it ourselves
+ (substitute* "Source/build.cpp"
+ (("m_target_type=TARGET_X86UNICODE")
+ (string-append "m_target_type=" #$nsis-target-type))))))))
+ (native-inputs (list zlib))
(home-page "https://nsis.sourceforge.io/Main_Page")
(synopsis "System to create Windows installers")
(description
--
2.41.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [bug#67969] [PATCH 4/4] gnu: make-nsis: Adjust description acronym.
2023-12-22 12:36 [bug#67969] [PATCH 0/4] guix: scons: Support cross-compilation Jean-Pierre De Jesus DIAZ via Guix-patches via
` (2 preceding siblings ...)
2023-12-22 12:37 ` [bug#67969] [PATCH 3/4] gnu: make-nsis: Use cross-compilation Jean-Pierre De Jesus DIAZ via Guix-patches via
@ 2023-12-22 12:37 ` Jean-Pierre De Jesus DIAZ via Guix-patches via
2023-12-22 14:43 ` [bug#67969] [PATCH 0/4] guix: scons: Support cross-compilation Jean-Pierre De Jesus Diaz via Guix-patches via
4 siblings, 0 replies; 7+ messages in thread
From: Jean-Pierre De Jesus DIAZ via Guix-patches via @ 2023-12-22 12:37 UTC (permalink / raw)
To: 67969; +Cc: Jean-Pierre De Jesus DIAZ
* gnu/packages/installers.scm (make-nsis) <description>: Use `@acronym'
for NSIS.
Change-Id: Ibff07455897542672affc1762d85009eaed0065a
---
gnu/packages/installers.scm | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/gnu/packages/installers.scm b/gnu/packages/installers.scm
index 67e91b908d..9a971d5081 100644
--- a/gnu/packages/installers.scm
+++ b/gnu/packages/installers.scm
@@ -80,9 +80,9 @@ (define (make-nsis machine target-arch nsis-target-type)
(home-page "https://nsis.sourceforge.io/Main_Page")
(synopsis "System to create Windows installers")
(description
- "NSIS (Nullsoft Scriptable Install System) is a system to create
-Windows installers. It is designed to be as small and flexible as possible
-and is therefore very suitable for internet distribution.")
+ "@acronym{NSIS, Nullsoft Scriptable Install System} is a system to
+create Windows installers. It is designed to be as small and flexible as
+possible and is therefore very suitable for internet distribution.")
(license (license:non-copyleft "file://COPYING"
"See COPYING in the distribution.")))))
--
2.41.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [bug#67969] [PATCH 0/4] guix: scons: Support cross-compilation.
2023-12-22 12:36 [bug#67969] [PATCH 0/4] guix: scons: Support cross-compilation Jean-Pierre De Jesus DIAZ via Guix-patches via
` (3 preceding siblings ...)
2023-12-22 12:37 ` [bug#67969] [PATCH 4/4] gnu: make-nsis: Adjust description acronym Jean-Pierre De Jesus DIAZ via Guix-patches via
@ 2023-12-22 14:43 ` Jean-Pierre De Jesus Diaz via Guix-patches via
2023-12-22 14:44 ` Jean-Pierre De Jesus Diaz via Guix-patches via
4 siblings, 1 reply; 7+ messages in thread
From: Jean-Pierre De Jesus Diaz via Guix-patches via @ 2023-12-22 14:43 UTC (permalink / raw)
To: 67969
Hello,
Sorry for the noise but I've realised this is not the correct
solution as the nsis compiler is indeed a Linux binary and
only code needed for Windows is cross-compiled to
mingw32.
So it makes sense to have the cross toolchain as an input
instead of using target.
--
Jean-Pierre De Jesus DIAZ
Foundation Devices, Inc.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [bug#67969] [PATCH 0/4] guix: scons: Support cross-compilation.
2023-12-22 14:43 ` [bug#67969] [PATCH 0/4] guix: scons: Support cross-compilation Jean-Pierre De Jesus Diaz via Guix-patches via
@ 2023-12-22 14:44 ` Jean-Pierre De Jesus Diaz via Guix-patches via
0 siblings, 0 replies; 7+ messages in thread
From: Jean-Pierre De Jesus Diaz via Guix-patches via @ 2023-12-22 14:44 UTC (permalink / raw)
To: 67969
close 67969
On Fri, Dec 22, 2023 at 2:43 PM Jean-Pierre De Jesus Diaz
<jean@foundationdevices.com> wrote:
>
> Hello,
>
> Sorry for the noise but I've realised this is not the correct
> solution as the nsis compiler is indeed a Linux binary and
> only code needed for Windows is cross-compiled to
> mingw32.
>
> So it makes sense to have the cross toolchain as an input
> instead of using target.
>
> --
> Jean-Pierre De Jesus DIAZ
> Foundation Devices, Inc.
--
Jean-Pierre De Jesus DIAZ
Foundation Devices, Inc.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-12-22 14:46 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-22 12:36 [bug#67969] [PATCH 0/4] guix: scons: Support cross-compilation Jean-Pierre De Jesus DIAZ via Guix-patches via
2023-12-22 12:37 ` [bug#67969] [PATCH 1/4] guix: scons-build: Cleanup keyword arguments Jean-Pierre De Jesus DIAZ via Guix-patches via
2023-12-22 12:37 ` [bug#67969] [PATCH 2/4] guix: scons: Support cross-compilation Jean-Pierre De Jesus DIAZ via Guix-patches via
2023-12-22 12:37 ` [bug#67969] [PATCH 3/4] gnu: make-nsis: Use cross-compilation Jean-Pierre De Jesus DIAZ via Guix-patches via
2023-12-22 12:37 ` [bug#67969] [PATCH 4/4] gnu: make-nsis: Adjust description acronym Jean-Pierre De Jesus DIAZ via Guix-patches via
2023-12-22 14:43 ` [bug#67969] [PATCH 0/4] guix: scons: Support cross-compilation Jean-Pierre De Jesus Diaz via Guix-patches via
2023-12-22 14:44 ` Jean-Pierre De Jesus Diaz via Guix-patches via
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).