[PATCH v2] configure: MinGW respect --bindir argument

Joshua Watt posted 1 patch 1 week ago
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20210112210239.28836-1-JPEWhacker@gmail.com
configure | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)

[PATCH v2] configure: MinGW respect --bindir argument

Posted by Joshua Watt 1 week ago
There are two cases that need to be accounted for when compiling QEMU
for MinGW32:
 1) A standalone distribution, where QEMU is self contained and
    extracted by the user, such as a user would download from the QEMU
    website. In this case, all the QEMU executable files should be
    rooted in $prefix to ensure they can be easily found by the user
 2) QEMU integrated into a distribution image/sysroot/SDK and
    distributed with other programs. In this case, the provided
    arguments for bindir/datadir/etc. should be respected as they for a
    Linux build.

Restructures the MinGW path configuration so that all of the paths
except bindir use the same rules as when building for other platforms.
This satisfies #2 and #1 since these files do not need to be directly in
$prefix anyway.

The handling for --bindir is changed so that it defaults to $prefix on
MinGW (maintaining the compatibility with #1), but if the user specifies
a specific path when configuring it can also satisfy #2.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 configure | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/configure b/configure
index 5860bdb77b..092e2926bc 100755
--- a/configure
+++ b/configure
@@ -1571,20 +1571,15 @@ libexecdir="${libexecdir:-$prefix/libexec}"
 includedir="${includedir:-$prefix/include}"
 
 if test "$mingw32" = "yes" ; then
-    mandir="$prefix"
-    datadir="$prefix"
-    docdir="$prefix"
-    bindir="$prefix"
-    sysconfdir="$prefix"
-    local_statedir="$prefix"
+    bindir="${bindir:-$prefix}"
 else
-    mandir="${mandir:-$prefix/share/man}"
-    datadir="${datadir:-$prefix/share}"
-    docdir="${docdir:-$prefix/share/doc}"
     bindir="${bindir:-$prefix/bin}"
-    sysconfdir="${sysconfdir:-$prefix/etc}"
-    local_statedir="${local_statedir:-$prefix/var}"
 fi
+mandir="${mandir:-$prefix/share/man}"
+datadir="${datadir:-$prefix/share}"
+docdir="${docdir:-$prefix/share/doc}"
+sysconfdir="${sysconfdir:-$prefix/etc}"
+local_statedir="${local_statedir:-$prefix/var}"
 firmwarepath="${firmwarepath:-$datadir/qemu-firmware}"
 localedir="${localedir:-$datadir/locale}"
 
-- 
2.30.0


Re: [PATCH v2] configure: MinGW respect --bindir argument

Posted by Paolo Bonzini 1 week ago
On 12/01/21 22:02, Joshua Watt wrote:
> There are two cases that need to be accounted for when compiling QEMU
> for MinGW32:
>   1) A standalone distribution, where QEMU is self contained and
>      extracted by the user, such as a user would download from the QEMU
>      website. In this case, all the QEMU executable files should be
>      rooted in $prefix to ensure they can be easily found by the user
>   2) QEMU integrated into a distribution image/sysroot/SDK and
>      distributed with other programs. In this case, the provided
>      arguments for bindir/datadir/etc. should be respected as they for a
>      Linux build.
> 
> Restructures the MinGW path configuration so that all of the paths
> except bindir use the same rules as when building for other platforms.
> This satisfies #2 and #1 since these files do not need to be directly in
> $prefix anyway.
> 
> The handling for --bindir is changed so that it defaults to $prefix on
> MinGW (maintaining the compatibility with #1), but if the user specifies
> a specific path when configuring it can also satisfy #2.
> 
> Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
> ---
>   configure | 17 ++++++-----------
>   1 file changed, 6 insertions(+), 11 deletions(-)
> 
> diff --git a/configure b/configure
> index 5860bdb77b..092e2926bc 100755
> --- a/configure
> +++ b/configure
> @@ -1571,20 +1571,15 @@ libexecdir="${libexecdir:-$prefix/libexec}"
>   includedir="${includedir:-$prefix/include}"
>   
>   if test "$mingw32" = "yes" ; then
> -    mandir="$prefix"
> -    datadir="$prefix"
> -    docdir="$prefix"
> -    bindir="$prefix"
> -    sysconfdir="$prefix"
> -    local_statedir="$prefix"
> +    bindir="${bindir:-$prefix}"
>   else
> -    mandir="${mandir:-$prefix/share/man}"
> -    datadir="${datadir:-$prefix/share}"
> -    docdir="${docdir:-$prefix/share/doc}"
>       bindir="${bindir:-$prefix/bin}"
> -    sysconfdir="${sysconfdir:-$prefix/etc}"
> -    local_statedir="${local_statedir:-$prefix/var}"
>   fi
> +mandir="${mandir:-$prefix/share/man}"
> +datadir="${datadir:-$prefix/share}"
> +docdir="${docdir:-$prefix/share/doc}"
> +sysconfdir="${sysconfdir:-$prefix/etc}"
> +local_statedir="${local_statedir:-$prefix/var}"
>   firmwarepath="${firmwarepath:-$datadir/qemu-firmware}"
>   localedir="${localedir:-$datadir/locale}"
>   
> 

Queued, thanks!

Paolo


Re: [PATCH v2] configure: MinGW respect --bindir argument

Posted by Thomas Huth 1 week ago
On 12/01/2021 22.02, Joshua Watt wrote:
> There are two cases that need to be accounted for when compiling QEMU
> for MinGW32:
>   1) A standalone distribution, where QEMU is self contained and
>      extracted by the user, such as a user would download from the QEMU
>      website. In this case, all the QEMU executable files should be
>      rooted in $prefix to ensure they can be easily found by the user
>   2) QEMU integrated into a distribution image/sysroot/SDK and
>      distributed with other programs. In this case, the provided
>      arguments for bindir/datadir/etc. should be respected as they for a
>      Linux build.
> 
> Restructures the MinGW path configuration so that all of the paths
> except bindir use the same rules as when building for other platforms.
> This satisfies #2 and #1 since these files do not need to be directly in
> $prefix anyway.
> 
> The handling for --bindir is changed so that it defaults to $prefix on
> MinGW (maintaining the compatibility with #1), but if the user specifies
> a specific path when configuring it can also satisfy #2.
> 
> Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
> ---
>   configure | 17 ++++++-----------
>   1 file changed, 6 insertions(+), 11 deletions(-)
> 
> diff --git a/configure b/configure
> index 5860bdb77b..092e2926bc 100755
> --- a/configure
> +++ b/configure
> @@ -1571,20 +1571,15 @@ libexecdir="${libexecdir:-$prefix/libexec}"
>   includedir="${includedir:-$prefix/include}"
>   
>   if test "$mingw32" = "yes" ; then
> -    mandir="$prefix"
> -    datadir="$prefix"
> -    docdir="$prefix"
> -    bindir="$prefix"
> -    sysconfdir="$prefix"
> -    local_statedir="$prefix"
> +    bindir="${bindir:-$prefix}"
>   else
> -    mandir="${mandir:-$prefix/share/man}"
> -    datadir="${datadir:-$prefix/share}"
> -    docdir="${docdir:-$prefix/share/doc}"
>       bindir="${bindir:-$prefix/bin}"
> -    sysconfdir="${sysconfdir:-$prefix/etc}"
> -    local_statedir="${local_statedir:-$prefix/var}"
>   fi
> +mandir="${mandir:-$prefix/share/man}"
> +datadir="${datadir:-$prefix/share}"
> +docdir="${docdir:-$prefix/share/doc}"
> +sysconfdir="${sysconfdir:-$prefix/etc}"
> +local_statedir="${local_statedir:-$prefix/var}"
>   firmwarepath="${firmwarepath:-$datadir/qemu-firmware}"
>   localedir="${localedir:-$datadir/locale}"

Yes, I think this makes most sense, thanks for the update!

Reviewed-by: Thomas Huth <thuth@redhat.com>