[PATCH 0/4] Add --list-systems and --list-targets options.

  • Done
  • quality assurance status badge
Details
5 participants
  • Ludovic Courtès
  • Mathieu Othacehe
  • Maxim Cournoyer
  • Maxime Devos
  • Mathieu Othacehe
Owner
unassigned
Submitted by
Mathieu Othacehe
Severity
normal
M
M
Mathieu Othacehe wrote on 2 May 2022 13:17
(address . guix-patches@gnu.org)(name . Mathieu Othacehe)(address . othacehe@gnu.org)
20220502111715.13500-1-othacehe@gnu.org
Hello,

Most build commands support --system and --target options. Those options
suffer from multiple issues: they are never listed and never checked.

For --system, this is a real issue as aside from reading the (gnu packages
bootstrap) module content the user cannot know what are the supported
arguments. Providing a wrong system also fails badly:

mathieu@meije ~$ guix build hello --system=arm-linux
Backtrace:
In guix/memoization.scm:
101:0 19 (_ #<hash-table 7f1d5d82a340 0/31> #<package tar@1.34 …> …)

...
ice-9/boot-9.scm:1685:16: In procedure raise-exception:
dynamic linker name not known for this system "arm-linux"

For --target, any GNU supported triplet can possibly work but providing a
wrong triplet will also fail badly:

mathieu@meije ~$ guix build hello --target=arm-linux
Backtrace:
In guix/store.scm:
1385:9 19 (map/accumulate-builds #<store-connection 256.99 7f5bd…> …)

...
ice-9/boot-9.scm:1685:16: In procedure raise-exception:
dynamic linker name not known for this system "arm-linux"

This patchset adds two new options: --list-systems and --list-targets that
list the supported systems and targets. The arguments passed to --system and
--target options are also checked:

mathieu@meije ~/guix [env]$ ./pre-inst-env guix build hello --system=arm-linux
guix build: error: 'arm-linux' is not a supported system.

mathieu@meije ~/guix [env]$ ./pre-inst-env guix build hello --target=arm-linux
guix build: error: 'arm-linux' is not a supported target.

Thanks,

Mathieu

Mathieu Othacehe (4):
platform: Introduce new platforms.
platform: Add discovery support.
ci: Do not rely on hardcoded cross-targets lists.
scripts: Add --list-systems and --list-targets options.

doc/guix.texi | 8 ++++
etc/release-manifest.scm | 4 +-
gnu/ci.scm | 15 +------
gnu/local.mk | 4 ++
gnu/platform.scm | 62 ++++++++++++++++++++++++--
gnu/platforms/intel.scm | 48 +++++++++++++++++++++
gnu/platforms/mips.scm | 29 +++++++++++++
gnu/platforms/powerpc.scm | 36 ++++++++++++++++
gnu/platforms/riscv.scm | 29 +++++++++++++
guix/scripts/archive.scm | 20 +++------
guix/scripts/build.scm | 84 ++++++++++++++++++++++++++++++------
guix/scripts/environment.scm | 11 ++---
guix/scripts/graph.scm | 15 +++----
guix/scripts/pack.scm | 20 +++------
guix/scripts/pull.scm | 12 +++---
guix/scripts/size.scm | 13 +++---
guix/scripts/weather.scm | 11 +++--
17 files changed, 329 insertions(+), 92 deletions(-)
create mode 100644 gnu/platforms/intel.scm
create mode 100644 gnu/platforms/mips.scm
create mode 100644 gnu/platforms/powerpc.scm
create mode 100644 gnu/platforms/riscv.scm

--
2.35.1
M
M
Mathieu Othacehe wrote on 2 May 2022 13:18
[PATCH 1/4] platform: Introduce new platforms.
(address . 55220@debbugs.gnu.org)(name . Mathieu Othacehe)(address . othacehe@gnu.org)
20220502111859.13605-1-othacehe@gnu.org
* gnu/platforms/intel.scm: New file.
* gnu/platforms/mips.scm: Ditto.
* gnu/platforms/powerpc.scm: Ditto.
* gnu/platforms/riscv.scm: Ditto.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add them.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
---
gnu/local.mk | 4 ++++
gnu/platforms/intel.scm | 48 +++++++++++++++++++++++++++++++++++++++
gnu/platforms/mips.scm | 29 +++++++++++++++++++++++
gnu/platforms/powerpc.scm | 36 +++++++++++++++++++++++++++++
gnu/platforms/riscv.scm | 29 +++++++++++++++++++++++
5 files changed, 146 insertions(+)
create mode 100644 gnu/platforms/intel.scm
create mode 100644 gnu/platforms/mips.scm
create mode 100644 gnu/platforms/powerpc.scm
create mode 100644 gnu/platforms/riscv.scm

Toggle diff (183 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index ad7b0a1480..6dcb143647 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -632,6 +632,10 @@ GNU_SYSTEM_MODULES = \
\
%D%/platforms/arm.scm \
%D%/platforms/hurd.scm \
+ %D%/platforms/intel.scm \
+ %D%/platforms/mips.scm \
+ %D%/platforms/powerpc.scm \
+ %D%/platforms/riscv.scm \
\
%D%/services.scm \
%D%/services/admin.scm \
diff --git a/gnu/platforms/intel.scm b/gnu/platforms/intel.scm
new file mode 100644
index 0000000000..fb1be04cfc
--- /dev/null
+++ b/gnu/platforms/intel.scm
@@ -0,0 +1,48 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2022 Mathieu Othacehe <othacehe@gnu.org>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu platforms intel)
+ #:use-module (gnu platform)
+ #:use-module (gnu packages linux)
+ #:use-module (guix records)
+ #:export (intel32-linux
+ intel64-linux
+ intel32-mingw
+ intel64-mingw))
+
+(define intel32-linux
+ (platform
+ (target "i686-linux-gnu")
+ (system "i686-linux")
+ (linux-architecture "x86")))
+
+(define intel64-linux
+ (platform
+ (target "x86_64-linux-gnu")
+ (system "x86_64-linux")
+ (linux-architecture "x86")))
+
+(define intel32-mingw
+ (platform
+ (target "i686-w64-mingw32")
+ (system #f)))
+
+(define intel64-mingw
+ (platform
+ (target "x86_64-w64-mingw32")
+ (system #f)))
diff --git a/gnu/platforms/mips.scm b/gnu/platforms/mips.scm
new file mode 100644
index 0000000000..84a492699d
--- /dev/null
+++ b/gnu/platforms/mips.scm
@@ -0,0 +1,29 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2022 Mathieu Othacehe <othacehe@gnu.org>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu platforms mips)
+ #:use-module (gnu platform)
+ #:use-module (gnu packages linux)
+ #:use-module (guix records)
+ #:export (mips64-linux))
+
+(define mips64-linux
+ (platform
+ (target "mips64el-linux-gnu")
+ (system "mips64el-linux")
+ (linux-architecture "mips")))
diff --git a/gnu/platforms/powerpc.scm b/gnu/platforms/powerpc.scm
new file mode 100644
index 0000000000..8fadfe88de
--- /dev/null
+++ b/gnu/platforms/powerpc.scm
@@ -0,0 +1,36 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2022 Mathieu Othacehe <othacehe@gnu.org>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu platforms powerpc)
+ #:use-module (gnu platform)
+ #:use-module (gnu packages linux)
+ #:use-module (guix records)
+ #:export (powerpc-linux
+ powerpc64le-linux))
+
+(define powerpc-linux
+ (platform
+ (target "powerpc-linux-gnu")
+ (system "powerpc-linux")
+ (linux-architecture "powerpc")))
+
+(define powerpc64le-linux
+ (platform
+ (target "powerpc64le-linux-gnu")
+ (system "powerpc64le-linux")
+ (linux-architecture "powerpc")))
diff --git a/gnu/platforms/riscv.scm b/gnu/platforms/riscv.scm
new file mode 100644
index 0000000000..29a34402a2
--- /dev/null
+++ b/gnu/platforms/riscv.scm
@@ -0,0 +1,29 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2022 Mathieu Othacehe <othacehe@gnu.org>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu platforms riscv)
+ #:use-module (gnu platform)
+ #:use-module (gnu packages linux)
+ #:use-module (guix records)
+ #:export (riscv64-linux))
+
+(define riscv64-linux
+ (platform
+ (target "riscv64-linux-gnu")
+ (system "riscv64-linux")
+ (linux-architecture "riscv")))
--
2.35.1
M
M
Mathieu Othacehe wrote on 2 May 2022 13:18
[PATCH 2/4] platform: Add discovery support.
(address . 55220@debbugs.gnu.org)(name . Mathieu Othacehe)(address . othacehe@gnu.org)
20220502111859.13605-2-othacehe@gnu.org
* gnu/platform.scm (platform-modules, systems, targets): New procedures.
(%platforms): New variable.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
---
gnu/platform.scm | 62 +++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 59 insertions(+), 3 deletions(-)

Toggle diff (88 lines)
diff --git a/gnu/platform.scm b/gnu/platform.scm
index bb6519c71a..481467086a 100644
--- a/gnu/platform.scm
+++ b/gnu/platform.scm
@@ -17,22 +17,78 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (gnu platform)
+ #:use-module (guix discovery)
#:use-module (guix records)
+ #:use-module (guix ui)
+ #:use-module (srfi srfi-1)
#:export (platform
platform?
platform-target
platform-system
- platform-linux-architecture))
+ platform-linux-architecture
+
+ platform-modules
+ %platforms
+
+ systems
+ targets))
;;;
;;; Platform record.
;;;
-;; Description of a platform supported by the GNU system.
+;; Description of a platform supported by GNU Guix.
+;;
+;; The 'target' field must be a valid GNU triplet as defined here:
+;; https://www.gnu.org/software/autoconf/manual/autoconf-2.68/html_node/Specifying-Target-Triplets.html.
+;; It is used for cross-compilation purposes.
+;;
+;; The 'system' field is the name of the corresponding system as defined in
+;; the (gnu packages bootstrap) module. It can be for instance
+;; "aarch64-linux" or "armhf-linux". It is used to emulate a different host
+;; architecture, for instance i686-linux on x86_64-linux-gnu, or armhf-linux
+;; on x86_64-linux, using the QEMU binfmt transparent emulation mechanism.
+;;
+;; The 'linux-architecture' is only relevant if the kernel is Linux. In that
+;; case, it corresponds to the ARCH variable used when building Linux.
(define-record-type* <platform> platform make-platform
platform?
(target platform-target) ;"x86_64-linux-gnu"
(system platform-system) ;"x86_64-linux"
- (linux-architecture platform-linux-architecture ;"amd64"
+ (linux-architecture platform-linux-architecture ;"x86"
(default #f)))
+
+;;;
+;;; Platforms.
+;;;
+
+(define (platform-modules)
+ "Return the list of platform modules."
+ (all-modules (map (lambda (entry)
+ `(,entry . "gnu/platforms"))
+ %load-path)
+ #:warn warn-about-load-error))
+
+(define %platforms
+ ;; The list of publically-known platforms.
+ (delay (fold-module-public-variables (lambda (obj result)
+ (if (platform? obj)
+ (cons obj result)
+ result))
+ '()
+ (platform-modules))))
+
+
+;;;
+;;; Systems & Targets.
+;;;
+
+(define (systems)
+ "Return the list of supported systems."
+ (delete-duplicates
+ (filter-map platform-system (force %platforms))))
+
+(define (targets)
+ "Return the list of supported targets."
+ (map platform-target (force %platforms)))
--
2.35.1
M
M
Mathieu Othacehe wrote on 2 May 2022 13:18
[PATCH 3/4] ci: Do not rely on hardcoded cross-targets lists.
(address . 55220@debbugs.gnu.org)(name . Mathieu Othacehe)(address . othacehe@gnu.org)
20220502111859.13605-3-othacehe@gnu.org
* gnu/ci.scm (%cross-targets): Remove it ...
(cross-jobs): ... and use the targets procedure instead.
* etc/release-manifest.scm: Adapt it.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
---
etc/release-manifest.scm | 4 ++--
gnu/ci.scm | 15 ++-------------
2 files changed, 4 insertions(+), 15 deletions(-)

Toggle diff (71 lines)
diff --git a/etc/release-manifest.scm b/etc/release-manifest.scm
index e7e64efda4..1098f491ba 100644
--- a/etc/release-manifest.scm
+++ b/etc/release-manifest.scm
@@ -23,7 +23,7 @@
(use-modules (gnu packages)
(guix packages)
(guix profiles)
- ((gnu ci) #:select (%cross-targets))
+ ((gnu platform) #:select (targets))
((gnu services xorg) #:select (%default-xorg-modules))
(guix utils)
(srfi srfi-1)
@@ -144,7 +144,7 @@ (define %cross-manifest
%packages-to-cross-build)))
;; XXX: Important bits like libsigsegv and libffi don't support
;; RISCV at the moment, so don't require RISCV support.
- (delete "riscv64-linux-gnu" %cross-targets))))
+ (delete "riscv64-linux-gnu" (targets)))))
(define %cross-bootstrap-manifest
(manifest
diff --git a/gnu/ci.scm b/gnu/ci.scm
index 35fd583f75..9de1b54fc8 100644
--- a/gnu/ci.scm
+++ b/gnu/ci.scm
@@ -55,6 +55,7 @@ (define-module (gnu ci)
#:use-module (gnu packages multiprecision)
#:use-module (gnu packages make-bootstrap)
#:use-module (gnu packages package-management)
+ #:use-module (gnu platform)
#:use-module (gnu system)
#:use-module (gnu system image)
#:use-module (gnu system vm)
@@ -71,7 +72,6 @@ (define-module (gnu ci)
image->job
%core-packages
- %cross-targets
channel-source->package
arguments->systems
@@ -169,17 +169,6 @@ (define (packages-to-cross-build target)
(drop-right %core-packages 6)
%core-packages))
-(define %cross-targets
- '("mips64el-linux-gnu"
- "arm-linux-gnueabihf"
- "aarch64-linux-gnu"
- "powerpc-linux-gnu"
- "powerpc64le-linux-gnu"
- "riscv64-linux-gnu"
- "i586-pc-gnu" ;aka. GNU/Hurd
- "i686-w64-mingw32"
- "x86_64-w64-mingw32"))
-
(define (cross-jobs store system)
"Return a list of cross-compilation jobs for SYSTEM."
(define (from-32-to-64? target)
@@ -221,7 +210,7 @@ (define (either proc1 proc2 proc3)
package target system))
(packages-to-cross-build target)))
(remove (either from-32-to-64? same? pointless?)
- %cross-targets)))
+ (targets))))
(define* (guix-jobs store systems #:key source commit)
"Return a list of jobs for Guix itself."
--
2.35.1
M
M
Mathieu Othacehe wrote on 2 May 2022 13:18
[PATCH 4/4] scripts: Add --list-systems and --list-targets options.
(address . 55220@debbugs.gnu.org)(name . Mathieu Othacehe)(address . othacehe@gnu.org)
20220502111859.13605-4-othacehe@gnu.org
Also factorize the --system and --target build options. Check that the passed
system and target arguments are known platforms.

* doc/guix.texi (Additional Build Options): Document the new --list-systems
and --list-targets options.
* guix/scripts/build.scm (show-cross-build-options-help,
show-emulated-build-options-help, list-systems, list-targets): New procedures.
(%standard-cross-build-options, %standard-emulated-build-options): New
variables.
(show-help): Remove --system and --target entries and use
show-cross-build-options-help and show-emulated-build-options-help procedures instead.
(%options): Remove --system and --target entries and use
%standard-cross-build-options and %standard-emulated-build-options variables instead.
* guix/scripts/archive.scm (show-help, %options): Adapt them.
* guix/scripts/environment.scm: Ditto.
* guix/scripts/graph.scm: Ditto.
* guix/scripts/pack.scm: Ditto.
* guix/scripts/pull.scm: Ditto.
* guix/scripts/size.scm: Ditto.
* guix/scripts/weather.scm: Ditto.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
---
doc/guix.texi | 8 ++++
guix/scripts/archive.scm | 20 +++------
guix/scripts/build.scm | 84 ++++++++++++++++++++++++++++++------
guix/scripts/environment.scm | 11 ++---
guix/scripts/graph.scm | 15 +++----
guix/scripts/pack.scm | 20 +++------
guix/scripts/pull.scm | 12 +++---
guix/scripts/size.scm | 13 +++---
guix/scripts/weather.scm | 11 +++--
9 files changed, 120 insertions(+), 74 deletions(-)

Toggle diff (474 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index 5399584cb0..22a8ee7d2d 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -12025,6 +12025,14 @@ Cross-build for @var{triplet}, which must be a valid GNU triplet, such
as @code{"aarch64-linux-gnu"} (@pxref{Specifying Target Triplets, GNU
configuration triplets,, autoconf, Autoconf}).
+@item --list-systems
+List all the supported systems, than can be passed as @var{system}
+argument.
+
+@item --list-targets
+List all the supported targets, than can be passed as @var{target}
+argument.
+
@anchor{build-check}
@item --check
@cindex determinism, checking
diff --git a/guix/scripts/archive.scm b/guix/scripts/archive.scm
index f8678aa5f9..991919773a 100644
--- a/guix/scripts/archive.scm
+++ b/guix/scripts/archive.scm
@@ -93,14 +93,14 @@ (define (show-help)
(display (G_ "
-S, --source build the packages' source derivations"))
(display (G_ "
- -s, --system=SYSTEM attempt to build for SYSTEM--e.g., \"i686-linux\""))
- (display (G_ "
- --target=TRIPLET cross-build for TRIPLET--e.g., \"armel-linux-gnu\""))
- (display (G_ "
-v, --verbosity=LEVEL use the given verbosity LEVEL"))
(newline)
(show-build-options-help)
+ (newline)
+ (show-cross-build-options-help)
+ (newline)
+ (show-emulated-build-options-help)
(newline)
(display (G_ "
@@ -166,14 +166,6 @@ (define %options
(option '(#\S "source") #f #f
(lambda (opt name arg result)
(alist-cons 'source? #t result)))
- (option '(#\s "system") #t #f
- (lambda (opt name arg result)
- (alist-cons 'system arg
- (alist-delete 'system result eq?))))
- (option '("target") #t #f
- (lambda (opt name arg result)
- (alist-cons 'target arg
- (alist-delete 'target result eq?))))
(option '(#\e "expression") #t #f
(lambda (opt name arg result)
(alist-cons 'expression arg result)))
@@ -186,7 +178,9 @@ (define %options
(lambda (opt name arg result)
(alist-cons 'dry-run? #t result)))
- %standard-build-options))
+ (append %standard-build-options
+ %standard-cross-build-options
+ %standard-emulated-build-options)))
(define (derivation-from-expression store str package-derivation
system source?)
diff --git a/guix/scripts/build.scm b/guix/scripts/build.scm
index d9cdb6e5e0..9aa0bd2f53 100644
--- a/guix/scripts/build.scm
+++ b/guix/scripts/build.scm
@@ -47,6 +47,7 @@ (define-module (guix scripts build)
#:use-module (srfi srfi-35)
#:use-module (srfi srfi-37)
#:use-module (gnu packages)
+ #:use-module (gnu platform)
#:use-module ((guix status) #:select (with-status-verbosity))
#:use-module ((guix progress) #:select (current-terminal-columns))
#:use-module ((guix build syscalls) #:select (terminal-columns))
@@ -54,9 +55,15 @@ (define-module (guix scripts build)
#:export (log-url
%standard-build-options
+ %standard-cross-build-options
+ %standard-emulated-build-options
+
set-build-options-from-command-line
set-build-options-from-command-line*
+
show-build-options-help
+ show-cross-build-options-help
+ show-emulated-build-options-help
guix-build
register-root
@@ -184,6 +191,18 @@ (define (show-build-options-help)
(display (G_ "
--debug=LEVEL produce debugging output at LEVEL")))
+(define (show-cross-build-options-help)
+ (display (G_ "
+ --list-targets list available targets"))
+ (display (G_ "
+ --target=TRIPLET cross-build for TRIPLET--e.g., \"aarch64-linux-gnu\"")))
+
+(define (show-emulated-build-options-help)
+ (display (G_ "
+ --list-systems list available systems"))
+ (display (G_ "
+ -s, --system=SYSTEM attempt to build for SYSTEM--e.g., \"i686-linux\"")))
+
(define (set-build-options-from-command-line store opts)
"Given OPTS, an alist as returned by 'args-fold' given
'%standard-build-options', set the corresponding build options on STORE."
@@ -319,6 +338,52 @@ (define %standard-build-options
(leave (G_ "not a number: '~a' option argument: ~a~%")
name arg)))))))
+(define (list-systems)
+ "Print the available systems."
+ (display (G_ "The available systems are:\n"))
+ (newline)
+ (format #t "~{ - ~a ~%~}"
+ (sort (systems) string<?)))
+
+(define (list-targets)
+ "Print the available targets."
+ (display (G_ "The available targets are:\n"))
+ (newline)
+ (format #t "~{ - ~a ~%~}"
+ (sort (targets) string<?)))
+
+(define %standard-cross-build-options
+ ;; Build options related to cross builds.
+ (list
+ (option '("list-targets") #f #f
+ (lambda (opt name arg result)
+ (list-targets)
+ (exit 0)))
+ (option '("target") #t #f
+ (lambda (opt name arg result . rest)
+ (let ((t (false-if-exception
+ (first (member arg (targets))))))
+ (if t
+ (apply values (alist-cons 'target t result) rest)
+ (leave (G_ "'~a' is not a supported target.~%")
+ arg)))))))
+
+(define %standard-emulated-build-options
+ ;; Build options related to emulated builds.
+ (list
+ (option '("list-systems") #f #f
+ (lambda (opt name arg result)
+ (list-systems)
+ (exit 0)))
+ (option '(#\s "system") #t #f
+ (lambda (opt name arg result . rest)
+ (let ((s (false-if-exception
+ (first (member arg (systems))))))
+ (if s
+ (apply values (alist-cons 'system s result) rest)
+ (leave (G_ "'~a' is not a supported system.~%")
+ arg)))))))
+
;;;
;;; Command-line options.
@@ -353,10 +418,6 @@ (define (show-help)
--sources[=TYPE] build source derivations; TYPE may optionally be one
of \"package\", \"all\" (default), or \"transitive\""))
(display (G_ "
- -s, --system=SYSTEM attempt to build for SYSTEM--e.g., \"i686-linux\""))
- (display (G_ "
- --target=TRIPLET cross-build for TRIPLET--e.g., \"armel-linux-gnu\""))
- (display (G_ "
-d, --derivations return the derivation paths of the given packages"))
(display (G_ "
--check rebuild items to check for non-determinism issues"))
@@ -374,6 +435,10 @@ (define (show-help)
(newline)
(show-build-options-help)
(newline)
+ (show-cross-build-options-help)
+ (newline)
+ (show-emulated-build-options-help)
+ (newline)
(show-transformation-options-help)
(newline)
(display (G_ "
@@ -420,13 +485,6 @@ (define %options
(alist-cons 'build-mode (build-mode repair)
result)
rest)))
- (option '(#\s "system") #t #f
- (lambda (opt name arg result)
- (alist-cons 'system arg result)))
- (option '("target") #t #f
- (lambda (opt name arg result)
- (alist-cons 'target arg
- (alist-delete 'target result eq?))))
(option '(#\d "derivations") #f #f
(lambda (opt name arg result)
(alist-cons 'derivations-only? #t result)))
@@ -459,7 +517,9 @@ (define %options
(alist-cons 'log-file? #t result)))
(append %transformation-options
- %standard-build-options)))
+ %standard-build-options
+ %standard-cross-build-options
+ %standard-emulated-build-options)))
(define (options->things-to-build opts)
"Read the arguments from OPTS and return a list of high-level objects to
diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm
index 07b54cd89b..51dab27767 100644
--- a/guix/scripts/environment.scm
+++ b/guix/scripts/environment.scm
@@ -96,8 +96,6 @@ (define (show-environment-options-help)
(display (G_ "
--search-paths display needed environment variable definitions"))
(display (G_ "
- -s, --system=SYSTEM attempt to build for SYSTEM--e.g., \"i686-linux\""))
- (display (G_ "
-r, --root=FILE make FILE a symlink to the result, and register it
as a garbage collector root"))
(display (G_ "
@@ -145,6 +143,8 @@ (define (show-help)
(newline)
(show-build-options-help)
(newline)
+ (show-emulated-build-options-help)
+ (newline)
(show-transformation-options-help)
(newline)
(display (G_ "
@@ -226,10 +226,6 @@ (define %options
(option '(#\n "dry-run") #f #f
(lambda (opt name arg result)
(alist-cons 'dry-run? #t result)))
- (option '(#\s "system") #t #f
- (lambda (opt name arg result)
- (alist-cons 'system arg
- (alist-delete 'system result eq?))))
(option '(#\C "container") #f #f
(lambda (opt name arg result)
(alist-cons 'container? #t result)))
@@ -273,7 +269,8 @@ (define %options
(alist-cons 'bootstrap? #t result)))
(append %transformation-options
- %standard-build-options)))
+ %standard-build-options
+ %standard-emulated-build-options)))
(define (pick-all alist key)
"Return a list of values in ALIST associated with KEY."
diff --git a/guix/scripts/graph.scm b/guix/scripts/graph.scm
index 535875c858..c61504ac9d 100644
--- a/guix/scripts/graph.scm
+++ b/guix/scripts/graph.scm
@@ -39,7 +39,9 @@ (define-module (guix scripts graph)
options->transformation
%transformation-options))
#:use-module ((guix scripts build)
- #:select (%standard-build-options))
+ #:select (%standard-build-options
+ %standard-emulated-build-options
+ show-emulated-build-options-help))
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
#:use-module (srfi srfi-34)
@@ -504,10 +506,6 @@ (define %options
(option '(#\e "expression") #t #f
(lambda (opt name arg result)
(alist-cons 'expression arg result)))
- (option '(#\s "system") #t #f
- (lambda (opt name arg result)
- (alist-cons 'system arg
- (alist-delete 'system result eq?))))
(find (lambda (option)
(member "load-path" (option-names option)))
%standard-build-options)
@@ -519,7 +517,8 @@ (define %options
(lambda args
(show-version-and-exit "guix graph")))
- %transformation-options))
+ (append %transformation-options
+ %standard-emulated-build-options)))
(define (show-help)
;; TRANSLATORS: Here 'dot' is the name of a program; it must not be
@@ -540,8 +539,6 @@ (define (show-help)
--path display the shortest path between the given nodes"))
(display (G_ "
-e, --expression=EXPR consider the package EXPR evaluates to"))
- (display (G_ "
- -s, --system=SYSTEM consider the graph for SYSTEM--e.g., \"i686-linux\""))
(newline)
(display (G_ "
-L, --load-path=DIR prepend DIR to the package module search path"))
@@ -553,6 +550,8 @@ (define (show-help)
(display (G_ "
-V, --version display version information and exit"))
(newline)
+ (show-emulated-build-options-help)
+ (newline)
(show-bug-report-information))
(define %default-options
diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm
index 32f0d3abb1..ee42c9bf73 100644
--- a/guix/scripts/pack.scm
+++ b/guix/scripts/pack.scm
@@ -1244,17 +1244,9 @@ (define %options
(option '(#\m "manifest") #t #f
(lambda (opt name arg result)
(alist-cons 'manifest arg result)))
- (option '(#\s "system") #t #f
- (lambda (opt name arg result)
- (alist-cons 'system arg
- (alist-delete 'system result eq?))))
(option '("entry-point") #t #f
(lambda (opt name arg result)
(alist-cons 'entry-point arg result)))
- (option '("target") #t #f
- (lambda (opt name arg result)
- (alist-cons 'target arg
- (alist-delete 'target result eq?))))
(option '(#\C "compression") #t #f
(lambda (opt name arg result)
(alist-cons 'compressor (lookup-compressor arg)
@@ -1305,13 +1297,19 @@ (define %options
(append %deb-format-options
%transformation-options
- %standard-build-options)))
+ %standard-build-options
+ %standard-cross-build-options
+ %standard-emulated-build-options)))
(define (show-help)
(display (G_ "Usage: guix pack [OPTION]... PACKAGE...
Create a bundle of PACKAGE.\n"))
(show-build-options-help)
(newline)
+ (show-cross-build-options-help)
+ (newline)
+ (show-emulated-build-options-help)
+ (newline)
(show-transformation-options-help)
(newline)
(show-deb-format-options)
@@ -1325,10 +1323,6 @@ (define (show-help)
(display (G_ "
-e, --expression=EXPR consider the package EXPR evaluates to"))
(display (G_ "
- -s, --system=SYSTEM attempt to build for SYSTEM--e.g., \"i686-linux\""))
- (display (G_ "
- --target=TRIPLET cross-build for TRIPLET--e.g., \"armel-linux-gnu\""))
- (display (G_ "
-C, --compression=TOOL compress using TOOL--e.g., \"lzip\""))
(display (G_ "
-S, --symlink=SPEC create symlinks to the profile according to SPEC"))
diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm
index 7402782ff3..8aba3e1e37 100644
--- a/guix/scripts/pull.scm
+++ b/guix/scripts/pull.scm
@@ -118,12 +118,13 @@ (define (show-help)
-p, --profile=PROFILE use PROFILE instead of ~/.config/guix/current"))
(display (G_ "
-v, --verbosity=LEVEL use the given verbosity LEVEL"))
- (display (G_ "
- -s, --system=SYSTEM attempt to build for SYSTEM--e.g., \"i686-linux\""))
(display (G_ "
--bootstrap use the bootstrap Guile to build the new Guix"))
(newline)
(show-build-options-help)
+ (newline)
+ (show-emulated-build-options-help)
+ (newline)
(display (G_ "
-h, --help display this help and exit"))
(display (G_ "
@@ -184,10 +185,6 @@ (define %options
(lambda (opt name arg result)
(alist-cons 'profile (canonicalize-profile arg)
result)))
- (option '(#\s "system") #t #f
- (lambda (opt name arg result)
- (alist-cons 'system arg
- (alist-delete 'system result eq?))))
(option '(#\n "dry-run") #f #f
(lambda (opt name arg result)
(alist-cons 'dry-run? #t result)))
@@ -208,7 +205,8 @@ (define %options
(lambda args
(show-version-and-exit "guix pull")))
- %standard-build-options))
+ (append %standard-build-options
+ %standard-emulated-build-options)))
(define (warn-about-backward-updates channel start commit relation)
"Warn about non-forward updates of CHANNEL from START to COMMIT, without
diff --git a/guix/scripts/size.scm b/guix/scripts/size.scm
index e46983382a..e3e64b4fcb 100644
--- a/guix/scripts/size.scm
+++ b/guix/scripts/size.scm
@@ -235,8 +235,6 @@ (define (show-help)
(display (G_ "
--substitute-urls=URLS
fetch substitute from URLS if they are authorized"))
- (display (G_ "
- -s, --system=SYSTEM consider packages for SYSTEM--e.g., \"i686-linux\""))
;; TRANSLATORS: "closure" and "self" must not be translated.
(display (G_ "
--sort=KEY sort according to KEY--\"closure\" or \"self\""))
@@ -251,15 +249,13 @@ (define (show-help)
(display (G_ "
-V, --version display version information and exit"))
(newline)
+ (show-emulated-build-options-help)
+ (newline)
(show-bug-report-information))
(define %options
;; Specifications of the command-line options.
- (list (option '(#\s "system") #t #f
- (lambda (opt name arg result)
- (alist-cons 'system arg
- (alist-delete 'system result eq?))))
- (option '("substitute-urls") #t #f
+ (cons* (option '("substitute-urls") #t #f
(lambda (opt name arg result . rest)
(apply values
(alist-cons 'substitute-urls
@@ -287,7 +283,8 @@ (define %options
(exit 0)))
(option '(#\V "version") #f #f
(lambda args
- (show-version-and-exit "guix size")))))
+ (show-version-and-exit "guix size")))
+ %standard-emulated-build-options))
(define %default-options
`((system . ,(%current-system))
diff --git a/guix/scripts/weather.scm b/guix/scripts/weather.scm
index adba614b8c..b51bd40a17 100644
--- a/guix/scripts/weather.scm
+++ b/guix/scripts/weather.scm
@@ -40,6 +40,7 @@ (define-module (guix scripts weather)
#:use-module (guix ci)
#:use-module (guix sets)
#:use-module (guix graph)
+ #:use-module (guix scripts build)
#:autoload (guix scripts graph) (%bag-node-type)
#:use-module (gnu packages)
#:use-module (web uri)
@@ -339,18 +340,18 @@ (define (show-help)
COUNT dependents"))
(display (G_ "
--display-missing display the list of missing substitutes"))
- (display (G_ "
- -s, --system=SYSTEM consider substitutes for SYSTEM--e.g., \"i686-linux\""))
(newline)
(display (G_ "
-h, --help display this help and exit"))
(display (G_ "
-V, --version display version information and exit"))
(newline)
+ (sh
This message was truncated. Download the full message here.
L
L
Ludovic Courtès wrote on 6 May 2022 16:37
Re: bug#55220: [PATCH 0/4] Add --list-systems and --list-targets options.
(name . Mathieu Othacehe)(address . othacehe@gnu.org)(address . 55220@debbugs.gnu.org)
87sfpm3exy.fsf@gnu.org
Hello!

Mathieu Othacehe <othacehe@gnu.org> skribis:

Toggle quote (36 lines)
> Most build commands support --system and --target options. Those options
> suffer from multiple issues: they are never listed and never checked.
>
> For --system, this is a real issue as aside from reading the (gnu packages
> bootstrap) module content the user cannot know what are the supported
> arguments. Providing a wrong system also fails badly:
>
> mathieu@meije ~$ guix build hello --system=arm-linux
> Backtrace:
> In guix/memoization.scm:
> 101:0 19 (_ #<hash-table 7f1d5d82a340 0/31> #<package tar@1.34 …> …)
>
> ...
> ice-9/boot-9.scm:1685:16: In procedure raise-exception:
> dynamic linker name not known for this system "arm-linux"
>
> For --target, any GNU supported triplet can possibly work but providing a
> wrong triplet will also fail badly:
>
> mathieu@meije ~$ guix build hello --target=arm-linux
> Backtrace:
> In guix/store.scm:
> 1385:9 19 (map/accumulate-builds #<store-connection 256.99 7f5bd…> …)
>
>
> ...
> ice-9/boot-9.scm:1685:16: In procedure raise-exception:
> dynamic linker name not known for this system "arm-linux"
>
> This patchset adds two new options: --list-systems and --list-targets that
> list the supported systems and targets. The arguments passed to --system and
> --target options are also checked:
>
> mathieu@meije ~/guix [env]$ ./pre-inst-env guix build hello --system=arm-linux
> guix build: error: 'arm-linux' is not a supported system.

Nice.

Toggle quote (3 lines)
> mathieu@meije ~/guix [env]$ ./pre-inst-env guix build hello --target=arm-linux
> guix build: error: 'arm-linux' is not a supported target.

Nice… but it’s a valid triplet (for freestanding binaries on 32-bit ARM,
I believe).

The ‘--target’ issue is tricky IMO because it’s mostly free-form. In
(gnu packages …), there are calls like:

(cross-gcc "avr" …)
(cross-gcc "arm-none-eabi" …)
(cross-gcc "propeller-elf" …)

These are unusual but valid triplets.

(I’m going to look more closely at the rest to get a more informed
opinion…)

Thanks for looking into this loooongstanding issue!

Ludo’.
L
L
Ludovic Courtès wrote on 6 May 2022 16:39
(name . Mathieu Othacehe)(address . othacehe@gnu.org)(address . 55220@debbugs.gnu.org)
87mtfu3etd.fsf_-_@gnu.org
Hi,

Mathieu Othacehe <othacehe@gnu.org> skribis:

Toggle quote (8 lines)
> * gnu/platforms/intel.scm: New file.
> * gnu/platforms/mips.scm: Ditto.
> * gnu/platforms/powerpc.scm: Ditto.
> * gnu/platforms/riscv.scm: Ditto.
> * gnu/local.mk (GNU_SYSTEM_MODULES): Add them.
>
> Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>

Nice.

Toggle quote (6 lines)
> +(define intel32-linux
> + (platform
> + (target "i686-linux-gnu")
> + (system "i686-linux")
> + (linux-architecture "x86")))

How about having a ‘glibc-dynamic-linker’ field in <platform>?

That would be a good way to determine whether a platform is a good
candidate for ‘--target’.

(Also, in hindsight, ‘triplet’ might be more accurate than ‘target’ for
the first field. No big deal though.)

Ludo’.
L
L
Ludovic Courtès wrote on 6 May 2022 16:41
(name . Mathieu Othacehe)(address . othacehe@gnu.org)(address . 55220@debbugs.gnu.org)
87ilqi3eq9.fsf_-_@gnu.org
Mathieu Othacehe <othacehe@gnu.org> skribis:

Toggle quote (5 lines)
> * gnu/platform.scm (platform-modules, systems, targets): New procedures.
> (%platforms): New variable.
>
> Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>

[...]

Toggle quote (9 lines)
> +(define %platforms
> + ;; The list of publically-known platforms.
> + (delay (fold-module-public-variables (lambda (obj result)
> + (if (platform? obj)
> + (cons obj result)
> + result))
> + '()
> + (platform-modules))))

Maybe expose it as a memoizing procedure thunk called ‘platforms’, for
consistency with the names ‘systems’ and ‘targets’.

Toggle quote (14 lines)
> +
> +;;;
> +;;; Systems & Targets.
> +;;;
> +
> +(define (systems)
> + "Return the list of supported systems."
> + (delete-duplicates
> + (filter-map platform-system (force %platforms))))
> +
> +(define (targets)
> + "Return the list of supported targets."
> + (map platform-target (force %platforms)))

Or ‘supported-systems’ and ‘supported-targets’?

Ludo’.
L
L
Ludovic Courtès wrote on 6 May 2022 16:54
(name . Mathieu Othacehe)(address . othacehe@gnu.org)(address . 55220@debbugs.gnu.org)
875ymi3e5t.fsf_-_@gnu.org
Mathieu Othacehe <othacehe@gnu.org> skribis:

Toggle quote (23 lines)
> Also factorize the --system and --target build options. Check that the passed
> system and target arguments are known platforms.
>
> * doc/guix.texi (Additional Build Options): Document the new --list-systems
> and --list-targets options.
> * guix/scripts/build.scm (show-cross-build-options-help,
> show-emulated-build-options-help, list-systems, list-targets): New procedures.
> (%standard-cross-build-options, %standard-emulated-build-options): New
> variables.
> (show-help): Remove --system and --target entries and use
> show-cross-build-options-help and show-emulated-build-options-help procedures instead.
> (%options): Remove --system and --target entries and use
> %standard-cross-build-options and %standard-emulated-build-options variables instead.
> * guix/scripts/archive.scm (show-help, %options): Adapt them.
> * guix/scripts/environment.scm: Ditto.
> * guix/scripts/graph.scm: Ditto.
> * guix/scripts/pack.scm: Ditto.
> * guix/scripts/pull.scm: Ditto.
> * guix/scripts/size.scm: Ditto.
> * guix/scripts/weather.scm: Ditto.
>
> Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>

[...]

Toggle quote (4 lines)
> +@item --list-systems
> +List all the supported systems, than can be passed as @var{system}
> +argument.

“as an argument to @option{--system}” maybe?

Toggle quote (4 lines)
> +@item --list-targets
> +List all the supported targets, than can be passed as @var{target}
> +argument.

Likewise.

Toggle quote (16 lines)
> +(define %standard-cross-build-options
> + ;; Build options related to cross builds.
> + (list
> + (option '("list-targets") #f #f
> + (lambda (opt name arg result)
> + (list-targets)
> + (exit 0)))
> + (option '("target") #t #f
> + (lambda (opt name arg result . rest)
> + (let ((t (false-if-exception
> + (first (member arg (targets))))))
> + (if t
> + (apply values (alist-cons 'target t result) rest)
> + (leave (G_ "'~a' is not a supported target.~%")
> + arg)))))))

This is my main issue: should we still accept any triplet, and simply
print a nicer error than currently when the glibc dynamic linker name is
unknown?

Or should be be just as strict as above, at the risk of frustrating
developers porting stuff to new or unusual platforms?

Or should there be an option to bypass this check?

Maybe I’m overrating the usefulness of allowing users to pass in
arbitrary triplets, though the manual does suggest that when porting to
a new platform (info "(guix) Porting"). Thoughts?

Toggle quote (16 lines)
> +(define %standard-emulated-build-options
> + ;; Build options related to emulated builds.
> + (list
> + (option '("list-systems") #f #f
> + (lambda (opt name arg result)
> + (list-systems)
> + (exit 0)))
> + (option '(#\s "system") #t #f
> + (lambda (opt name arg result . rest)
> + (let ((s (false-if-exception
> + (first (member arg (systems))))))
> + (if s
> + (apply values (alist-cons 'system s result) rest)
> + (leave (G_ "'~a' is not a supported system.~%")
> + arg)))))))

Since it has nothing to do with emulation :-), how about calling it
‘%standard-native-build-options’, ‘%standard-system-type-build-options’,
or similar?

How about replacing:

(let ((s (false-if-exception (first (member arg (systems))))))
(if s …))

with:

(if (member arg (systems)) …)

?

Also, please remove final period in the error message passed to ‘leave’.

Anyway, overall this patch series is a clear improvement over the status
quo, so this is just about fine-tuning the details.

Thanks!

Ludo’.
M
M
Mathieu Othacehe wrote on 7 May 2022 17:50
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 55220@debbugs.gnu.org)
87sfpl8hq0.fsf@gnu.org
Hey Ludo!

Thanks for reviewing :)

Toggle quote (2 lines)
> How about having a ‘glibc-dynamic-linker’ field in <platform>?

Seems like a great idea, I added them.

Thanks,

Mathieu
M
M
Mathieu Othacehe wrote on 7 May 2022 17:53
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 55220@debbugs.gnu.org)
87o8098hl0.fsf@gnu.org
Toggle quote (3 lines)
> Maybe expose it as a memoizing procedure thunk called ‘platforms’, for
> consistency with the names ‘systems’ and ‘targets’.

Done.

Toggle quote (2 lines)
> Or ‘supported-systems’ and ‘supported-targets’?

That would clash with the supported-systems field of <package>.

But by the way, there's already a %supported-systems in (guix packages)
that I would like to replace by systems. However importing (gnu
platform) from there seems problematic.

Thanks,

Mathieu
M
M
Mathieu Othacehe wrote on 7 May 2022 18:04
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 55220@debbugs.gnu.org)
87k0ax8h2t.fsf@gnu.org
Toggle quote (2 lines)
> “as an argument to @option{--system}” maybe?

Done.

Toggle quote (9 lines)
> This is my main issue: should we still accept any triplet, and simply
> print a nicer error than currently when the glibc dynamic linker name is
> unknown?
>
> Or should be be just as strict as above, at the risk of frustrating
> developers porting stuff to new or unusual platforms?
>
> Or should there be an option to bypass this check?

It's debatable for sure. However, now that glibc-dynamic-linker (and
system->linux-architecture in an additional patch) are relying on (gnu
platform) I think forcing the user to prompt a "supported" target, or to
define a new platform, makes sense.

If someone is adventurous enough to try something like: 'guix build
--target=new-target hello', patching glibc-dynamic-linker is already
most likely required. So now that glibc-dynamic-linker is relying on
(gnu platforms), defining a new platform will not be much harder.

Toggle quote (4 lines)
> Maybe I’m overrating the usefulness of allowing users to pass in
> arbitrary triplets, though the manual does suggest that when porting to
> a new platform (info "(guix) Porting"). Thoughts?

I adapted this documentation section in v2.

Toggle quote (9 lines)
> How about replacing:
>
> (let ((s (false-if-exception (first (member arg (systems))))))
> (if s …))
>
> with:
>
> (if (member arg (systems)) …)

Done,

Toggle quote (2 lines)
> Also, please remove final period in the error message passed to ‘leave’.

and done.

Thanks,

Mathieu
M
M
Mathieu Othacehe wrote on 7 May 2022 18:11
[PATCH v2 0/6] Add --list-systems and --list-targets options.
(address . 55220@debbugs.gnu.org)(name . Mathieu Othacehe)(address . othacehe@gnu.org)
20220507161126.14553-1-othacehe@gnu.org
Hello,

In this second version, I took Ludo remarks into account.
I also added two new patches:

platform: Add glibc-dynamic-linker field.
... so that the glibc-dynamic-linker procedure is using the <platform> records,

and,

linux: Remove system->linux-architecture procedure.
... so that all the callers of this procedure now rely on <platform> records.

This brings us closer to having all the system specific definitions stored in
once place. Next stop is maybe to have (gnu platform) pointing to the
bootstrap executables?

Thanks,

Mathieu

Mathieu Othacehe (6):
platform: Introduce new platforms.
platform: Add discovery support.
ci: Do not rely on hardcoded cross-targets lists.
scripts: Add --list-systems and --list-targets options.
platform: Add glibc-dynamic-linker field.
linux: Remove system->linux-architecture procedure.

doc/guix.texi | 38 ++++++----
etc/release-manifest.scm | 4 +-
gnu/ci.scm | 15 +---
gnu/local.mk | 5 ++
gnu/packages/bioinformatics.scm | 11 ++-
gnu/packages/bootstrap.scm | 47 ++++++------
gnu/packages/cross-base.scm | 4 +-
gnu/packages/instrumentation.scm | 8 +-
gnu/packages/linux.scm | 34 +++------
gnu/platform.scm | 113 +++++++++++++++++++++++++++--
gnu/platforms/arm.scm | 6 +-
gnu/platforms/hurd.scm | 3 +-
gnu/platforms/intel.scm | 52 +++++++++++++
gnu/platforms/mips.scm | 30 ++++++++
gnu/platforms/powerpc.scm | 38 ++++++++++
gnu/platforms/riscv.scm | 30 ++++++++
gnu/platforms/s390.scm | 30 ++++++++
guix/build-system/linux-module.scm | 4 +-
guix/scripts/archive.scm | 20 ++---
guix/scripts/build.scm | 84 ++++++++++++++++++---
guix/scripts/environment.scm | 11 +--
guix/scripts/graph.scm | 15 ++--
guix/scripts/pack.scm | 20 ++---
guix/scripts/pull.scm | 12 ++-
guix/scripts/size.scm | 13 ++--
guix/scripts/weather.scm | 11 ++-
26 files changed, 489 insertions(+), 169 deletions(-)
create mode 100644 gnu/platforms/intel.scm
create mode 100644 gnu/platforms/mips.scm
create mode 100644 gnu/platforms/powerpc.scm
create mode 100644 gnu/platforms/riscv.scm
create mode 100644 gnu/platforms/s390.scm

--
2.36.0
M
M
Mathieu Othacehe wrote on 7 May 2022 18:11
[PATCH v2 1/6] platform: Introduce new platforms.
(address . 55220@debbugs.gnu.org)(name . Mathieu Othacehe)(address . othacehe@gnu.org)
20220507161126.14553-2-othacehe@gnu.org
* gnu/platforms/intel.scm: New file.
* gnu/platforms/mips.scm: Ditto.
* gnu/platforms/powerpc.scm: Ditto.
* gnu/platforms/riscv.scm: Ditto.
* gnu/platforms/s390.scm: Ditto.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add them.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
---
gnu/local.mk | 5 ++++
gnu/platforms/intel.scm | 48 +++++++++++++++++++++++++++++++++++++++
gnu/platforms/mips.scm | 29 +++++++++++++++++++++++
gnu/platforms/powerpc.scm | 36 +++++++++++++++++++++++++++++
gnu/platforms/riscv.scm | 29 +++++++++++++++++++++++
gnu/platforms/s390.scm | 29 +++++++++++++++++++++++
6 files changed, 176 insertions(+)
create mode 100644 gnu/platforms/intel.scm
create mode 100644 gnu/platforms/mips.scm
create mode 100644 gnu/platforms/powerpc.scm
create mode 100644 gnu/platforms/riscv.scm
create mode 100644 gnu/platforms/s390.scm

Toggle diff (219 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index c100b97cc1..b8ce581a5d 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -633,6 +633,11 @@ GNU_SYSTEM_MODULES = \
\
%D%/platforms/arm.scm \
%D%/platforms/hurd.scm \
+ %D%/platforms/intel.scm \
+ %D%/platforms/mips.scm \
+ %D%/platforms/powerpc.scm \
+ %D%/platforms/riscv.scm \
+ %D%/platforms/s390.scm \
\
%D%/services.scm \
%D%/services/admin.scm \
diff --git a/gnu/platforms/intel.scm b/gnu/platforms/intel.scm
new file mode 100644
index 0000000000..ee9fe003a7
--- /dev/null
+++ b/gnu/platforms/intel.scm
@@ -0,0 +1,48 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2022 Mathieu Othacehe <othacehe@gnu.org>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu platforms intel)
+ #:use-module (gnu platform)
+ #:use-module (gnu packages linux)
+ #:use-module (guix records)
+ #:export (intel32-linux
+ intel64-linux
+ intel32-mingw
+ intel64-mingw))
+
+(define intel32-linux
+ (platform
+ (target "i686-linux-gnu")
+ (system "i686-linux")
+ (linux-architecture "i386")))
+
+(define intel64-linux
+ (platform
+ (target "x86_64-linux-gnu")
+ (system "x86_64-linux")
+ (linux-architecture "x86_64")))
+
+(define intel32-mingw
+ (platform
+ (target "i686-w64-mingw32")
+ (system #f)))
+
+(define intel64-mingw
+ (platform
+ (target "x86_64-w64-mingw32")
+ (system #f)))
diff --git a/gnu/platforms/mips.scm b/gnu/platforms/mips.scm
new file mode 100644
index 0000000000..84a492699d
--- /dev/null
+++ b/gnu/platforms/mips.scm
@@ -0,0 +1,29 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2022 Mathieu Othacehe <othacehe@gnu.org>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu platforms mips)
+ #:use-module (gnu platform)
+ #:use-module (gnu packages linux)
+ #:use-module (guix records)
+ #:export (mips64-linux))
+
+(define mips64-linux
+ (platform
+ (target "mips64el-linux-gnu")
+ (system "mips64el-linux")
+ (linux-architecture "mips")))
diff --git a/gnu/platforms/powerpc.scm b/gnu/platforms/powerpc.scm
new file mode 100644
index 0000000000..8fadfe88de
--- /dev/null
+++ b/gnu/platforms/powerpc.scm
@@ -0,0 +1,36 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2022 Mathieu Othacehe <othacehe@gnu.org>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu platforms powerpc)
+ #:use-module (gnu platform)
+ #:use-module (gnu packages linux)
+ #:use-module (guix records)
+ #:export (powerpc-linux
+ powerpc64le-linux))
+
+(define powerpc-linux
+ (platform
+ (target "powerpc-linux-gnu")
+ (system "powerpc-linux")
+ (linux-architecture "powerpc")))
+
+(define powerpc64le-linux
+ (platform
+ (target "powerpc64le-linux-gnu")
+ (system "powerpc64le-linux")
+ (linux-architecture "powerpc")))
diff --git a/gnu/platforms/riscv.scm b/gnu/platforms/riscv.scm
new file mode 100644
index 0000000000..29a34402a2
--- /dev/null
+++ b/gnu/platforms/riscv.scm
@@ -0,0 +1,29 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2022 Mathieu Othacehe <othacehe@gnu.org>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu platforms riscv)
+ #:use-module (gnu platform)
+ #:use-module (gnu packages linux)
+ #:use-module (guix records)
+ #:export (riscv64-linux))
+
+(define riscv64-linux
+ (platform
+ (target "riscv64-linux-gnu")
+ (system "riscv64-linux")
+ (linux-architecture "riscv")))
diff --git a/gnu/platforms/s390.scm b/gnu/platforms/s390.scm
new file mode 100644
index 0000000000..c8caafbe45
--- /dev/null
+++ b/gnu/platforms/s390.scm
@@ -0,0 +1,29 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2022 Mathieu Othacehe <othacehe@gnu.org>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu platforms s390)
+ #:use-module (gnu platform)
+ #:use-module (gnu packages linux)
+ #:use-module (guix records)
+ #:export (s390x-linux))
+
+(define s390x-linux
+ (platform
+ (target "s390x-linux-gnu")
+ (system "s390x-linux")
+ (linux-architecture "s390")))
--
2.36.0
M
M
Mathieu Othacehe wrote on 7 May 2022 18:11
[PATCH v2 2/6] platform: Add discovery support.
(address . 55220@debbugs.gnu.org)(name . Mathieu Othacehe)(address . othacehe@gnu.org)
20220507161126.14553-3-othacehe@gnu.org
* gnu/platform.scm (platform-modules, systems, targets,
lookup-platform-by-system, lookup-platform-by-target,
lookup-platform-by-target-or-system
platform-system->target,
platform-target->system): New procedures.
(%platforms): New variable.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
---
gnu/platform.scm | 101 +++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 98 insertions(+), 3 deletions(-)

Toggle diff (127 lines)
diff --git a/gnu/platform.scm b/gnu/platform.scm
index bb6519c71a..4c5211e107 100644
--- a/gnu/platform.scm
+++ b/gnu/platform.scm
@@ -17,22 +17,117 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (gnu platform)
+ #:use-module (guix discovery)
+ #:use-module (guix memoization)
#:use-module (guix records)
+ #:use-module (guix ui)
+ #:use-module (srfi srfi-1)
#:export (platform
platform?
platform-target
platform-system
- platform-linux-architecture))
+ platform-linux-architecture
+
+ platform-modules
+ platforms
+ lookup-platform-by-system
+ lookup-platform-by-target
+ lookup-platform-by-target-or-system
+ platform-system->target
+ platform-target->system
+
+ systems
+ targets))
;;;
;;; Platform record.
;;;
-;; Description of a platform supported by the GNU system.
+;; Description of a platform supported by GNU Guix.
+;;
+;; The 'target' field must be a valid GNU triplet as defined here:
+;; https://www.gnu.org/software/autoconf/manual/autoconf-2.68/html_node/Specifying-Target-Triplets.html.
+;; It is used for cross-compilation purposes.
+;;
+;; The 'system' field is the name of the corresponding system as defined in
+;; the (gnu packages bootstrap) module. It can be for instance
+;; "aarch64-linux" or "armhf-linux". It is used to emulate a different host
+;; architecture, for instance i686-linux on x86_64-linux-gnu, or armhf-linux
+;; on x86_64-linux, using the QEMU binfmt transparent emulation mechanism.
+;;
+;; The 'linux-architecture' is only relevant if the kernel is Linux. In that
+;; case, it corresponds to the ARCH variable used when building Linux.
(define-record-type* <platform> platform make-platform
platform?
(target platform-target) ;"x86_64-linux-gnu"
(system platform-system) ;"x86_64-linux"
- (linux-architecture platform-linux-architecture ;"amd64"
+ (linux-architecture platform-linux-architecture ;"x86"
(default #f)))
+
+;;;
+;;; Platforms.
+;;;
+
+(define (platform-modules)
+ "Return the list of platform modules."
+ (all-modules (map (lambda (entry)
+ `(,entry . "gnu/platforms"))
+ %load-path)
+ #:warn warn-about-load-error))
+
+(define platforms
+ ;; The list of publically-known platforms.
+ (memoize
+ (lambda ()
+ (fold-module-public-variables (lambda (obj result)
+ (if (platform? obj)
+ (cons obj result)
+ result))
+ '()
+ (platform-modules)))))
+
+(define (lookup-platform-by-system system)
+ "Return the platform corresponding to the given SYSTEM."
+ (find (lambda (platform)
+ (let ((s (platform-system platform)))
+ (and (string? s) (string=? s system))))
+ (platforms)))
+
+(define (lookup-platform-by-target target)
+ "Return the platform corresponding to the given TARGET."
+ (find (lambda (platform)
+ (let ((t (platform-target platform)))
+ (and (string? t) (string=? t target))))
+ (platforms)))
+
+(define (lookup-platform-by-target-or-system target-or-system)
+ "Return the platform corresponding to the given TARGET or SYSTEM."
+ (or (lookup-platform-by-target target-or-system)
+ (lookup-platform-by-system target-or-system)))
+
+(define (platform-system->target system)
+ "Return the target matching the given SYSTEM if it exists or false
+otherwise."
+ (let ((platform (lookup-platform-by-system system)))
+ (and=> platform platform-target)))
+
+(define (platform-target->system target)
+ "Return the system matching the given TARGET if it exists or false
+otherwise."
+ (let ((platform (lookup-platform-by-target system)))
+ (and=> platform platform-system)))
+
+
+;;;
+;;; Systems & Targets.
+;;;
+
+(define (systems)
+ "Return the list of supported systems."
+ (delete-duplicates
+ (filter-map platform-system (platforms))))
+
+(define (targets)
+ "Return the list of supported targets."
+ (map platform-target (platforms)))
--
2.36.0
M
M
Mathieu Othacehe wrote on 7 May 2022 18:11
[PATCH v2 3/6] ci: Do not rely on hardcoded cross-targets lists.
(address . 55220@debbugs.gnu.org)(name . Mathieu Othacehe)(address . othacehe@gnu.org)
20220507161126.14553-4-othacehe@gnu.org
* gnu/ci.scm (%cross-targets): Remove it ...
(cross-jobs): ... and use the targets procedure instead.
* etc/release-manifest.scm: Adapt it.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
---
etc/release-manifest.scm | 4 ++--
gnu/ci.scm | 15 ++-------------
2 files changed, 4 insertions(+), 15 deletions(-)

Toggle diff (71 lines)
diff --git a/etc/release-manifest.scm b/etc/release-manifest.scm
index e7e64efda4..1098f491ba 100644
--- a/etc/release-manifest.scm
+++ b/etc/release-manifest.scm
@@ -23,7 +23,7 @@
(use-modules (gnu packages)
(guix packages)
(guix profiles)
- ((gnu ci) #:select (%cross-targets))
+ ((gnu platform) #:select (targets))
((gnu services xorg) #:select (%default-xorg-modules))
(guix utils)
(srfi srfi-1)
@@ -144,7 +144,7 @@ (define %cross-manifest
%packages-to-cross-build)))
;; XXX: Important bits like libsigsegv and libffi don't support
;; RISCV at the moment, so don't require RISCV support.
- (delete "riscv64-linux-gnu" %cross-targets))))
+ (delete "riscv64-linux-gnu" (targets)))))
(define %cross-bootstrap-manifest
(manifest
diff --git a/gnu/ci.scm b/gnu/ci.scm
index 35fd583f75..9de1b54fc8 100644
--- a/gnu/ci.scm
+++ b/gnu/ci.scm
@@ -55,6 +55,7 @@ (define-module (gnu ci)
#:use-module (gnu packages multiprecision)
#:use-module (gnu packages make-bootstrap)
#:use-module (gnu packages package-management)
+ #:use-module (gnu platform)
#:use-module (gnu system)
#:use-module (gnu system image)
#:use-module (gnu system vm)
@@ -71,7 +72,6 @@ (define-module (gnu ci)
image->job
%core-packages
- %cross-targets
channel-source->package
arguments->systems
@@ -169,17 +169,6 @@ (define (packages-to-cross-build target)
(drop-right %core-packages 6)
%core-packages))
-(define %cross-targets
- '("mips64el-linux-gnu"
- "arm-linux-gnueabihf"
- "aarch64-linux-gnu"
- "powerpc-linux-gnu"
- "powerpc64le-linux-gnu"
- "riscv64-linux-gnu"
- "i586-pc-gnu" ;aka. GNU/Hurd
- "i686-w64-mingw32"
- "x86_64-w64-mingw32"))
-
(define (cross-jobs store system)
"Return a list of cross-compilation jobs for SYSTEM."
(define (from-32-to-64? target)
@@ -221,7 +210,7 @@ (define (either proc1 proc2 proc3)
package target system))
(packages-to-cross-build target)))
(remove (either from-32-to-64? same? pointless?)
- %cross-targets)))
+ (targets))))
(define* (guix-jobs store systems #:key source commit)
"Return a list of jobs for Guix itself."
--
2.36.0
M
M
Mathieu Othacehe wrote on 7 May 2022 18:11
[PATCH v2 4/6] scripts: Add --list-systems and --list-targets options.
(address . 55220@debbugs.gnu.org)(name . Mathieu Othacehe)(address . othacehe@gnu.org)
20220507161126.14553-5-othacehe@gnu.org
Also factorize the --system and --target build options. Check that the passed
system and target arguments are known platforms.

* doc/guix.texi (Additional Build Options): Document the new --list-systems
and --list-targets options.
* guix/scripts/build.scm (show-cross-build-options-help,
show-emulated-build-options-help, list-systems, list-targets): New procedures.
(%standard-cross-build-options, %standard-emulated-build-options): New
variables.
(show-help): Remove --system and --target entries and use
show-cross-build-options-help and show-emulated-build-options-help procedures instead.
(%options): Remove --system and --target entries and use
%standard-cross-build-options and %standard-emulated-build-options variables instead.
* guix/scripts/archive.scm (show-help, %options): Adapt them.
* guix/scripts/environment.scm: Ditto.
* guix/scripts/graph.scm: Ditto.
* guix/scripts/pack.scm: Ditto.
* guix/scripts/pull.scm: Ditto.
* guix/scripts/size.scm: Ditto.
* guix/scripts/weather.scm: Ditto.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
---
doc/guix.texi | 8 ++++
guix/scripts/archive.scm | 20 +++------
guix/scripts/build.scm | 84 ++++++++++++++++++++++++++++++------
guix/scripts/environment.scm | 11 ++---
guix/scripts/graph.scm | 15 +++----
guix/scripts/pack.scm | 20 +++------
guix/scripts/pull.scm | 12 +++---
guix/scripts/size.scm | 13 +++---
guix/scripts/weather.scm | 11 +++--
9 files changed, 120 insertions(+), 74 deletions(-)

Toggle diff (474 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index 5399584cb0..6757c105dc 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -12025,6 +12025,14 @@ Cross-build for @var{triplet}, which must be a valid GNU triplet, such
as @code{"aarch64-linux-gnu"} (@pxref{Specifying Target Triplets, GNU
configuration triplets,, autoconf, Autoconf}).
+@item --list-systems
+List all the supported systems, than can be passed as an argument to
+@option{--system}.
+
+@item --list-targets
+List all the supported targets, than can be passed as an argument to
+@option{--target}.
+
@anchor{build-check}
@item --check
@cindex determinism, checking
diff --git a/guix/scripts/archive.scm b/guix/scripts/archive.scm
index f8678aa5f9..1e961c84e6 100644
--- a/guix/scripts/archive.scm
+++ b/guix/scripts/archive.scm
@@ -93,14 +93,14 @@ (define (show-help)
(display (G_ "
-S, --source build the packages' source derivations"))
(display (G_ "
- -s, --system=SYSTEM attempt to build for SYSTEM--e.g., \"i686-linux\""))
- (display (G_ "
- --target=TRIPLET cross-build for TRIPLET--e.g., \"armel-linux-gnu\""))
- (display (G_ "
-v, --verbosity=LEVEL use the given verbosity LEVEL"))
(newline)
(show-build-options-help)
+ (newline)
+ (show-cross-build-options-help)
+ (newline)
+ (show-native-build-options-help)
(newline)
(display (G_ "
@@ -166,14 +166,6 @@ (define %options
(option '(#\S "source") #f #f
(lambda (opt name arg result)
(alist-cons 'source? #t result)))
- (option '(#\s "system") #t #f
- (lambda (opt name arg result)
- (alist-cons 'system arg
- (alist-delete 'system result eq?))))
- (option '("target") #t #f
- (lambda (opt name arg result)
- (alist-cons 'target arg
- (alist-delete 'target result eq?))))
(option '(#\e "expression") #t #f
(lambda (opt name arg result)
(alist-cons 'expression arg result)))
@@ -186,7 +178,9 @@ (define %options
(lambda (opt name arg result)
(alist-cons 'dry-run? #t result)))
- %standard-build-options))
+ (append %standard-build-options
+ %standard-cross-build-options
+ %standard-native-build-options)))
(define (derivation-from-expression store str package-derivation
system source?)
diff --git a/guix/scripts/build.scm b/guix/scripts/build.scm
index d9cdb6e5e0..a09c54451f 100644
--- a/guix/scripts/build.scm
+++ b/guix/scripts/build.scm
@@ -47,6 +47,7 @@ (define-module (guix scripts build)
#:use-module (srfi srfi-35)
#:use-module (srfi srfi-37)
#:use-module (gnu packages)
+ #:use-module (gnu platform)
#:use-module ((guix status) #:select (with-status-verbosity))
#:use-module ((guix progress) #:select (current-terminal-columns))
#:use-module ((guix build syscalls) #:select (terminal-columns))
@@ -54,9 +55,15 @@ (define-module (guix scripts build)
#:export (log-url
%standard-build-options
+ %standard-cross-build-options
+ %standard-native-build-options
+
set-build-options-from-command-line
set-build-options-from-command-line*
+
show-build-options-help
+ show-cross-build-options-help
+ show-native-build-options-help
guix-build
register-root
@@ -184,6 +191,18 @@ (define (show-build-options-help)
(display (G_ "
--debug=LEVEL produce debugging output at LEVEL")))
+(define (show-cross-build-options-help)
+ (display (G_ "
+ --list-targets list available targets"))
+ (display (G_ "
+ --target=TRIPLET cross-build for TRIPLET--e.g., \"aarch64-linux-gnu\"")))
+
+(define (show-native-build-options-help)
+ (display (G_ "
+ --list-systems list available systems"))
+ (display (G_ "
+ -s, --system=SYSTEM attempt to build for SYSTEM--e.g., \"i686-linux\"")))
+
(define (set-build-options-from-command-line store opts)
"Given OPTS, an alist as returned by 'args-fold' given
'%standard-build-options', set the corresponding build options on STORE."
@@ -319,6 +338,52 @@ (define %standard-build-options
(leave (G_ "not a number: '~a' option argument: ~a~%")
name arg)))))))
+(define (list-systems)
+ "Print the available systems."
+ (display (G_ "The available systems are:\n"))
+ (newline)
+ (format #t "~{ - ~a ~%~}"
+ (sort (systems) string<?)))
+
+(define (list-targets)
+ "Print the available targets."
+ (display (G_ "The available targets are:\n"))
+ (newline)
+ (format #t "~{ - ~a ~%~}"
+ (sort (targets) string<?)))
+
+(define %standard-cross-build-options
+ ;; Build options related to cross builds.
+ (list
+ (option '("list-targets") #f #f
+ (lambda (opt name arg result)
+ (list-targets)
+ (exit 0)))
+ (option '("target") #t #f
+ (lambda (opt name arg result . rest)
+ (let ((t (false-if-exception
+ (first (member arg (targets))))))
+ (if t
+ (apply values (alist-cons 'target t result) rest)
+ (leave (G_ "'~a' is not a supported target~%")
+ arg)))))))
+
+(define %standard-native-build-options
+ ;; Build options related to native builds.
+ (list
+ (option '("list-systems") #f #f
+ (lambda (opt name arg result)
+ (list-systems)
+ (exit 0)))
+ (option '(#\s "system") #t #f
+ (lambda (opt name arg result . rest)
+ (let ((s (false-if-exception
+ (first (member arg (systems))))))
+ (if s
+ (apply values (alist-cons 'system s result) rest)
+ (leave (G_ "'~a' is not a supported system~%")
+ arg)))))))
+
;;;
;;; Command-line options.
@@ -353,10 +418,6 @@ (define (show-help)
--sources[=TYPE] build source derivations; TYPE may optionally be one
of \"package\", \"all\" (default), or \"transitive\""))
(display (G_ "
- -s, --system=SYSTEM attempt to build for SYSTEM--e.g., \"i686-linux\""))
- (display (G_ "
- --target=TRIPLET cross-build for TRIPLET--e.g., \"armel-linux-gnu\""))
- (display (G_ "
-d, --derivations return the derivation paths of the given packages"))
(display (G_ "
--check rebuild items to check for non-determinism issues"))
@@ -374,6 +435,10 @@ (define (show-help)
(newline)
(show-build-options-help)
(newline)
+ (show-cross-build-options-help)
+ (newline)
+ (show-native-build-options-help)
+ (newline)
(show-transformation-options-help)
(newline)
(display (G_ "
@@ -420,13 +485,6 @@ (define %options
(alist-cons 'build-mode (build-mode repair)
result)
rest)))
- (option '(#\s "system") #t #f
- (lambda (opt name arg result)
- (alist-cons 'system arg result)))
- (option '("target") #t #f
- (lambda (opt name arg result)
- (alist-cons 'target arg
- (alist-delete 'target result eq?))))
(option '(#\d "derivations") #f #f
(lambda (opt name arg result)
(alist-cons 'derivations-only? #t result)))
@@ -459,7 +517,9 @@ (define %options
(alist-cons 'log-file? #t result)))
(append %transformation-options
- %standard-build-options)))
+ %standard-build-options
+ %standard-cross-build-options
+ %standard-native-build-options)))
(define (options->things-to-build opts)
"Read the arguments from OPTS and return a list of high-level objects to
diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm
index 07b54cd89b..3216235937 100644
--- a/guix/scripts/environment.scm
+++ b/guix/scripts/environment.scm
@@ -96,8 +96,6 @@ (define (show-environment-options-help)
(display (G_ "
--search-paths display needed environment variable definitions"))
(display (G_ "
- -s, --system=SYSTEM attempt to build for SYSTEM--e.g., \"i686-linux\""))
- (display (G_ "
-r, --root=FILE make FILE a symlink to the result, and register it
as a garbage collector root"))
(display (G_ "
@@ -145,6 +143,8 @@ (define (show-help)
(newline)
(show-build-options-help)
(newline)
+ (show-native-build-options-help)
+ (newline)
(show-transformation-options-help)
(newline)
(display (G_ "
@@ -226,10 +226,6 @@ (define %options
(option '(#\n "dry-run") #f #f
(lambda (opt name arg result)
(alist-cons 'dry-run? #t result)))
- (option '(#\s "system") #t #f
- (lambda (opt name arg result)
- (alist-cons 'system arg
- (alist-delete 'system result eq?))))
(option '(#\C "container") #f #f
(lambda (opt name arg result)
(alist-cons 'container? #t result)))
@@ -273,7 +269,8 @@ (define %options
(alist-cons 'bootstrap? #t result)))
(append %transformation-options
- %standard-build-options)))
+ %standard-build-options
+ %standard-native-build-options)))
(define (pick-all alist key)
"Return a list of values in ALIST associated with KEY."
diff --git a/guix/scripts/graph.scm b/guix/scripts/graph.scm
index 535875c858..2f102180c9 100644
--- a/guix/scripts/graph.scm
+++ b/guix/scripts/graph.scm
@@ -39,7 +39,9 @@ (define-module (guix scripts graph)
options->transformation
%transformation-options))
#:use-module ((guix scripts build)
- #:select (%standard-build-options))
+ #:select (%standard-build-options
+ %standard-native-build-options
+ show-native-build-options-help))
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
#:use-module (srfi srfi-34)
@@ -504,10 +506,6 @@ (define %options
(option '(#\e "expression") #t #f
(lambda (opt name arg result)
(alist-cons 'expression arg result)))
- (option '(#\s "system") #t #f
- (lambda (opt name arg result)
- (alist-cons 'system arg
- (alist-delete 'system result eq?))))
(find (lambda (option)
(member "load-path" (option-names option)))
%standard-build-options)
@@ -519,7 +517,8 @@ (define %options
(lambda args
(show-version-and-exit "guix graph")))
- %transformation-options))
+ (append %transformation-options
+ %standard-native-build-options)))
(define (show-help)
;; TRANSLATORS: Here 'dot' is the name of a program; it must not be
@@ -540,8 +539,6 @@ (define (show-help)
--path display the shortest path between the given nodes"))
(display (G_ "
-e, --expression=EXPR consider the package EXPR evaluates to"))
- (display (G_ "
- -s, --system=SYSTEM consider the graph for SYSTEM--e.g., \"i686-linux\""))
(newline)
(display (G_ "
-L, --load-path=DIR prepend DIR to the package module search path"))
@@ -553,6 +550,8 @@ (define (show-help)
(display (G_ "
-V, --version display version information and exit"))
(newline)
+ (show-native-build-options-help)
+ (newline)
(show-bug-report-information))
(define %default-options
diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm
index 32f0d3abb1..d3ee69840c 100644
--- a/guix/scripts/pack.scm
+++ b/guix/scripts/pack.scm
@@ -1244,17 +1244,9 @@ (define %options
(option '(#\m "manifest") #t #f
(lambda (opt name arg result)
(alist-cons 'manifest arg result)))
- (option '(#\s "system") #t #f
- (lambda (opt name arg result)
- (alist-cons 'system arg
- (alist-delete 'system result eq?))))
(option '("entry-point") #t #f
(lambda (opt name arg result)
(alist-cons 'entry-point arg result)))
- (option '("target") #t #f
- (lambda (opt name arg result)
- (alist-cons 'target arg
- (alist-delete 'target result eq?))))
(option '(#\C "compression") #t #f
(lambda (opt name arg result)
(alist-cons 'compressor (lookup-compressor arg)
@@ -1305,13 +1297,19 @@ (define %options
(append %deb-format-options
%transformation-options
- %standard-build-options)))
+ %standard-build-options
+ %standard-cross-build-options
+ %standard-native-build-options)))
(define (show-help)
(display (G_ "Usage: guix pack [OPTION]... PACKAGE...
Create a bundle of PACKAGE.\n"))
(show-build-options-help)
(newline)
+ (show-cross-build-options-help)
+ (newline)
+ (show-native-build-options-help)
+ (newline)
(show-transformation-options-help)
(newline)
(show-deb-format-options)
@@ -1325,10 +1323,6 @@ (define (show-help)
(display (G_ "
-e, --expression=EXPR consider the package EXPR evaluates to"))
(display (G_ "
- -s, --system=SYSTEM attempt to build for SYSTEM--e.g., \"i686-linux\""))
- (display (G_ "
- --target=TRIPLET cross-build for TRIPLET--e.g., \"armel-linux-gnu\""))
- (display (G_ "
-C, --compression=TOOL compress using TOOL--e.g., \"lzip\""))
(display (G_ "
-S, --symlink=SPEC create symlinks to the profile according to SPEC"))
diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm
index 7402782ff3..11a1bf0734 100644
--- a/guix/scripts/pull.scm
+++ b/guix/scripts/pull.scm
@@ -118,12 +118,13 @@ (define (show-help)
-p, --profile=PROFILE use PROFILE instead of ~/.config/guix/current"))
(display (G_ "
-v, --verbosity=LEVEL use the given verbosity LEVEL"))
- (display (G_ "
- -s, --system=SYSTEM attempt to build for SYSTEM--e.g., \"i686-linux\""))
(display (G_ "
--bootstrap use the bootstrap Guile to build the new Guix"))
(newline)
(show-build-options-help)
+ (newline)
+ (show-native-build-options-help)
+ (newline)
(display (G_ "
-h, --help display this help and exit"))
(display (G_ "
@@ -184,10 +185,6 @@ (define %options
(lambda (opt name arg result)
(alist-cons 'profile (canonicalize-profile arg)
result)))
- (option '(#\s "system") #t #f
- (lambda (opt name arg result)
- (alist-cons 'system arg
- (alist-delete 'system result eq?))))
(option '(#\n "dry-run") #f #f
(lambda (opt name arg result)
(alist-cons 'dry-run? #t result)))
@@ -208,7 +205,8 @@ (define %options
(lambda args
(show-version-and-exit "guix pull")))
- %standard-build-options))
+ (append %standard-build-options
+ %standard-native-build-options)))
(define (warn-about-backward-updates channel start commit relation)
"Warn about non-forward updates of CHANNEL from START to COMMIT, without
diff --git a/guix/scripts/size.scm b/guix/scripts/size.scm
index e46983382a..5bb970443c 100644
--- a/guix/scripts/size.scm
+++ b/guix/scripts/size.scm
@@ -235,8 +235,6 @@ (define (show-help)
(display (G_ "
--substitute-urls=URLS
fetch substitute from URLS if they are authorized"))
- (display (G_ "
- -s, --system=SYSTEM consider packages for SYSTEM--e.g., \"i686-linux\""))
;; TRANSLATORS: "closure" and "self" must not be translated.
(display (G_ "
--sort=KEY sort according to KEY--\"closure\" or \"self\""))
@@ -251,15 +249,13 @@ (define (show-help)
(display (G_ "
-V, --version display version information and exit"))
(newline)
+ (show-native-build-options-help)
+ (newline)
(show-bug-report-information))
(define %options
;; Specifications of the command-line options.
- (list (option '(#\s "system") #t #f
- (lambda (opt name arg result)
- (alist-cons 'system arg
- (alist-delete 'system result eq?))))
- (option '("substitute-urls") #t #f
+ (cons* (option '("substitute-urls") #t #f
(lambda (opt name arg result . rest)
(apply values
(alist-cons 'substitute-urls
@@ -287,7 +283,8 @@ (define %options
(exit 0)))
(option '(#\V "version") #f #f
(lambda args
- (show-version-and-exit "guix size")))))
+ (show-version-and-exit "guix size")))
+ %standard-native-build-options))
(define %default-options
`((system . ,(%current-system))
diff --git a/guix/scripts/weather.scm b/guix/scripts/weather.scm
index adba614b8c..b7d8165262 100644
--- a/guix/scripts/weather.scm
+++ b/guix/scripts/weather.scm
@@ -40,6 +40,7 @@ (define-module (guix scripts weather)
#:use-module (guix ci)
#:use-module (guix sets)
#:use-module (guix graph)
+ #:use-module (guix scripts build)
#:autoload (guix scripts graph) (%bag-node-type)
#:use-module (gnu packages)
#:use-module (web uri)
@@ -339,18 +340,18 @@ (define (show-help)
COUNT dependents"))
(display (G_ "
--display-missing display the list of missing substitutes"))
- (display (G_ "
- -s, --system=SYSTEM consider substitutes for SYSTEM--e.g., \"i686-linux\""))
(newline)
(display (G_ "
-h, --help display this help and exit"))
(display (G_ "
-V, --version display version information and exit"))
(newline)
+ (show-native-build-option
This message was truncated. Download the full message here.
M
M
Mathieu Othacehe wrote on 7 May 2022 18:11
[PATCH v2 5/6] platform: Add glibc-dynamic-linker field.
(address . 55220@debbugs.gnu.org)(name . Mathieu Othacehe)(address . othacehe@gnu.org)
20220507161126.14553-6-othacehe@gnu.org
* gnu/platform.scm (<platform>)[glibc-dynamic-linker]: New field.
(platform-glibc-dynamic-linker, lookup-platform-by-system): New procedures.
* gnu/platforms/arm.scm (armhf-linux, aarch64-linux): Add the glibc-dynamic-linker field.
* gnu/platforms/hurd.scm (hurd): Ditto.
* gnu/platforms/intel.scm (intel32-linux, intel64-linux, intel32-mingw, intel64-linux): Ditto.
* gnu/platforms/mips.scm (mips64el-linux): Ditto.
* gnu/platforms/powerpc.scm (powerpc-linux, powerpc64-linux): Ditto.
* gnu/platforms/riscv.scm (riscv64-linux): Ditto.
* gnu/platforms/s390.scm (riscv64-linux): Ditto.
* gnu/packages/bootstrap.scm (glibc-dynamic-linker): Adapt it.
---
gnu/packages/bootstrap.scm | 47 ++++++++++++++++++--------------------
gnu/platform.scm | 14 ++++++++----
gnu/platforms/arm.scm | 6 +++--
gnu/platforms/hurd.scm | 3 ++-
gnu/platforms/intel.scm | 12 ++++++----
gnu/platforms/mips.scm | 3 ++-
gnu/platforms/powerpc.scm | 6 +++--
gnu/platforms/riscv.scm | 3 ++-
gnu/platforms/s390.scm | 3 ++-
9 files changed, 56 insertions(+), 41 deletions(-)

Toggle diff (218 lines)
diff --git a/gnu/packages/bootstrap.scm b/gnu/packages/bootstrap.scm
index 8bd0c4eaf3..5337617a53 100644
--- a/gnu/packages/bootstrap.scm
+++ b/gnu/packages/bootstrap.scm
@@ -26,6 +26,7 @@
(define-module (gnu packages bootstrap)
#:use-module (guix licenses)
#:use-module (gnu packages)
+ #:use-module (gnu platform)
#:use-module (guix packages)
#:use-module (guix download)
#:use-module (guix build-system)
@@ -314,33 +315,29 @@ (define* (glibc-dynamic-linker
(%current-system))))
"Return the name of Glibc's dynamic linker for SYSTEM."
;; See the 'SYSDEP_KNOWN_INTERPRETER_NAMES' cpp macro in libc.
- (cond ((string=? system "x86_64-linux") "/lib/ld-linux-x86-64.so.2")
- ((string=? system "i686-linux") "/lib/ld-linux.so.2")
- ((string=? system "armhf-linux") "/lib/ld-linux-armhf.so.3")
- ((string=? system "mips64el-linux") "/lib/ld.so.1")
- ((string=? system "i586-gnu") "/lib/ld.so.1")
- ((string=? system "i686-gnu") "/lib/ld.so.1")
- ((string=? system "aarch64-linux") "/lib/ld-linux-aarch64.so.1")
- ((string=? system "powerpc-linux") "/lib/ld.so.1")
- ((string=? system "powerpc64-linux") "/lib/ld64.so.1")
- ((string=? system "powerpc64le-linux") "/lib/ld64.so.2")
- ((string=? system "alpha-linux") "/lib/ld-linux.so.2")
- ((string=? system "s390x-linux") "/lib/ld64.so.1")
- ((string=? system "riscv64-linux") "/lib/ld-linux-riscv64-lp64d.so.1")
+ (let ((platform (lookup-platform-by-system system)))
+ (cond
+ ((platform? platform)
+ (platform-glibc-dynamic-linker platform))
- ;; XXX: This one is used bare-bones, without a libc, so add a case
- ;; here just so we can keep going.
- ((string=? system "arm-elf") "no-ld.so")
- ((string=? system "arm-eabi") "no-ld.so")
- ((string=? system "xtensa-elf") "no-ld.so")
- ((string=? system "avr") "no-ld.so")
- ((string=? system "propeller-elf") "no-ld.so")
- ((string=? system "i686-mingw") "no-ld.so")
- ((string=? system "x86_64-mingw") "no-ld.so")
- ((string=? system "vc4-elf") "no-ld.so")
+ ;; TODO: Define those as platforms.
+ ((string=? system "i686-gnu") "/lib/ld.so.1")
+ ((string=? system "powerpc64-linux") "/lib/ld64.so.1")
+ ((string=? system "alpha-linux") "/lib/ld-linux.so.2")
- (else (error "dynamic linker name not known for this system"
- system))))
+ ;; XXX: This one is used bare-bones, without a libc, so add a case
+ ;; here just so we can keep going.
+ ((string=? system "arm-elf") "no-ld.so")
+ ((string=? system "arm-eabi") "no-ld.so")
+ ((string=? system "xtensa-elf") "no-ld.so")
+ ((string=? system "avr") "no-ld.so")
+ ((string=? system "propeller-elf") "no-ld.so")
+ ((string=? system "i686-mingw") "no-ld.so")
+ ((string=? system "x86_64-mingw") "no-ld.so")
+ ((string=? system "vc4-elf") "no-ld.so")
+
+ (else (error "dynamic linker name not known for this system"
+ system)))))
;;;
diff --git a/gnu/platform.scm b/gnu/platform.scm
index 4c5211e107..fdc3685e7c 100644
--- a/gnu/platform.scm
+++ b/gnu/platform.scm
@@ -27,6 +27,7 @@ (define-module (gnu platform)
platform-target
platform-system
platform-linux-architecture
+ platform-glibc-dynamic-linker
platform-modules
platforms
@@ -58,12 +59,17 @@ (define-module (gnu platform)
;;
;; The 'linux-architecture' is only relevant if the kernel is Linux. In that
;; case, it corresponds to the ARCH variable used when building Linux.
+;;
+;; The 'glibc-dynamic-linker' field is the name of Glibc's dynamic linker for
+;; the corresponding system.
(define-record-type* <platform> platform make-platform
platform?
- (target platform-target) ;"x86_64-linux-gnu"
- (system platform-system) ;"x86_64-linux"
- (linux-architecture platform-linux-architecture ;"x86"
- (default #f)))
+ (target platform-target)
+ (system platform-system)
+ (linux-architecture platform-linux-architecture
+ (default #f))
+ (glibc-dynamic-linker platform-glibc-dynamic-linker))
+
;;;
;;; Platforms.
diff --git a/gnu/platforms/arm.scm b/gnu/platforms/arm.scm
index 1e61741a35..bf68b2d00f 100644
--- a/gnu/platforms/arm.scm
+++ b/gnu/platforms/arm.scm
@@ -27,10 +27,12 @@ (define armv7-linux
(platform
(target "arm-linux-gnueabihf")
(system "armhf-linux")
- (linux-architecture "arm")))
+ (linux-architecture "arm")
+ (glibc-dynamic-linker "/lib/ld-linux-armhf.so.3")))
(define aarch64-linux
(platform
(target "aarch64-linux-gnu")
(system "aarch64-linux")
- (linux-architecture "arm64")))
+ (linux-architecture "arm64")
+ (glibc-dynamic-linker "/lib/ld-linux-aarch64.so.1")))
diff --git a/gnu/platforms/hurd.scm b/gnu/platforms/hurd.scm
index 0e5c58fd08..328e9818ad 100644
--- a/gnu/platforms/hurd.scm
+++ b/gnu/platforms/hurd.scm
@@ -25,4 +25,5 @@ (define-module (gnu platforms hurd)
(define hurd
(platform
(target "i586-pc-gnu")
- (system "i586-gnu")))
+ (system "i586-gnu")
+ (glibc-dynamic-linker "/lib/ld.so.1")))
diff --git a/gnu/platforms/intel.scm b/gnu/platforms/intel.scm
index ee9fe003a7..5b58d953ae 100644
--- a/gnu/platforms/intel.scm
+++ b/gnu/platforms/intel.scm
@@ -29,20 +29,24 @@ (define intel32-linux
(platform
(target "i686-linux-gnu")
(system "i686-linux")
- (linux-architecture "i386")))
+ (linux-architecture "i386")
+ (glibc-dynamic-linker "/lib/ld-linux.so.2")))
(define intel64-linux
(platform
(target "x86_64-linux-gnu")
(system "x86_64-linux")
- (linux-architecture "x86_64")))
+ (linux-architecture "x86_64")
+ (glibc-dynamic-linker "/lib/ld-linux-x86-64.so.2")))
(define intel32-mingw
(platform
(target "i686-w64-mingw32")
- (system #f)))
+ (system #f)
+ (glibc-dynamic-linker #f)))
(define intel64-mingw
(platform
(target "x86_64-w64-mingw32")
- (system #f)))
+ (system #f)
+ (glibc-dynamic-linker #f)))
diff --git a/gnu/platforms/mips.scm b/gnu/platforms/mips.scm
index 84a492699d..174657da13 100644
--- a/gnu/platforms/mips.scm
+++ b/gnu/platforms/mips.scm
@@ -26,4 +26,5 @@ (define mips64-linux
(platform
(target "mips64el-linux-gnu")
(system "mips64el-linux")
- (linux-architecture "mips")))
+ (linux-architecture "mips")
+ (glibc-dynamic-linker "/lib/ld.so.1")))
diff --git a/gnu/platforms/powerpc.scm b/gnu/platforms/powerpc.scm
index 8fadfe88de..1d0b5cb666 100644
--- a/gnu/platforms/powerpc.scm
+++ b/gnu/platforms/powerpc.scm
@@ -27,10 +27,12 @@ (define powerpc-linux
(platform
(target "powerpc-linux-gnu")
(system "powerpc-linux")
- (linux-architecture "powerpc")))
+ (linux-architecture "powerpc")
+ (glibc-dynamic-linker "/lib/ld.so.1")))
(define powerpc64le-linux
(platform
(target "powerpc64le-linux-gnu")
(system "powerpc64le-linux")
- (linux-architecture "powerpc")))
+ (linux-architecture "powerpc")
+ (glibc-dynamic-linker "/lib/ld64.so.2")))
diff --git a/gnu/platforms/riscv.scm b/gnu/platforms/riscv.scm
index 29a34402a2..c2b4850e55 100644
--- a/gnu/platforms/riscv.scm
+++ b/gnu/platforms/riscv.scm
@@ -26,4 +26,5 @@ (define riscv64-linux
(platform
(target "riscv64-linux-gnu")
(system "riscv64-linux")
- (linux-architecture "riscv")))
+ (linux-architecture "riscv")
+ (glibc-dynamic-linker "/lib/ld-linux-riscv64-lp64d.so.1")))
diff --git a/gnu/platforms/s390.scm b/gnu/platforms/s390.scm
index c8caafbe45..d3b1133974 100644
--- a/gnu/platforms/s390.scm
+++ b/gnu/platforms/s390.scm
@@ -26,4 +26,5 @@ (define s390x-linux
(platform
(target "s390x-linux-gnu")
(system "s390x-linux")
- (linux-architecture "s390")))
+ (linux-architecture "s390")
+ (glibc-dynamic-linker "/lib/ld64.so.1")))
--
2.36.0
M
M
Mathieu Othacehe wrote on 7 May 2022 18:11
[PATCH v2 6/6] linux: Remove system->linux-architecture procedure.
(address . 55220@debbugs.gnu.org)(name . Mathieu Othacehe)(address . othacehe@gnu.org)
20220507161126.14553-7-othacehe@gnu.org
* gnu/packages/linux.scm (system->linux-architecture): Remove it.
(make-linux-libre-headers*, make-linux-libre*): Adapt them.
* guix/build-system/linux-module.scm (system->arch): Adapt it.
* gnu/packages/instrumentation.scm (uftrace): Ditto.
* gnu/packages/cross-base.scm (cross-kernel-headers): Ditto.
* gnu/packages/bioinformatics.scm (ncbi-vdb): Ditto.
* doc/guix.texi (Porting to a new platform): Update it.
---
doc/guix.texi | 30 ++++++++++++++------------
gnu/packages/bioinformatics.scm | 11 ++++++----
gnu/packages/cross-base.scm | 4 +++-
gnu/packages/instrumentation.scm | 8 ++++---
gnu/packages/linux.scm | 34 +++++++++++-------------------
guix/build-system/linux-module.scm | 4 ++--
6 files changed, 45 insertions(+), 46 deletions(-)

Toggle diff (208 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index 6757c105dc..1dc1474ec7 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -39896,20 +39896,22 @@ one:
guix build --target=armv5tel-linux-gnueabi bootstrap-tarballs
@end example
-For this to work, the @code{glibc-dynamic-linker} procedure in
-@code{(gnu packages bootstrap)} must be augmented to return the right
-file name for libc's dynamic linker on that platform; likewise,
-@code{system->linux-architecture} in @code{(gnu packages linux)} must be
-taught about the new platform.
-
-Once these are built, the @code{(gnu packages bootstrap)} module needs
-to be updated to refer to these binaries on the target platform. That
-is, the hashes and URLs of the bootstrap tarballs for the new platform
-must be added alongside those of the currently supported platforms. The
-bootstrap Guile tarball is treated specially: it is expected to be
-available locally, and @file{gnu/local.mk} has rules to download it for
-the supported architectures; a rule for the new platform must be added
-as well.
+For this to work, it is first required to register a new platform as
+defined in the @code{(gnu platform)} module. A platform is making the
+connection between a GNU triplet (@pxref{Specifying Target Triplets, GNU
+configuration triplets,, autoconf, Autoconf}), the equivalent
+@var{system} in Nix notation, the name of the
+@var{glibc-dynamic-linker}, and the corresponding Linux architecture
+name if applicable.
+
+Once the bootstrap tarball are built, the @code{(gnu packages
+bootstrap)} module needs to be updated to refer to these binaries on the
+target platform. That is, the hashes and URLs of the bootstrap tarballs
+for the new platform must be added alongside those of the currently
+supported platforms. The bootstrap Guile tarball is treated specially:
+it is expected to be available locally, and @file{gnu/local.mk} has
+rules to download it for the supported architectures; a rule for the new
+platform must be added as well.
In practice, there may be some complications. First, it may be that the
extended GNU triplet that specifies an ABI (like the @code{eabi} suffix
diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm
index ae35087964..d23f5fa9e0 100644
--- a/gnu/packages/bioinformatics.scm
+++ b/gnu/packages/bioinformatics.scm
@@ -161,6 +161,7 @@ (define-module (gnu packages bioinformatics)
#:use-module (gnu packages wget)
#:use-module (gnu packages xml)
#:use-module (gnu packages xorg)
+ #:use-module (gnu platform)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
#:use-module (ice-9 match))
@@ -6576,10 +6577,12 @@ (define-public ncbi-vdb
;; architecture name ("i386") instead of the target system prefix
;; ("i686").
(mkdir (string-append (assoc-ref outputs "out") "/ilib"))
- (copy-recursively (string-append "build/ncbi-vdb/linux/gcc/"
- ,(system->linux-architecture
- (or (%current-target-system)
- (%current-system)))
+ (copy-recursively (string-append
+ "build/ncbi-vdb/linux/gcc/"
+ ,(platform-linux-architecture
+ (lookup-platform-by-target-or-system
+ (or (%current-target-system)
+ (%current-system))))
"/rel/ilib")
(string-append (assoc-ref outputs "out")
"/ilib"))
diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index 66412b9e92..427fefbcd2 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -30,6 +30,7 @@ (define-module (gnu packages cross-base)
#:use-module (gnu packages linux)
#:use-module (gnu packages hurd)
#:use-module (gnu packages mingw)
+ #:use-module (gnu platform)
#:use-module (guix packages)
#:use-module (guix download)
#:use-module (guix utils)
@@ -345,7 +346,8 @@ (define xlinux-headers
`(modify-phases ,phases
(replace 'build
(lambda _
- (setenv "ARCH" ,(system->linux-architecture target))
+ (setenv "ARCH" ,(platform-linux-architecture
+ (lookup-platform-by-target target)))
(format #t "`ARCH' set to `~a' (cross compiling)~%"
(getenv "ARCH"))
diff --git a/gnu/packages/instrumentation.scm b/gnu/packages/instrumentation.scm
index ab986bfcc7..1271619ad6 100644
--- a/gnu/packages/instrumentation.scm
+++ b/gnu/packages/instrumentation.scm
@@ -42,6 +42,7 @@ (define-module (gnu packages instrumentation)
#:use-module (gnu packages swig)
#:use-module (gnu packages tbb)
#:use-module (gnu packages xml)
+ #:use-module (gnu platform)
#:use-module (guix build-system cmake)
#:use-module (guix build-system copy)
#:use-module (guix build-system gnu)
@@ -312,9 +313,10 @@ (define-public uftrace
(modify-phases %standard-phases
(replace 'configure
(lambda* (#:key outputs target #:allow-other-keys)
- (let ((arch ,(system->linux-architecture
- (or (%current-target-system)
- (%current-system)))))
+ (let ((arch ,(platform-linux-architecture
+ (lookup-platform-by-target-or-system
+ (or (%current-target-system)
+ (%current-system))))))
(setenv "ARCH"
(cond
((string=? arch "arm64") "aarch64")
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 828bd4e208..c5d30f937b 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -158,6 +158,7 @@ (define-module (gnu packages linux)
#:use-module (gnu packages groff)
#:use-module (gnu packages selinux)
#:use-module (gnu packages swig)
+ #:use-module (gnu platform)
#:use-module (guix build-system cmake)
#:use-module (guix build-system copy)
#:use-module (guix build-system gnu)
@@ -181,20 +182,6 @@ (define-module (gnu packages linux)
#:use-module (ice-9 match)
#:use-module (ice-9 regex))
-(define-public (system->linux-architecture arch)
- "Return the Linux architecture name for ARCH, a Guix system name such as
-\"x86_64-linux\" or a target triplet such as \"arm-linux-gnueabihf\"."
- (let ((arch (car (string-split arch #\-))))
- (cond ((string=? arch "i686") "i386")
- ((string-prefix? "mips" arch) "mips")
- ((string-prefix? "arm" arch) "arm")
- ((string-prefix? "aarch64" arch) "arm64")
- ((string-prefix? "alpha" arch) "alpha")
- ((string-prefix? "powerpc" arch) "powerpc") ;including "powerpc64le"
- ((string-prefix? "s390" arch) "s390")
- ((string-prefix? "riscv" arch) "riscv")
- (else arch))))
-
(define-public (system->defconfig system)
"Some systems (notably powerpc-linux) require a special target for kernel
defconfig. Return the appropriate make target if applicable, otherwise return
@@ -567,9 +554,10 @@ (define (make-linux-libre-headers* version gnu-revision source)
(delete 'configure)
(replace 'build
(lambda _
- (let ((arch ,(system->linux-architecture
- (or (%current-target-system)
- (%current-system))))
+ (let ((arch ,(platform-linux-architecture
+ (lookup-platform-by-target-or-system
+ (or (%current-target-system)
+ (%current-system)))))
(defconfig ,(system->defconfig
(or (%current-target-system)
(%current-system))))
@@ -807,8 +795,9 @@ (define* (make-linux-libre* version gnu-revision source supported-systems
,@(match (and configuration-file
(configuration-file
- (system->linux-architecture
- (or (%current-target-system) (%current-system)))
+ (platform-linux-architecture
+ (lookup-platform-by-target-or-system
+ (or (%current-target-system) (%current-system))))
#:variant (version-major+minor version)))
(#f ;no config for this platform
'())
@@ -839,9 +828,10 @@ (define* (make-linux-libre* version gnu-revision source supported-systems
(setenv "KBUILD_BUILD_HOST" "guix")
;; Set ARCH and CROSS_COMPILE.
- (let ((arch #$(system->linux-architecture
- (or (%current-target-system)
- (%current-system)))))
+ (let ((arch #$(platform-linux-architecture
+ (lookup-platform-by-target-or-system
+ (or (%current-target-system)
+ (%current-system))))))
(setenv "ARCH" arch)
(format #t "`ARCH' set to `~a'~%" (getenv "ARCH"))
diff --git a/guix/build-system/linux-module.scm b/guix/build-system/linux-module.scm
index e82a9ca65c..761ebe25b1 100644
--- a/guix/build-system/linux-module.scm
+++ b/guix/build-system/linux-module.scm
@@ -50,8 +50,8 @@ (define (default-linux)
(module-ref module 'linux-libre)))
(define (system->arch system)
- (let ((module (resolve-interface '(gnu packages linux))))
- ((module-ref module 'system->linux-architecture) system)))
+ (let ((module (resolve-interface '(gnu platform))))
+ ((module-ref module 'lookup-platform-by-target-or-system) system)))
(define (make-linux-module-builder linux)
(package
--
2.36.0
M
M
Maxime Devos wrote on 9 May 2022 22:44
Re: [bug#55220] [PATCH v2 1/6] platform: Introduce new platforms.
7ef3abee543a92aa183df469b243fa0307729175.camel@telenet.be
Mathieu Othacehe schreef op za 07-05-2022 om 18:11 [+0200]:
Toggle quote (9 lines)
>   \
>    %D%/platforms/arm.scm                 \
>    %D%/platforms/hurd.scm                 \
> +  %D%/platforms/intel.scm                 \
> +  %D%/platforms/mips.scm                 \
> +  %D%/platforms/powerpc.scm                 \
> +  %D%/platforms/riscv.scm                 \
> +  %D%/platforms/s390.scm                 \

I'm wondering, these files are all rather tiny, why not define all the
standard platforms directly in gnu/platforms.scm?

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYnl9GBccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7khvAP9V0o4LQsBOPMgVV3dEXjtzwWzb
Jr0kfmhveYuJiRm7AgEAwMQaSgpKHixS5l2cJHgMR1uSbmsNm7Sk84Nj1Qn0HQ8=
=QElT
-----END PGP SIGNATURE-----


M
M
Maxime Devos wrote on 9 May 2022 22:50
ecc5a6118ca46a1a372a4c09ff1316bac285eab8.camel@telenet.be
Mathieu Othacehe schreef op za 07-05-2022 om 18:11 [+0200]:
Toggle quote (6 lines)
> +(define intel64-linux
> +  (platform
> +   (target "x86_64-linux-gnu")
> +   (system "x86_64-linux")
> +   (linux-architecture "x86_64")))

Nitpick: the original spec was written by AMD and also implemented by
VIA according to Wikipedia. It's not tied to only Intel. More neutral
would be x86-64-linux. Also, this could be confused with the ia64
architecture (albeit not currently supported by Guix).

Also, we have two sets of platform modules: the ‘architecture’ modules,
and the ‘kernel’ module arm.scm. Maybe that can be simplified now by
moving the Hurd platforms (currently only i586-pc-gnu) to intel.scm (or
maybe: x86.scm, or just platforms.scm, see other reply)?

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYnl+oxccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7nOMAQCJZfQeDDbKrpVmacZfoxx2L3DN
1ZDuBcR2bqZRIHULpgD/bdF1nw3pPpH9AJh/2sQMeK0UITwZ6gu8OuRaDr98gAI=
=KP8U
-----END PGP SIGNATURE-----


M
M
Maxime Devos wrote on 9 May 2022 22:58
Re: [bug#55220] [PATCH v2 2/6] platform: Add discovery support.
830f00ba147aa40618e00e641d2afc61559f419f.camel@telenet.be
Mathieu Othacehe schreef op za 07-05-2022 om 18:11 [+0200]:
Toggle quote (8 lines)
> * gnu/platform.scm (platform-modules, systems, targets,
> lookup-platform-by-system, lookup-platform-by-target,
> lookup-platform-by-target-or-system
> platform-system->target,
> platform-target->system): New procedures.
> (%platforms): New variable.
> [...]

Food for later: I'm wondering if it would make sense to (long term)
let %current-system/%current-target-system be a <platform> record
and eliminate nix-system->gnu-triplet, gnu-triplet->nix-system in
favour of platform-target & platform-system. That could avoid the
problem of forgetting that targets and nix systems have different
formats, making a class of cross-compilation bugs less likely ...

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYnmAWxccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7hJ4AP96IzgiIPuDq9G8GHIjmpRjFCB0
Cbe1ZoqCT6+HTb4VuwEAjPQcN+l7xjiOA8iDXH8+Nyu/0ovCpZ6TtkAM7ep09QY=
=kGW5
-----END PGP SIGNATURE-----


M
M
Maxim Cournoyer wrote on 22 May 2022 03:25
Re: bug#55220: [PATCH 0/4] Add --list-systems and --list-targets options.
(name . Mathieu Othacehe)(address . othacehe@gnu.org)(address . 55220@debbugs.gnu.org)
87ilpy9x4q.fsf_-_@gmail.com
Hi Mathieu!

Mathieu Othacehe <othacehe@gnu.org> writes:

Toggle quote (6 lines)
> Also factorize the --system and --target build options. Check that the passed
> system and target arguments are known platforms.
>
> * doc/guix.texi (Additional Build Options): Document the new --list-systems
> and --list-targets options.

This is a very welcome change, thanks a lot for tackling it!

[...]

Toggle quote (10 lines)
> diff --git a/doc/guix.texi b/doc/guix.texi
> index 5399584cb0..22a8ee7d2d 100644
> --- a/doc/guix.texi
> +++ b/doc/guix.texi
> @@ -12025,6 +12025,14 @@ Cross-build for @var{triplet}, which must be a valid GNU triplet, such
> as @code{"aarch64-linux-gnu"} (@pxref{Specifying Target Triplets, GNU
> configuration triplets,, autoconf, Autoconf}).
>
> +@item --list-systems
> +List all the supported systems, than can be passed as @var{system}
^ that
Toggle quote (6 lines)
> +argument.
> +
> +@item --list-targets
> +List all the supported targets, than can be passed as @var{target}
> +argument.

Likewise.

Toggle quote (24 lines)
> @anchor{build-check}
> @item --check
> @cindex determinism, checking
> diff --git a/guix/scripts/archive.scm b/guix/scripts/archive.scm
> index f8678aa5f9..991919773a 100644
> --- a/guix/scripts/archive.scm
> +++ b/guix/scripts/archive.scm
> @@ -93,14 +93,14 @@ (define (show-help)
> (display (G_ "
> -S, --source build the packages' source derivations"))
> (display (G_ "
> - -s, --system=SYSTEM attempt to build for SYSTEM--e.g., \"i686-linux\""))
> - (display (G_ "
> - --target=TRIPLET cross-build for TRIPLET--e.g., \"armel-linux-gnu\""))
> - (display (G_ "
> -v, --verbosity=LEVEL use the given verbosity LEVEL"))
>
> (newline)
> (show-build-options-help)
> + (newline)
> + (show-cross-build-options-help)
> + (newline)
> + (show-emulated-build-options-help)

I have a bit of a problem with the "emulated" part of the name, as
--system not only targets emulated machines but also different native
machines of that architecture via offloading :-). Perhaps,
'show-foreign-build-options-help', but I'm not sure that's an
improvement.

I've lost a bit focus for the remaining of the patch, but it LGTM.

Thanks again for tackling this so swiftly after it was brought up on an
issue.

Maxim
M
M
Maxim Cournoyer wrote on 22 May 2022 03:30
(name . Ludovic Courtès)(address . ludo@gnu.org)
87ee0m9wvm.fsf_-_@gmail.com
Hi,

Ludovic Courtès <ludo@gnu.org> writes:

[...]

Toggle quote (29 lines)
>> +(define %standard-cross-build-options
>> + ;; Build options related to cross builds.
>> + (list
>> + (option '("list-targets") #f #f
>> + (lambda (opt name arg result)
>> + (list-targets)
>> + (exit 0)))
>> + (option '("target") #t #f
>> + (lambda (opt name arg result . rest)
>> + (let ((t (false-if-exception
>> + (first (member arg (targets))))))
>> + (if t
>> + (apply values (alist-cons 'target t result) rest)
>> + (leave (G_ "'~a' is not a supported target.~%")
>> + arg)))))))
>
> This is my main issue: should we still accept any triplet, and simply
> print a nicer error than currently when the glibc dynamic linker name is
> unknown?
>
> Or should be be just as strict as above, at the risk of frustrating
> developers porting stuff to new or unusual platforms?
>
> Or should there be an option to bypass this check?
>
> Maybe I’m overrating the usefulness of allowing users to pass in
> arbitrary triplets, though the manual does suggest that when porting to
> a new platform (info "(guix) Porting"). Thoughts?

I think [w.r.t. overrating usefulness] so :-). Surely, a developer
savvy enough to embark on a porting journey won't be put off by the
having to add their new arch/platform to the list of known ones, me
thinks. And it makes "normal" use for everyone else friendlier and it
validates the input/fail on problems early which is nicer.

Thanks,

Maxim
M
M
Maxim Cournoyer wrote on 22 May 2022 03:34
(name . Maxime Devos)(address . maximedevos@telenet.be)
87a6ba9wp5.fsf_-_@gmail.com
Hi,

Maxime Devos <maximedevos@telenet.be> writes:

Toggle quote (16 lines)
> Mathieu Othacehe schreef op za 07-05-2022 om 18:11 [+0200]:
>> * gnu/platform.scm (platform-modules, systems, targets,
>> lookup-platform-by-system, lookup-platform-by-target,
>> lookup-platform-by-target-or-system
>> platform-system->target,
>> platform-target->system): New procedures.
>> (%platforms): New variable.
>> [...]
>
> Food for later: I'm wondering if it would make sense to (long term)
> let %current-system/%current-target-system be a <platform> record
> and eliminate nix-system->gnu-triplet, gnu-triplet->nix-system in
> favour of platform-target & platform-system. That could avoid the
> problem of forgetting that targets and nix systems have different
> formats, making a class of cross-compilation bugs less likely ...

That sounds like a good idea to me. I was bit by that in the past,
probably not for the last time.

Maxim
M
M
Maxim Cournoyer wrote on 22 May 2022 03:39
(name . Maxime Devos)(address . maximedevos@telenet.be)
875yly9whw.fsf_-_@gmail.com
Hi,
Maxime Devos <maximedevos@telenet.be> writes:
Toggle quote (12 lines)
> Mathieu Othacehe schreef op za 07-05-2022 om 18:11 [+0200]:
>>   \
>>    %D%/platforms/arm.scm                 \
>>    %D%/platforms/hurd.scm                 \
>> +  %D%/platforms/intel.scm                 \
>> +  %D%/platforms/mips.scm                 \
>> +  %D%/platforms/powerpc.scm                 \
>> +  %D%/platforms/riscv.scm                 \
>> +  %D%/platforms/s390.scm                 \
>
> I'm wondering, these files are all rather tiny, why not define all the
> standard platforms directly in gnu/platforms.scm?
I also pondered about this; no big deal, but is there a reason for this
"extendable/dynamic" scheme where someone could drop new platform
modules and have them recognized? I suppose having things a bit less
dynamic could make navigating the code easier with Geiser (and humans).
What do you think?
Maxim
M
M
Mathieu Othacehe wrote on 22 May 2022 15:01
Re: [bug#55220] [PATCH v2 1/6] platform: Introduce new platforms.
(name . Maxime Devos)(address . maximedevos@telenet.be)(address . 55220@debbugs.gnu.org)
87k0aden5w.fsf@gnu.org
Hello Maxime,

Toggle quote (3 lines)
> I'm wondering, these files are all rather tiny, why not define all the
> standard platforms directly in gnu/platforms.scm?

The rationale is that users should be able to extend the system by
defining new platforms in their custom channels. It is also in line with
what's proposed by the (gnu bootloader) and (gnu system images) modules.

Now I agree that it makes a lot of tiny files that won't probably grow
much. Maybe we could keep the extensibility thing with a unique
platforms.scm file defining all the supported platforms.

I propose to move forward but to keep that in mind.

Thanks,

Mathieu
M
M
Mathieu Othacehe wrote on 22 May 2022 15:02
(name . Maxime Devos)(address . maximedevos@telenet.be)(address . 55220@debbugs.gnu.org)
87fsl1en4g.fsf@gnu.org
Hey,

Toggle quote (10 lines)
> Nitpick: the original spec was written by AMD and also implemented by
> VIA according to Wikipedia. It's not tied to only Intel. More neutral
> would be x86-64-linux. Also, this could be confused with the ia64
> architecture (albeit not currently supported by Guix).
>
> Also, we have two sets of platform modules: the ‘architecture’ modules,
> and the ‘kernel’ module arm.scm. Maybe that can be simplified now by
> moving the Hurd platforms (currently only i586-pc-gnu) to intel.scm (or
> maybe: x86.scm, or just platforms.scm, see other reply)?

You're right, I went for x86.scm and merged the hurd.scm module inside
it.

Thanks,

Mathieu
M
M
Mathieu Othacehe wrote on 22 May 2022 15:06
Re: [bug#55220] [PATCH v2 2/6] platform: Add discovery support.
(name . Maxime Devos)(address . maximedevos@telenet.be)(address . 55220@debbugs.gnu.org)
87bkvpemyr.fsf@gnu.org
Hey,

Toggle quote (7 lines)
> Food for later: I'm wondering if it would make sense to (long term)
> let %current-system/%current-target-system be a <platform> record
> and eliminate nix-system->gnu-triplet, gnu-triplet->nix-system in
> favour of platform-target & platform-system. That could avoid the
> problem of forgetting that targets and nix systems have different
> formats, making a class of cross-compilation bugs less likely ...

I think that's what we should aim for the future. Getting rid of
system/triplet strings and using platforms everywhere instead will be
less error prone, even if there is still some work to get there.

Mathieu
M
M
Mathieu Othacehe wrote on 22 May 2022 15:09
Re: bug#55220: [PATCH 0/4] Add --list-systems and --list-targets options.
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)(address . 55220@debbugs.gnu.org)
877d6demsx.fsf@gnu.org
Hey,

Thanks for having a look to the series :).

Toggle quote (6 lines)
> I have a bit of a problem with the "emulated" part of the name, as
> --system not only targets emulated machines but also different native
> machines of that architecture via offloading :-). Perhaps,
> 'show-foreign-build-options-help', but I'm not sure that's an
> improvement.

Ludo had the same concern. I changed the name to "native" that I also
find a bit misleading. The documentation is now making this
term less mysterious though.

Mathieu
M
M
Mathieu Othacehe wrote on 22 May 2022 15:12
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)
87zgj9d82z.fsf@gnu.org
Hey,

Toggle quote (7 lines)
> I also pondered about this; no big deal, but is there a reason for this
> "extendable/dynamic" scheme where someone could drop new platform
> modules and have them recognized? I suppose having things a bit less
> dynamic could make navigating the code easier with Geiser (and humans).
>
> What do you think?

I think that it's nice to keep this extendable mechanism so that users
can define their own bootloaders, images and now platforms in their
custom channels.

As I answered to Maxime, I'm not opposed to gather all those plaforms
definitions in a single file as a follow-up.

Mathieu
M
M
Maxim Cournoyer wrote on 22 May 2022 15:42
(name . Mathieu Othacehe)(address . othacehe@gnu.org)
87mtf965vw.fsf@gmail.com
Hi Mathieu,

Mathieu Othacehe <othacehe@gnu.org> writes:

Toggle quote (13 lines)
> Hey,
>
>> I also pondered about this; no big deal, but is there a reason for this
>> "extendable/dynamic" scheme where someone could drop new platform
>> modules and have them recognized? I suppose having things a bit less
>> dynamic could make navigating the code easier with Geiser (and humans).
>>
>> What do you think?
>
> I think that it's nice to keep this extendable mechanism so that users
> can define their own bootloaders, images and now platforms in their
> custom channels.

OK, thanks for having confirmed the rationale.

Toggle quote (3 lines)
> As I answered to Maxime, I'm not opposed to gather all those plaforms
> definitions in a single file as a follow-up.

I'm fine either way,

Thanks!

Maxim
M
M
Mathieu Othacehe wrote on 25 May 2022 10:18
control message for bug #55220
(address . control@debbugs.gnu.org)
878rqqvxcy.fsf@meije.i-did-not-set--mail-host-address--so-tickle-me
close 55220
quit
?