Message ID | 20200901085056.33391-7-r.bolshakov@yadro.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Add support for generic ELF cross-compiler | expand |
On 01/09/2020 10.50, Roman Bolshakov wrote: > macOS is shipped with an old non-enhanced version of getopt and it > doesn't support options used by run_tests.sh. Proper version of getopt > is available from homebrew but it has to be added to PATH before invoking > run_tests.sh. It's not convenient because it has to be done in each > shell instance and there could be many if a multiplexor is used. > > The change provides a way to override getopt and halts ./configure if > enhanced getopt can't be found. > > Cc: Cameron Esfahani <dirty@apple.com> > Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com> > --- > configure | 13 +++++++++++++ > run_tests.sh | 2 +- > 2 files changed, 14 insertions(+), 1 deletion(-) Reviewed-by: Thomas Huth <thuth@redhat.com>
On 01/09/20 10:50, Roman Bolshakov wrote: > macOS is shipped with an old non-enhanced version of getopt and it > doesn't support options used by run_tests.sh. Proper version of getopt > is available from homebrew but it has to be added to PATH before invoking > run_tests.sh. It's not convenient because it has to be done in each > shell instance and there could be many if a multiplexor is used. > > The change provides a way to override getopt and halts ./configure if > enhanced getopt can't be found. > > Cc: Cameron Esfahani <dirty@apple.com> > Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com> I don't like the extra option very much, generally people are just expected to stick homebrew in their path somehow. Reporting a better error is a good idea though, what about this: diff --git a/configure b/configure index 4eb504f..3293634 100755 --- a/configure +++ b/configure @@ -167,6 +167,13 @@ EOF rm -f lib-test.{o,S} fi +# require enhanced getopt +getopt -T > /dev/null +if [ $? -ne 4 ]; then + echo "Enhanced getopt is not available, add it to your PATH?" + exit 1 +fi + # Are we in a separate build tree? If so, link the Makefile # and shared stuff so that 'make' and run_tests.sh work. if test ! -e Makefile; then diff --git a/run_tests.sh b/run_tests.sh index 01e36dc..70d012c 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -34,6 +34,13 @@ EOF RUNTIME_arch_run="./$TEST_DIR/run" source scripts/runtime.bash +# require enhanced getopt +getopt -T > /dev/null +if [ $? -ne 4 ]; then + echo "Enhanced getopt is not available, add it to your PATH?" + exit 1 +fi + only_tests="" args=`getopt -u -o ag:htj:v -l all,group:,help,tap13,parallel:,verbose -- $*` [ $? -ne 0 ] && exit 2; Paolo
On Tue, Sep 22, 2020 at 03:53:27PM +0200, Paolo Bonzini wrote: > On 01/09/20 10:50, Roman Bolshakov wrote: > > macOS is shipped with an old non-enhanced version of getopt and it > > doesn't support options used by run_tests.sh. Proper version of getopt > > is available from homebrew but it has to be added to PATH before invoking > > run_tests.sh. It's not convenient because it has to be done in each > > shell instance and there could be many if a multiplexor is used. > > > > The change provides a way to override getopt and halts ./configure if > > enhanced getopt can't be found. > > > > Cc: Cameron Esfahani <dirty@apple.com> > > Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com> > > I don't like the extra option very much, generally people are just expected > to stick homebrew in their path somehow. Reporting a better error is a > good idea though, what about this: > Homebrew doesn't shadow system tools unlike macports. That's why the patch is helpful and the error below can be corrected automatically without human intervention. The error in the proposed below patch would still cause frustrating: "ugh. I again forgot to set PATH for this tmux window..." May be I'm exaggarating the issue, but I don't set PATH on a per-project basis unless I'm doing something extremely rare or something weird :) The original patch also shouldn't have an impact on most modern Linux systems. It would help only a few who build kvm-unit-tests on mac. Hopefully, it eases contribution and testing of QEMU without an access to Linux box. Thanks, Roman > diff --git a/configure b/configure > index 4eb504f..3293634 100755 > --- a/configure > +++ b/configure > @@ -167,6 +167,13 @@ EOF > rm -f lib-test.{o,S} > fi > > +# require enhanced getopt > +getopt -T > /dev/null > +if [ $? -ne 4 ]; then > + echo "Enhanced getopt is not available, add it to your PATH?" > + exit 1 > +fi > + > # Are we in a separate build tree? If so, link the Makefile > # and shared stuff so that 'make' and run_tests.sh work. > if test ! -e Makefile; then > diff --git a/run_tests.sh b/run_tests.sh > index 01e36dc..70d012c 100755 > --- a/run_tests.sh > +++ b/run_tests.sh > @@ -34,6 +34,13 @@ EOF > RUNTIME_arch_run="./$TEST_DIR/run" > source scripts/runtime.bash > > +# require enhanced getopt > +getopt -T > /dev/null > +if [ $? -ne 4 ]; then > + echo "Enhanced getopt is not available, add it to your PATH?" > + exit 1 > +fi > + > only_tests="" > args=`getopt -u -o ag:htj:v -l all,group:,help,tap13,parallel:,verbose -- $*` > [ $? -ne 0 ] && exit 2; > > Paolo >
On 22/09/20 23:51, Roman Bolshakov wrote: > Homebrew doesn't shadow system tools unlike macports. That's why the > patch is helpful and the error below can be corrected automatically > without human intervention. The error in the proposed below patch would > still cause frustrating: > > "ugh. I again forgot to set PATH for this tmux window..." > > May be I'm exaggarating the issue, but I don't set PATH on a per-project > basis unless I'm doing something extremely rare or something weird :) When I was using a Mac (with Fink... it was a few years ago :)) I used to set PATH, COMPILER_PATH, MANPATH etc. in my .bashrc file. Isn't it the same? Paolo
On 23/09/2020 04.41, Paolo Bonzini wrote: > On 22/09/20 23:51, Roman Bolshakov wrote: >> Homebrew doesn't shadow system tools unlike macports. That's why the >> patch is helpful and the error below can be corrected automatically >> without human intervention. The error in the proposed below patch would >> still cause frustrating: >> >> "ugh. I again forgot to set PATH for this tmux window..." >> >> May be I'm exaggarating the issue, but I don't set PATH on a per-project >> basis unless I'm doing something extremely rare or something weird :) > > When I was using a Mac (with Fink... it was a few years ago :)) I used > to set PATH, COMPILER_PATH, MANPATH etc. in my .bashrc file. Isn't it > the same? You should at least have tweaked the .travis.yml file, too. It still uses the now non-existing --getopt parameter, so the travis builds are failing now. Thomas
diff --git a/configure b/configure index 4eb504f..b85420b 100755 --- a/configure +++ b/configure @@ -8,6 +8,7 @@ objcopy=objcopy objdump=objdump ar=ar addr2line=addr2line +getopt=getopt arch=`uname -m | sed -e 's/i.86/i386/;s/arm.*/arm/;s/ppc64.*/ppc64/'` host=$arch cross_prefix= @@ -32,6 +33,7 @@ usage() { --cross-prefix=PREFIX cross compiler prefix --cc=CC c compiler to use ($cc) --ld=LD ld linker to use ($ld) + --getopt=GETOPT enhanced getopt to use ($getopt) --prefix=PREFIX where to install things ($prefix) --endian=ENDIAN endianness to compile for (little or big, ppc64 only) --[enable|disable]-pretty-print-stacks @@ -77,6 +79,9 @@ while [[ "$1" = -* ]]; do --ld) ld="$arg" ;; + --getopt) + getopt="$arg" + ;; --enable-pretty-print-stacks) pretty_print_stacks=yes ;; @@ -167,6 +172,13 @@ EOF rm -f lib-test.{o,S} fi +# require enhanced getopt +$getopt -T > /dev/null +if [ $? -ne 4 ]; then + echo "Enchanced getopt is not available" + exit 1 +fi + # Are we in a separate build tree? If so, link the Makefile # and shared stuff so that 'make' and run_tests.sh work. if test ! -e Makefile; then @@ -209,6 +221,7 @@ OBJCOPY=$cross_prefix$objcopy OBJDUMP=$cross_prefix$objdump AR=$cross_prefix$ar ADDR2LINE=$cross_prefix$addr2line +GETOPT=$getopt TEST_DIR=$testdir FIRMWARE=$firmware ENDIAN=$endian diff --git a/run_tests.sh b/run_tests.sh index 01e36dc..c4f436b 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -35,7 +35,7 @@ RUNTIME_arch_run="./$TEST_DIR/run" source scripts/runtime.bash only_tests="" -args=`getopt -u -o ag:htj:v -l all,group:,help,tap13,parallel:,verbose -- $*` +args=`$GETOPT -u -o ag:htj:v -l all,group:,help,tap13,parallel:,verbose -- $*` [ $? -ne 0 ] && exit 2; set -- $args; while [ $# -gt 0 ]; do
macOS is shipped with an old non-enhanced version of getopt and it doesn't support options used by run_tests.sh. Proper version of getopt is available from homebrew but it has to be added to PATH before invoking run_tests.sh. It's not convenient because it has to be done in each shell instance and there could be many if a multiplexor is used. The change provides a way to override getopt and halts ./configure if enhanced getopt can't be found. Cc: Cameron Esfahani <dirty@apple.com> Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com> --- configure | 13 +++++++++++++ run_tests.sh | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-)