diff mbox series

[bug#55220,4/4] scripts: Add --list-systems and --list-targets options.

Message ID 20220502111859.13605-4-othacehe@gnu.org
State Accepted
Headers show
Series Add --list-systems and --list-targets options. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Mathieu Othacehe May 2, 2022, 11:18 a.m. UTC
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(-)

Comments

Ludovic Courtès May 6, 2022, 2:54 p.m. UTC | #1
Mathieu Othacehe <othacehe@gnu.org> skribis:

> 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>

[...]

> +@item --list-systems
> +List all the supported systems, than can be passed as @var{system}
> +argument.

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

> +@item --list-targets
> +List all the supported targets, than can be passed as @var{target}
> +argument.

Likewise.

> +(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?

> +(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’.
Mathieu Othacehe May 7, 2022, 4:04 p.m. UTC | #2
> “as an argument to @option{--system}” maybe?

Done.

> 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.

> 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.

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

Done,

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

and done.

Thanks,

Mathieu
Maxim Cournoyer May 22, 2022, 1:25 a.m. UTC | #3
Hi Mathieu!

Mathieu Othacehe <othacehe@gnu.org> writes:

> 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!

[...]

> 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
> +argument.
> +
> +@item --list-targets
> +List all the supported targets, than can be passed as @var{target}
> +argument.

Likewise.

>  @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
Maxim Cournoyer May 22, 2022, 1:30 a.m. UTC | #4
Hi,

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

[...]

>> +(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
Mathieu Othacehe May 22, 2022, 1:09 p.m. UTC | #5
Hey,

Thanks for having a look to the series :).

> 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
diff mbox series

Patch

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)
+  (show-emulated-build-options-help)
+  (newline)
   (show-bug-report-information))
 
 (define %options
-  (list  (option '(#\h "help") #f #f
+  (cons* (option '(#\h "help") #f #f
                  (lambda args
                    (show-help)
                    (exit 0)))
@@ -380,9 +381,7 @@  (define %options
          (option '("display-missing") #f #f
                  (lambda (opt name arg result)
                    (alist-cons 'display-missing? #t result)))
-         (option '(#\s "system") #t #f
-                 (lambda (opt name arg result)
-                   (alist-cons 'system arg result)))))
+         %standard-emulated-build-options))
 
 (define %default-options
   `((substitute-urls . ,%default-substitute-urls)))