diff mbox series

[v2,2/9] configure: cross-compiling without cross_prefix

Message ID 20201019013928.72770-3-j@getutm.app
State Superseded
Headers show
Series iOS and Apple Silicon host support | expand

Commit Message

Joelle van Dyne Oct. 19, 2020, 1:39 a.m. UTC
From: osy <osy86@users.noreply.github.com>

The iOS toolchain does not use the host prefix naming convention. We add a
new option `--enable-cross-compile` that forces cross-compile even without
a cross_prefix.

Signed-off-by: Joelle van Dyne <j@getutm.app>
---
 configure | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

Comments

Thomas Huth Oct. 19, 2020, 8:07 a.m. UTC | #1
On 19/10/2020 03.39, Joelle van Dyne wrote:
> From: osy <osy86@users.noreply.github.com>

> 

> The iOS toolchain does not use the host prefix naming convention. We add a

> new option `--enable-cross-compile` that forces cross-compile even without

> a cross_prefix.

> 

> Signed-off-by: Joelle van Dyne <j@getutm.app>

> ---

>  configure | 13 ++++++++++++-

>  1 file changed, 12 insertions(+), 1 deletion(-)

> 

> diff --git a/configure b/configure

> index 3c63879750..46d5db63e8 100755

> --- a/configure

> +++ b/configure

> @@ -234,6 +234,7 @@ cpu=""

>  iasl="iasl"

>  interp_prefix="/usr/gnemul/qemu-%M"

>  static="no"

> +cross_compile="no"

>  cross_prefix=""

>  audio_drv_list=""

>  block_drv_rw_whitelist=""

> @@ -456,6 +457,11 @@ for opt do

>    optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')

>    case "$opt" in

>    --cross-prefix=*) cross_prefix="$optarg"

> +                    cross_compile="yes"

> +  ;;

> +  --enable-cross-compile) cross_compile="yes"

> +  ;;

> +  --disable-cross-compile) cross_compile="no"


Can't you simply use --cros-prefix="" instead?

 Thomas
Thomas Huth Oct. 19, 2020, 8:09 a.m. UTC | #2
On 19/10/2020 10.07, Thomas Huth wrote:
> On 19/10/2020 03.39, Joelle van Dyne wrote:

>> From: osy <osy86@users.noreply.github.com>

>>

>> The iOS toolchain does not use the host prefix naming convention. We add a

>> new option `--enable-cross-compile` that forces cross-compile even without

>> a cross_prefix.

>>

>> Signed-off-by: Joelle van Dyne <j@getutm.app>

>> ---

>>  configure | 13 ++++++++++++-

>>  1 file changed, 12 insertions(+), 1 deletion(-)

>>

>> diff --git a/configure b/configure

>> index 3c63879750..46d5db63e8 100755

>> --- a/configure

>> +++ b/configure

>> @@ -234,6 +234,7 @@ cpu=""

>>  iasl="iasl"

>>  interp_prefix="/usr/gnemul/qemu-%M"

>>  static="no"

>> +cross_compile="no"

>>  cross_prefix=""

>>  audio_drv_list=""

>>  block_drv_rw_whitelist=""

>> @@ -456,6 +457,11 @@ for opt do

>>    optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')

>>    case "$opt" in

>>    --cross-prefix=*) cross_prefix="$optarg"

>> +                    cross_compile="yes"

>> +  ;;

>> +  --enable-cross-compile) cross_compile="yes"

>> +  ;;

>> +  --disable-cross-compile) cross_compile="no"

> 

> Can't you simply use --cros-prefix="" instead?


I mean, still introduce the "cross_compile=yes" variable, just omit the new
options.

 Thomas
Xingtao Yao (Fujitsu)" via Oct. 19, 2020, 11:24 a.m. UTC | #3
On Mon, 19 Oct 2020, Thomas Huth wrote:
> On 19/10/2020 10.07, Thomas Huth wrote:

>> On 19/10/2020 03.39, Joelle van Dyne wrote:

>>> From: osy <osy86@users.noreply.github.com>

>>>

>>> The iOS toolchain does not use the host prefix naming convention. We add a

>>> new option `--enable-cross-compile` that forces cross-compile even without

>>> a cross_prefix.

>>>

>>> Signed-off-by: Joelle van Dyne <j@getutm.app>

>>> ---

>>>  configure | 13 ++++++++++++-

>>>  1 file changed, 12 insertions(+), 1 deletion(-)

>>>

>>> diff --git a/configure b/configure

>>> index 3c63879750..46d5db63e8 100755

>>> --- a/configure

>>> +++ b/configure

>>> @@ -234,6 +234,7 @@ cpu=""

>>>  iasl="iasl"

>>>  interp_prefix="/usr/gnemul/qemu-%M"

>>>  static="no"

>>> +cross_compile="no"

>>>  cross_prefix=""

>>>  audio_drv_list=""

>>>  block_drv_rw_whitelist=""

>>> @@ -456,6 +457,11 @@ for opt do

>>>    optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')

>>>    case "$opt" in

>>>    --cross-prefix=*) cross_prefix="$optarg"

>>> +                    cross_compile="yes"

>>> +  ;;

>>> +  --enable-cross-compile) cross_compile="yes"

>>> +  ;;

>>> +  --disable-cross-compile) cross_compile="no"

>>

>> Can't you simply use --cros-prefix="" instead?

>

> I mean, still introduce the "cross_compile=yes" variable, just omit the new

> options.


That seems less intuitive for people trying to find this option. If --help 
lists --enable-cross-compile I can guess what that means but there's no 
way I could guess --cros-prefix="" unless I've been told or searched and 
stumbled upon it. So unless it's a big problem I like the explicit options 
better. Or is that a convention in other projects to use empty prefix to 
enable cross compile that I don't know about?

Regards,
BALATON Zoltan
Joelle van Dyne Oct. 19, 2020, 10:24 p.m. UTC | #4
Correct me if I'm wrong but wouldn't the following test still fail
with --cross-prefix=""

if test -n "$cross_prefix"; then
...

That was my main reason for making this change.

-j

On Mon, Oct 19, 2020 at 4:24 AM BALATON Zoltan <balaton@eik.bme.hu> wrote:
>

> On Mon, 19 Oct 2020, Thomas Huth wrote:

> > On 19/10/2020 10.07, Thomas Huth wrote:

> >> On 19/10/2020 03.39, Joelle van Dyne wrote:

> >>> From: osy <osy86@users.noreply.github.com>

> >>>

> >>> The iOS toolchain does not use the host prefix naming convention. We add a

> >>> new option `--enable-cross-compile` that forces cross-compile even without

> >>> a cross_prefix.

> >>>

> >>> Signed-off-by: Joelle van Dyne <j@getutm.app>

> >>> ---

> >>>  configure | 13 ++++++++++++-

> >>>  1 file changed, 12 insertions(+), 1 deletion(-)

> >>>

> >>> diff --git a/configure b/configure

> >>> index 3c63879750..46d5db63e8 100755

> >>> --- a/configure

> >>> +++ b/configure

> >>> @@ -234,6 +234,7 @@ cpu=""

> >>>  iasl="iasl"

> >>>  interp_prefix="/usr/gnemul/qemu-%M"

> >>>  static="no"

> >>> +cross_compile="no"

> >>>  cross_prefix=""

> >>>  audio_drv_list=""

> >>>  block_drv_rw_whitelist=""

> >>> @@ -456,6 +457,11 @@ for opt do

> >>>    optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')

> >>>    case "$opt" in

> >>>    --cross-prefix=*) cross_prefix="$optarg"

> >>> +                    cross_compile="yes"

> >>> +  ;;

> >>> +  --enable-cross-compile) cross_compile="yes"

> >>> +  ;;

> >>> +  --disable-cross-compile) cross_compile="no"

> >>

> >> Can't you simply use --cros-prefix="" instead?

> >

> > I mean, still introduce the "cross_compile=yes" variable, just omit the new

> > options.

>

> That seems less intuitive for people trying to find this option. If --help

> lists --enable-cross-compile I can guess what that means but there's no

> way I could guess --cros-prefix="" unless I've been told or searched and

> stumbled upon it. So unless it's a big problem I like the explicit options

> better. Or is that a convention in other projects to use empty prefix to

> enable cross compile that I don't know about?

>

> Regards,

> BALATON Zoltan
Thomas Huth Oct. 20, 2020, 5:15 a.m. UTC | #5
On 20/10/2020 00.24, Joelle van Dyne wrote:
> Correct me if I'm wrong but wouldn't the following test still fail

> with --cross-prefix=""

> 

> if test -n "$cross_prefix"; then

> ...

> 

> That was my main reason for making this change.


That's why I wrote "still introduce the cross_compile=yes variable" ... that
change is certainly required anyway.

>>>>> @@ -456,6 +457,11 @@ for opt do

>>>>>    optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')

>>>>>    case "$opt" in

>>>>>    --cross-prefix=*) cross_prefix="$optarg"

>>>>> +                    cross_compile="yes"

>>>>> +  ;;

>>>>> +  --enable-cross-compile) cross_compile="yes"

>>>>> +  ;;

>>>>> +  --disable-cross-compile) cross_compile="no"

>>>>

>>>> Can't you simply use --cros-prefix="" instead?

>>>

>>> I mean, still introduce the "cross_compile=yes" variable, just omit the new

>>> options.

>>

>> That seems less intuitive for people trying to find this option. If --help

>> lists --enable-cross-compile I can guess what that means but there's no

>> way I could guess --cros-prefix="" unless I've been told or searched and

>> stumbled upon it. So unless it's a big problem I like the explicit options

>> better. Or is that a convention in other projects to use empty prefix to

>> enable cross compile that I don't know about?


I don't think that --cross-prefix is a "standard" option... Most other
(GNU-tools related) projects use "--build" and "--host" instead... so I
guess we're free to chose here. Let's see whether other people here have an
opionion on this...

 Thomas
Paolo Bonzini Oct. 20, 2020, 8:34 a.m. UTC | #6
On 20/10/20 07:15, Thomas Huth wrote:
>>>>>> +  ;;

>>>>>> +  --enable-cross-compile) cross_compile="yes"

>>>>>> +  ;;

>>>>>> +  --disable-cross-compile) cross_compile="no"

>>>>>

>>>>> Can't you simply use --cros-prefix="" instead?

>>>>

>>>> I mean, still introduce the "cross_compile=yes" variable, just omit the new

>>>> options.

>>>

>>> That seems less intuitive for people trying to find this option. If --help

>>> lists --enable-cross-compile I can guess what that means but there's no

>>> way I could guess --cros-prefix="" unless I've been told or searched and

>>> stumbled upon it. So unless it's a big problem I like the explicit options

>>> better. Or is that a convention in other projects to use empty prefix to

>>> enable cross compile that I don't know about?

>

> I don't think that --cross-prefix is a "standard" option... Most other

> (GNU-tools related) projects use "--build" and "--host" instead... so I

> guess we're free to chose here. Let's see whether other people here have an

> opionion on this...


Yeah, the way GNU tools do it is that you specify --build and --host,
and --host triggers cross compilation.  I'm not sure how they'd handle
the situation where the cross prefix is empty.

For QEMU, I agree with Thomas that --cross-prefix="" is enough.

Paolo
Joelle van Dyne Oct. 25, 2020, 7:24 p.m. UTC | #7
As the patch stands --cross-prefix="" works but I like having the
--enable-cross-compile option because it's more clear of the intention
(in logs and such). I've been struggling to come up with a concise
modification to the help text for --cross-prefix that explains that
empty PREFIX is allowed and why you would want to do that.

-j

On Tue, Oct 20, 2020 at 1:35 AM Paolo Bonzini <pbonzini@redhat.com> wrote:
>

> On 20/10/20 07:15, Thomas Huth wrote:

> >>>>>> +  ;;

> >>>>>> +  --enable-cross-compile) cross_compile="yes"

> >>>>>> +  ;;

> >>>>>> +  --disable-cross-compile) cross_compile="no"

> >>>>>

> >>>>> Can't you simply use --cros-prefix="" instead?

> >>>>

> >>>> I mean, still introduce the "cross_compile=yes" variable, just omit the new

> >>>> options.

> >>>

> >>> That seems less intuitive for people trying to find this option. If --help

> >>> lists --enable-cross-compile I can guess what that means but there's no

> >>> way I could guess --cros-prefix="" unless I've been told or searched and

> >>> stumbled upon it. So unless it's a big problem I like the explicit options

> >>> better. Or is that a convention in other projects to use empty prefix to

> >>> enable cross compile that I don't know about?

> >

> > I don't think that --cross-prefix is a "standard" option... Most other

> > (GNU-tools related) projects use "--build" and "--host" instead... so I

> > guess we're free to chose here. Let's see whether other people here have an

> > opionion on this...

>

> Yeah, the way GNU tools do it is that you specify --build and --host,

> and --host triggers cross compilation.  I'm not sure how they'd handle

> the situation where the cross prefix is empty.

>

> For QEMU, I agree with Thomas that --cross-prefix="" is enough.

>

> Paolo

>
Paolo Bonzini Oct. 26, 2020, 7:54 a.m. UTC | #8
On 25/10/20 20:24, Joelle van Dyne wrote:
> As the patch stands --cross-prefix="" works but I like having the

> --enable-cross-compile option because it's more clear of the intention

> (in logs and such). I've been struggling to come up with a concise

> modification to the help text for --cross-prefix that explains that

> empty PREFIX is allowed and why you would want to do that.


--cross-prefix=PREFIX enable cross compilation, using PREFIX
                      in front of compile tools

Paolo
Joelle van Dyne Oct. 26, 2020, 3:33 p.m. UTC | #9
Just to be clear, you're in favor of removing the
--enable-cross-compile option? I can do that if others agree but I'm
not sure what the downside of adding this extra option is?

-j

On Mon, Oct 26, 2020 at 12:54 AM Paolo Bonzini <pbonzini@redhat.com> wrote:
>

> On 25/10/20 20:24, Joelle van Dyne wrote:

> > As the patch stands --cross-prefix="" works but I like having the

> > --enable-cross-compile option because it's more clear of the intention

> > (in logs and such). I've been struggling to come up with a concise

> > modification to the help text for --cross-prefix that explains that

> > empty PREFIX is allowed and why you would want to do that.

>

> --cross-prefix=PREFIX enable cross compilation, using PREFIX

>                       in front of compile tools

>

> Paolo

>
Paolo Bonzini Oct. 26, 2020, 4:15 p.m. UTC | #10
On 26/10/20 16:33, Joelle van Dyne wrote:
> Just to be clear, you're in favor of removing the

> --enable-cross-compile option? I can do that if others agree but I'm

> not sure what the downside of adding this extra option is?


For me the downside is that it's not clear that --cross-prefix=foo-
implies --enable-cross-compile.

Paolo

> -j

> 

> On Mon, Oct 26, 2020 at 12:54 AM Paolo Bonzini <pbonzini@redhat.com> wrote:

>>

>> On 25/10/20 20:24, Joelle van Dyne wrote:

>>> As the patch stands --cross-prefix="" works but I like having the

>>> --enable-cross-compile option because it's more clear of the intention

>>> (in logs and such). I've been struggling to come up with a concise

>>> modification to the help text for --cross-prefix that explains that

>>> empty PREFIX is allowed and why you would want to do that.

>>

>> --cross-prefix=PREFIX enable cross compilation, using PREFIX

>>                       in front of compile tools

>>

>> Paolo

>>

>
Thomas Huth Oct. 26, 2020, 6:51 p.m. UTC | #11
On 26/10/2020 17.15, Paolo Bonzini wrote:
> On 26/10/20 16:33, Joelle van Dyne wrote:

>> Just to be clear, you're in favor of removing the

>> --enable-cross-compile option? I can do that if others agree but I'm

>> not sure what the downside of adding this extra option is?

> 

> For me the downside is that it's not clear that --cross-prefix=foo-

> implies --enable-cross-compile.


I agree with Paolo ... two options sound rather confusing to me than just
having one option. And the amount of options of the configure script is too
big already anyway, so I'd recommend to drop --enable-cross-compile.

 Thomas
diff mbox series

Patch

diff --git a/configure b/configure
index 3c63879750..46d5db63e8 100755
--- a/configure
+++ b/configure
@@ -234,6 +234,7 @@  cpu=""
 iasl="iasl"
 interp_prefix="/usr/gnemul/qemu-%M"
 static="no"
+cross_compile="no"
 cross_prefix=""
 audio_drv_list=""
 block_drv_rw_whitelist=""
@@ -456,6 +457,11 @@  for opt do
   optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')
   case "$opt" in
   --cross-prefix=*) cross_prefix="$optarg"
+                    cross_compile="yes"
+  ;;
+  --enable-cross-compile) cross_compile="yes"
+  ;;
+  --disable-cross-compile) cross_compile="no"
   ;;
   --cc=*) CC="$optarg"
   ;;
@@ -878,6 +884,10 @@  for opt do
   ;;
   --cross-prefix=*)
   ;;
+  --enable-cross-compile)
+  ;;
+  --disable-cross-compile)
+  ;;
   --cc=*)
   ;;
   --host-cc=*) host_cc="$optarg"
@@ -1687,6 +1697,7 @@  Advanced options (experts only):
   --efi-aarch64=PATH       PATH of efi file to use for aarch64 VMs.
   --with-suffix=SUFFIX     suffix for QEMU data inside datadir/libdir/sysconfdir/docdir [$qemu_suffix]
   --with-pkgversion=VERS   use specified string as sub-version of the package
+  --enable-cross-compile   enable cross compiling (set automatically if $cross_prefix is set)
   --enable-debug           enable common debug build options
   --enable-sanitizers      enable default sanitizers
   --enable-tsan            enable thread sanitizer
@@ -7164,7 +7175,7 @@  if has $sdl2_config; then
 fi
 echo "strip = [$(meson_quote $strip)]" >> $cross
 echo "windres = [$(meson_quote $windres)]" >> $cross
-if test -n "$cross_prefix"; then
+if test "$cross_compile" = "yes"; then
     cross_arg="--cross-file config-meson.cross"
     echo "[host_machine]" >> $cross
     if test "$mingw32" = "yes" ; then