qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] meson: avoid compiling qemu-keymap by default
@ 2020-08-24 15:24 Laurent Vivier
  2020-08-24 15:24 ` [PATCH v2 1/2] meson: move xkbcommon to meson Laurent Vivier
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Laurent Vivier @ 2020-08-24 15:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Laurent Vivier, Philippe Mathieu-Daudé,
	Gerd Hoffmann, Marc-André Lureau

We don't need it with linux-user only build, and if xkbcommon dynamic
library is detected it can break the build of static only binaries.

So disable it if it is no explicitly asked by the user when neither
system or tools are built.

build qemu-keymap:
  configure --disable-system --disable-tools --disable-user --enable-xkbcommon
  configure --disable-system --enable-tools --disable-user
  configure --enable-system --disable-tools --disable-user

don't build qemu-keymap:
  configure --disable-system --disable-tools --disable-user
  configure --disable-system --disable-tools --enable-user

Laurent Vivier (2):
  meson: move xkbcommon to meson
  meson: avoid compiling qemu-keymap by default

 configure         | 29 ++++-------------------------
 meson.build       | 16 +++++++++++-----
 meson_options.txt |  1 +
 ui/meson.build    |  2 +-
 4 files changed, 17 insertions(+), 31 deletions(-)

-- 
2.26.2



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 1/2] meson: move xkbcommon to meson
  2020-08-24 15:24 [PATCH v2 0/2] meson: avoid compiling qemu-keymap by default Laurent Vivier
@ 2020-08-24 15:24 ` Laurent Vivier
  2020-08-24 15:24 ` [PATCH v2 2/2] meson: avoid compiling qemu-keymap by default Laurent Vivier
  2020-08-25  7:52 ` [PATCH v2 0/2] " Paolo Bonzini
  2 siblings, 0 replies; 4+ messages in thread
From: Laurent Vivier @ 2020-08-24 15:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Laurent Vivier, Philippe Mathieu-Daudé,
	Gerd Hoffmann, Marc-André Lureau

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 configure         | 29 ++++-------------------------
 meson.build       | 11 ++++++-----
 meson_options.txt |  1 +
 ui/meson.build    |  2 +-
 4 files changed, 12 insertions(+), 31 deletions(-)

diff --git a/configure b/configure
index 67832e3bab76..dcc4bca5e42e 100755
--- a/configure
+++ b/configure
@@ -432,7 +432,7 @@ vde=""
 vnc_sasl="auto"
 vnc_jpeg="auto"
 vnc_png="auto"
-xkbcommon=""
+xkbcommon="auto"
 xen=""
 xen_ctrl_version=""
 xen_pci_passthrough=""
@@ -1631,9 +1631,9 @@ for opt do
   ;;
   --disable-libpmem) libpmem=no
   ;;
-  --enable-xkbcommon) xkbcommon=yes
+  --enable-xkbcommon) xkbcommon="enabled"
   ;;
-  --disable-xkbcommon) xkbcommon=no
+  --disable-xkbcommon) xkbcommon="disabled"
   ;;
   --enable-plugins) plugins="yes"
   ;;
@@ -3446,22 +3446,6 @@ EOF
     fi
 fi
 
-##########################################
-# xkbcommon probe
-if test "$xkbcommon" != "no" ; then
-  if $pkg_config xkbcommon --exists; then
-    xkbcommon_cflags=$($pkg_config xkbcommon --cflags)
-    xkbcommon_libs=$($pkg_config xkbcommon --libs)
-    xkbcommon=yes
-  else
-    if test "$xkbcommon" = "yes" ; then
-      feature_not_found "xkbcommon" "Install libxkbcommon-devel"
-    fi
-    xkbcommon=no
-  fi
-fi
-
-
 ##########################################
 # xfsctl() probe, used for file-posix.c
 if test "$xfs" != "no" ; then
@@ -6827,11 +6811,6 @@ if test "$audio_win_int" = "yes" ; then
 fi
 echo "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak
 echo "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak
-if test "$xkbcommon" = "yes" ; then
-  echo "CONFIG_XKBCOMMON=y" >> $config_host_mak
-  echo "XKBCOMMON_CFLAGS=$xkbcommon_cflags" >> $config_host_mak
-  echo "XKBCOMMON_LIBS=$xkbcommon_libs" >> $config_host_mak
-fi
 if test "$xfs" = "yes" ; then
   echo "CONFIG_XFS=y" >> $config_host_mak
 fi
@@ -8250,7 +8229,7 @@ NINJA=$PWD/ninjatool $meson setup \
         -Db_coverage=$(if test "$gcov" = yes; then echo true; else echo false; fi) \
 	-Dsdl=$sdl -Dsdl_image=$sdl_image \
 	-Dvnc=$vnc -Dvnc_sasl=$vnc_sasl -Dvnc_jpeg=$vnc_jpeg -Dvnc_png=$vnc_png \
-	-Dgettext=$gettext \
+	-Dgettext=$gettext -Dxkbcommon=$xkbcommon \
         $cross_arg \
         "$PWD" "$source_path"
 
diff --git a/meson.build b/meson.build
index df5bf728b57a..f6e346af1a69 100644
--- a/meson.build
+++ b/meson.build
@@ -152,10 +152,10 @@ libcap_ng = not_found
 if 'CONFIG_LIBCAP_NG' in config_host
   libcap_ng = declare_dependency(link_args: config_host['LIBCAP_NG_LIBS'].split())
 endif
-xkbcommon = not_found
-if 'CONFIG_XKBCOMMON' in config_host
-  xkbcommon = declare_dependency(compile_args: config_host['XKBCOMMON_CFLAGS'].split(),
-                                 link_args: config_host['XKBCOMMON_LIBS'].split())
+xkbcommon = dependency('xkbcommon', required: get_option('xkbcommon'), static: enable_static,
+                       include_type: 'system')
+if xkbcommon.found()
+  xkbcommon = declare_dependency(dependencies: xkbcommon)
 endif
 slirp = not_found
 if config_host.has_key('CONFIG_SLIRP')
@@ -389,6 +389,7 @@ config_host_data.set('CONFIG_VNC', vnc.found())
 config_host_data.set('CONFIG_VNC_JPEG', jpeg.found())
 config_host_data.set('CONFIG_VNC_PNG', png.found())
 config_host_data.set('CONFIG_VNC_SASL', sasl.found())
+config_host_data.set('CONFIG_XKBCOMMON', xkbcommon.found())
 config_host_data.set('QEMU_VERSION', '"@0@"'.format(meson.project_version()))
 config_host_data.set('QEMU_VERSION_MAJOR', meson.project_version().split('.')[0])
 config_host_data.set('QEMU_VERSION_MINOR', meson.project_version().split('.')[1])
@@ -1062,7 +1063,7 @@ if 'CONFIG_GUEST_AGENT' in config_host
   subdir('qga')
 endif
 
-if 'CONFIG_XKBCOMMON' in config_host
+if xkbcommon.found()
   # used for the update-keymaps target, so include rules even if !have_tools
   qemu_keymap = executable('qemu-keymap', files('qemu-keymap.c', 'ui/input-keymap.c') + genh,
                            dependencies: [qemuutil, xkbcommon], install: have_tools)
diff --git a/meson_options.txt b/meson_options.txt
index e5f45243ce78..c55f9cd94cb2 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -5,3 +5,4 @@ option('vnc', type : 'feature', value : 'enabled')
 option('vnc_jpeg', type : 'feature', value : 'auto')
 option('vnc_png', type : 'feature', value : 'auto')
 option('vnc_sasl', type : 'feature', value : 'auto')
+option('xkbcommon', type : 'feature', value : 'auto')
diff --git a/ui/meson.build b/ui/meson.build
index 81fd393432a4..018c5698bf66 100644
--- a/ui/meson.build
+++ b/ui/meson.build
@@ -95,7 +95,7 @@ keymaps = [
   ['osx', 'qcode'],
 ]
 
-if have_system or 'CONFIG_XKBCOMMON' in config_host
+if have_system or xkbcommon.found()
   foreach e : keymaps
     output = 'input-keymap-@0@-to-@1@.c.inc'.format(e[0], e[1])
     genh += custom_target(output,
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2] meson: avoid compiling qemu-keymap by default
  2020-08-24 15:24 [PATCH v2 0/2] meson: avoid compiling qemu-keymap by default Laurent Vivier
  2020-08-24 15:24 ` [PATCH v2 1/2] meson: move xkbcommon to meson Laurent Vivier
@ 2020-08-24 15:24 ` Laurent Vivier
  2020-08-25  7:52 ` [PATCH v2 0/2] " Paolo Bonzini
  2 siblings, 0 replies; 4+ messages in thread
From: Laurent Vivier @ 2020-08-24 15:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Laurent Vivier, Philippe Mathieu-Daudé,
	Gerd Hoffmann, Marc-André Lureau

qemu-keymap is not needed with linux-user, so disable it by default if
tools and system are disabled (tools are disabled by default with linux-user).

Avoid this error with statically linked binaries:

    Linking target qemu-keymap
    /usr/bin/ld: cannot find -lxkbcommon

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 meson.build | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/meson.build b/meson.build
index f6e346af1a69..f0fe5f8799e0 100644
--- a/meson.build
+++ b/meson.build
@@ -1063,6 +1063,11 @@ if 'CONFIG_GUEST_AGENT' in config_host
   subdir('qga')
 endif
 
+# Don't build qemu-keymap if xkbcommon is not explicitly enabled
+# when we don't build tools or system
+if get_option('xkbcommon').auto() and not have_system and not have_tools
+  xkbcommon = not_found
+endif
 if xkbcommon.found()
   # used for the update-keymaps target, so include rules even if !have_tools
   qemu_keymap = executable('qemu-keymap', files('qemu-keymap.c', 'ui/input-keymap.c') + genh,
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 0/2] meson: avoid compiling qemu-keymap by default
  2020-08-24 15:24 [PATCH v2 0/2] meson: avoid compiling qemu-keymap by default Laurent Vivier
  2020-08-24 15:24 ` [PATCH v2 1/2] meson: move xkbcommon to meson Laurent Vivier
  2020-08-24 15:24 ` [PATCH v2 2/2] meson: avoid compiling qemu-keymap by default Laurent Vivier
@ 2020-08-25  7:52 ` Paolo Bonzini
  2 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2020-08-25  7:52 UTC (permalink / raw)
  To: Laurent Vivier
  Cc: Marc-André Lureau, Philippe Mathieu-Daudé, qemu-devel,
	Gerd Hoffmann

[-- Attachment #1: Type: text/plain, Size: 1064 bytes --]

Queued, thanks.

Paolo

Il lun 24 ago 2020, 17:24 Laurent Vivier <laurent@vivier.eu> ha scritto:

> We don't need it with linux-user only build, and if xkbcommon dynamic
> library is detected it can break the build of static only binaries.
>
> So disable it if it is no explicitly asked by the user when neither
> system or tools are built.
>
> build qemu-keymap:
>   configure --disable-system --disable-tools --disable-user
> --enable-xkbcommon
>   configure --disable-system --enable-tools --disable-user
>   configure --enable-system --disable-tools --disable-user
>
> don't build qemu-keymap:
>   configure --disable-system --disable-tools --disable-user
>   configure --disable-system --disable-tools --enable-user
>
> Laurent Vivier (2):
>   meson: move xkbcommon to meson
>   meson: avoid compiling qemu-keymap by default
>
>  configure         | 29 ++++-------------------------
>  meson.build       | 16 +++++++++++-----
>  meson_options.txt |  1 +
>  ui/meson.build    |  2 +-
>  4 files changed, 17 insertions(+), 31 deletions(-)
>
> --
> 2.26.2
>
>
>

[-- Attachment #2: Type: text/html, Size: 1600 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-08-25  7:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-24 15:24 [PATCH v2 0/2] meson: avoid compiling qemu-keymap by default Laurent Vivier
2020-08-24 15:24 ` [PATCH v2 1/2] meson: move xkbcommon to meson Laurent Vivier
2020-08-24 15:24 ` [PATCH v2 2/2] meson: avoid compiling qemu-keymap by default Laurent Vivier
2020-08-25  7:52 ` [PATCH v2 0/2] " Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).