From 6485142577dc1e5a9c049461be6302e1c8e1bb2c Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 10 May 2020 22:53:17 +0100 Subject: [PATCH] nailing-cargo: -T / --target= support Signed-off-by: Ian Jackson --- nailing-cargo | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/nailing-cargo b/nailing-cargo index e17a15b..fc70286 100755 --- a/nailing-cargo +++ b/nailing-cargo @@ -45,6 +45,10 @@ use strict; use POSIX; use Types::Serialiser; +our %archmap = ( +# RPI => 'arm-unknown-linux-gnueabihf', xxx +); + BEGIN { $self = $0; $self =~ s{^.*/(?=.)}{}; my $deref = $0; @@ -82,6 +86,7 @@ our $cargo_manifest_args; our @configs; our $verbose=1; our ($noact,$dump); +our $target; sub read_or_enoent ($) { my ($fn) = @_; @@ -332,6 +337,14 @@ sub addargs () { qw(--locked --target-dir=target); } + if (defined $target) { + if ($target =~ m{^[A-Z]}) { + $target = (cfg 'arch', $target) // $archmap{$target} + // die "$self: --target=$target alias specified; not in cfg or map\n"; + } + push @ARGV, "--target=$target"; + } +} our $oot_absdir; our $build_absdir; # .../Build/ @@ -524,6 +537,8 @@ while (@ARGV && $ARGV[0] =~ m/^-/) { $noact++; } elsif (s{^-D}{-}) { $dump++; + } elsif (s{^-T(.+)}{-}s) { + $target = $1; } elsif (s{^-([uU])}{-}) { $cargo_lock_update= $1=~m/[A-Z]/; } elsif (s{^-([mM])}{-}) { @@ -532,6 +547,8 @@ while (@ARGV && $ARGV[0] =~ m/^-/) { die "$self: unknown short option(s) $_\n"; } } + } elsif (s{^--target=}{}) { + $target = $_; } elsif (m{^--no-cargo-lock-update}) { $cargo_lock_update=0; } else { -- 2.30.2