Skip to contentSkip to conversation

meson: allow disablind the installation of keymaps

PATCH In review [email protected] 2 participants 5 messages Jan 2, 2023 – Mar 26, 2023 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 meson: allow disablind the installation of keymaps

From: Carlos Santos <[email protected]>

There are situatuions in which the keyboard maps are not necessary (e.g. when building only tools or linux-user emulator). Add an option to avoid installing them, as already possible to do with firmware blobs.

---
 configure                     | 2 ++
 meson_options.txt             | 2 ++
 pc-bios/keymaps/meson.build   | 6 ++++--
 scripts/meson-buildoptions.sh | 4 ++++
 4 files changed, 12 insertions(+), 2 deletions(-)
configure +2 -0
index 789a4f6cc9..c6ed6a23d0 100755
@@ -889,6 +889,8 @@ for opt do
   ;;
   --disable-blobs) meson_option_parse --disable-install-blobs ""
   ;;
+  --disable-keymaps) meson_option_parse --disable-install-keymaps ""
+  ;;
   --enable-vfio-user-server) vfio_user_server="enabled"
   ;;
   --disable-vfio-user-server) vfio_user_server="disabled"
meson_options.txt +2 -0
index 559a571b6b..be27137e98 100644
@@ -48,6 +48,8 @@ option('module_upgrades', type : 'boolean', value : false,
        description: 'try to load modules from alternate paths for upgrades')
 option('install_blobs', type : 'boolean', value : true,
        description: 'install provided firmware blobs')
+option('install_keymaps', type : 'boolean', value : true,
+       description: 'install provided keyboard maps')
 option('sparse', type : 'feature', value : 'auto',
        description: 'sparse checker')
 option('guest_agent', type : 'feature', value : 'auto',
pc-bios/keymaps/meson.build +4 -2
index 06c75e646b..7d80c23005 100644
@@ -47,7 +47,7 @@ if native_qemu_keymap.found()
                        build_by_default: true,
                        output: km,
                        command: [native_qemu_keymap, '-f', '@OUTPUT@', args.split()],
-                       install: true,
+                       install: get_option('install_keymaps'),
                        install_dir: qemu_datadir / 'keymaps')
   endforeach
 
@@ -56,4 +56,6 @@ else
   install_data(keymaps.keys(), install_dir: qemu_datadir / 'keymaps')
 endif
 
-install_data(['sl', 'sv'], install_dir: qemu_datadir / 'keymaps')
+if get_option('install_keymaps')
+  install_data(['sl', 'sv'], install_dir: qemu_datadir / 'keymaps')
+endif
scripts/meson-buildoptions.sh +4 -0
index aa6e30ea91..f17d9c196e 100644
@@ -11,6 +11,8 @@ meson_options_help() {
   printf "%s\n" '  --datadir=VALUE          Data file directory [share]'
   printf "%s\n" '  --disable-coroutine-pool coroutine freelist (better performance)'
   printf "%s\n" '  --disable-install-blobs  install provided firmware blobs'
+  printf "%s\n" '  --disable-install-keymaps'
+  printf "%s\n" '                           install provided keyboard maps'
   printf "%s\n" '  --docdir=VALUE           Base directory for documentation installation'
   printf "%s\n" '                           (can be empty) [share/doc]'
   printf "%s\n" '  --enable-block-drv-whitelist-in-tools'
@@ -291,6 +293,8 @@ _meson_option_parse() {
     --includedir=*) quote_sh "-Dincludedir=$2" ;;
     --enable-install-blobs) printf "%s" -Dinstall_blobs=true ;;
     --disable-install-blobs) printf "%s" -Dinstall_blobs=false ;;
+    --enable-install-keymaps) printf "%s" -Dinstall_keymaps=true ;;
+    --disable-install-keymaps) printf "%s" -Dinstall_keymaps=false ;;
     --interp-prefix=*) quote_sh "-Dinterp_prefix=$2" ;;
     --enable-jack) printf "%s" -Djack=enabled ;;
     --disable-jack) printf "%s" -Djack=disabled ;;
Signature · 1 line
2.31.1
#1 lore raw
Quoted 85 lines · On Mon, Jan 2, 2023 at 1:19 PM <[email protected]> wrote:

From: Carlos Santos <[email protected]>

There are situatuions in which the keyboard maps are not necessary (e.g. when building only tools or linux-user emulator). Add an option to avoid installing them, as already possible to do with firmware blobs.

---
 configure                     | 2 ++
 meson_options.txt             | 2 ++
 pc-bios/keymaps/meson.build   | 6 ++++--
 scripts/meson-buildoptions.sh | 4 ++++
 4 files changed, 12 insertions(+), 2 deletions(-)
configure +2 -0
index 789a4f6cc9..c6ed6a23d0 100755
@@ -889,6 +889,8 @@ for opt do
   ;;
   --disable-blobs) meson_option_parse --disable-install-blobs ""
   ;;
+  --disable-keymaps) meson_option_parse --disable-install-keymaps ""
+  ;;
   --enable-vfio-user-server) vfio_user_server="enabled"
   ;;
   --disable-vfio-user-server) vfio_user_server="disabled"
meson_options.txt +2 -0
index 559a571b6b..be27137e98 100644
@@ -48,6 +48,8 @@ option('module_upgrades', type : 'boolean', value : false,
        description: 'try to load modules from alternate paths for upgrades')
 option('install_blobs', type : 'boolean', value : true,
        description: 'install provided firmware blobs')
+option('install_keymaps', type : 'boolean', value : true,
+       description: 'install provided keyboard maps')
 option('sparse', type : 'feature', value : 'auto',
        description: 'sparse checker')
 option('guest_agent', type : 'feature', value : 'auto',
pc-bios/keymaps/meson.build +4 -2
index 06c75e646b..7d80c23005 100644
@@ -47,7 +47,7 @@ if native_qemu_keymap.found()
                        build_by_default: true,
                        output: km,
                        command: [native_qemu_keymap, '-f', '@OUTPUT@', args.split()],
-                       install: true,
+                       install: get_option('install_keymaps'),
                        install_dir: qemu_datadir / 'keymaps')
   endforeach
 
@@ -56,4 +56,6 @@ else
   install_data(keymaps.keys(), install_dir: qemu_datadir / 'keymaps')
 endif
 
-install_data(['sl', 'sv'], install_dir: qemu_datadir / 'keymaps')
+if get_option('install_keymaps')
+  install_data(['sl', 'sv'], install_dir: qemu_datadir / 'keymaps')
+endif
scripts/meson-buildoptions.sh +4 -1
index aa6e30ea91..f17d9c196e 100644
@@ -11,6 +11,8 @@ meson_options_help() {
   printf "%s\n" '  --datadir=VALUE          Data file directory [share]'
   printf "%s\n" '  --disable-coroutine-pool coroutine freelist (better performance)'
   printf "%s\n" '  --disable-install-blobs  install provided firmware blobs'
+  printf "%s\n" '  --disable-install-keymaps'
+  printf "%s\n" '                           install provided keyboard maps'
   printf "%s\n" '  --docdir=VALUE           Base directory for documentation installation'
   printf "%s\n" '                           (can be empty) [share/doc]'
   printf "%s\n" '  --enable-block-drv-whitelist-in-tools'
@@ -291,6 +293,8 @@ _meson_option_parse() {
     --includedir=*) quote_sh "-Dincludedir=$2" ;;
     --enable-install-blobs) printf "%s" -Dinstall_blobs=true ;;
     --disable-install-blobs) printf "%s" -Dinstall_blobs=false ;;
+    --enable-install-keymaps) printf "%s" -Dinstall_keymaps=true ;;
+    --disable-install-keymaps) printf "%s" -Dinstall_keymaps=false ;;
     --interp-prefix=*) quote_sh "-Dinterp_prefix=$2" ;;
     --enable-jack) printf "%s" -Djack=enabled ;;
     --disable-jack) printf "%s" -Djack=disabled ;;
--
Quoted 2 lines

2.31.1

Thinking a bit more about this patch, I think the correct approach would be to install blobs and keymaps depending on have_system:

    [...]
    install: have_system,
    [...]

And use the same approach for trace-events-all, in trace/meson.build:

    [...]
    install: have_linux_user or have_bsd_user or have_system,
    [...]

This would prevent installing useless data.

Signature · 4 lines
Carlos Santos
Senior Software Maintenance Engineer
Red Hat
[email protected]    T: +55-11-3534-6186
#2 lore raw
Quoted 96 lines · Carlos Santos
Quoted 85 lines · On Mon, Jan 2, 2023 at 1:19 PM <[email protected]> wrote:

From: Carlos Santos <[email protected]>

There are situatuions in which the keyboard maps are not necessary (e.g. when building only tools or linux-user emulator). Add an option to avoid installing them, as already possible to do with firmware blobs.

---
  configure                     | 2 ++
  meson_options.txt             | 2 ++
  pc-bios/keymaps/meson.build   | 6 ++++--
  scripts/meson-buildoptions.sh | 4 ++++
  4 files changed, 12 insertions(+), 2 deletions(-)
configure +2 -0
index 789a4f6cc9..c6ed6a23d0 100755
@@ -889,6 +889,8 @@ for opt do
    ;;
    --disable-blobs) meson_option_parse --disable-install-blobs ""
    ;;
+  --disable-keymaps) meson_option_parse --disable-install-keymaps ""
+  ;;
    --enable-vfio-user-server) vfio_user_server="enabled"
    ;;
    --disable-vfio-user-server) vfio_user_server="disabled"
meson_options.txt +2 -0
index 559a571b6b..be27137e98 100644
@@ -48,6 +48,8 @@ option('module_upgrades', type : 'boolean', value : false,
         description: 'try to load modules from alternate paths for upgrades')
  option('install_blobs', type : 'boolean', value : true,
         description: 'install provided firmware blobs')
+option('install_keymaps', type : 'boolean', value : true,
+       description: 'install provided keyboard maps')
  option('sparse', type : 'feature', value : 'auto',
         description: 'sparse checker')
  option('guest_agent', type : 'feature', value : 'auto',
pc-bios/keymaps/meson.build +4 -2
index 06c75e646b..7d80c23005 100644
@@ -47,7 +47,7 @@ if native_qemu_keymap.found()
                         build_by_default: true,
                         output: km,
                         command: [native_qemu_keymap, '-f', '@OUTPUT@', args.split()],
-                       install: true,
+                       install: get_option('install_keymaps'),
                         install_dir: qemu_datadir / 'keymaps')
    endforeach
 
@@ -56,4 +56,6 @@ else
    install_data(keymaps.keys(), install_dir: qemu_datadir / 'keymaps')
  endif
 
-install_data(['sl', 'sv'], install_dir: qemu_datadir / 'keymaps')
+if get_option('install_keymaps')
+  install_data(['sl', 'sv'], install_dir: qemu_datadir / 'keymaps')
+endif
scripts/meson-buildoptions.sh +4 -1
index aa6e30ea91..f17d9c196e 100644
@@ -11,6 +11,8 @@ meson_options_help() {
    printf "%s\n" '  --datadir=VALUE          Data file directory [share]'
    printf "%s\n" '  --disable-coroutine-pool coroutine freelist (better performance)'
    printf "%s\n" '  --disable-install-blobs  install provided firmware blobs'
+  printf "%s\n" '  --disable-install-keymaps'
+  printf "%s\n" '                           install provided keyboard maps'
    printf "%s\n" '  --docdir=VALUE           Base directory for documentation installation'
    printf "%s\n" '                           (can be empty) [share/doc]'
    printf "%s\n" '  --enable-block-drv-whitelist-in-tools'
@@ -291,6 +293,8 @@ _meson_option_parse() {
      --includedir=*) quote_sh "-Dincludedir=$2" ;;
      --enable-install-blobs) printf "%s" -Dinstall_blobs=true ;;
      --disable-install-blobs) printf "%s" -Dinstall_blobs=false ;;
+    --enable-install-keymaps) printf "%s" -Dinstall_keymaps=true ;;
+    --disable-install-keymaps) printf "%s" -Dinstall_keymaps=false ;;
      --interp-prefix=*) quote_sh "-Dinterp_prefix=$2" ;;
      --enable-jack) printf "%s" -Djack=enabled ;;
      --disable-jack) printf "%s" -Djack=disabled ;;
--
Quoted 2 lines

2.31.1

Thinking a bit more about this patch, I think the correct approach would be to install blobs and keymaps depending on have_system:

     [...]
     install: have_system,
     [...]
Quoted 7 lines

And use the same approach for trace-events-all, in trace/meson.build:

     [...]
     install: have_linux_user or have_bsd_user or have_system,
     [...]

This would prevent installing useless data.

Yes, similar to:
https://lore.kernel.org/qemu-devel/[email protected]/

#3 lore raw
Quoted 100 lines · Philippe Mathieu-Daudé
Quoted 98 lines · Carlos Santos
Quoted 85 lines · On Mon, Jan 2, 2023 at 1:19 PM <[email protected]> wrote:

From: Carlos Santos <[email protected]>

There are situatuions in which the keyboard maps are not necessary (e.g. when building only tools or linux-user emulator). Add an option to avoid installing them, as already possible to do with firmware blobs.

---
  configure                     | 2 ++
  meson_options.txt             | 2 ++
  pc-bios/keymaps/meson.build   | 6 ++++--
  scripts/meson-buildoptions.sh | 4 ++++
  4 files changed, 12 insertions(+), 2 deletions(-)
configure +2 -0
index 789a4f6cc9..c6ed6a23d0 100755
@@ -889,6 +889,8 @@ for opt do
    ;;
    --disable-blobs) meson_option_parse --disable-install-blobs ""
    ;;
+  --disable-keymaps) meson_option_parse --disable-install-keymaps ""
+  ;;
    --enable-vfio-user-server) vfio_user_server="enabled"
    ;;
    --disable-vfio-user-server) vfio_user_server="disabled"
meson_options.txt +2 -0
index 559a571b6b..be27137e98 100644
@@ -48,6 +48,8 @@ option('module_upgrades', type : 'boolean', value : false,
         description: 'try to load modules from alternate paths for upgrades')
  option('install_blobs', type : 'boolean', value : true,
         description: 'install provided firmware blobs')
+option('install_keymaps', type : 'boolean', value : true,
+       description: 'install provided keyboard maps')
  option('sparse', type : 'feature', value : 'auto',
         description: 'sparse checker')
  option('guest_agent', type : 'feature', value : 'auto',
pc-bios/keymaps/meson.build +4 -2
index 06c75e646b..7d80c23005 100644
@@ -47,7 +47,7 @@ if native_qemu_keymap.found()
                         build_by_default: true,
                         output: km,
                         command: [native_qemu_keymap, '-f', '@OUTPUT@', args.split()],
-                       install: true,
+                       install: get_option('install_keymaps'),
                         install_dir: qemu_datadir / 'keymaps')
    endforeach
 
@@ -56,4 +56,6 @@ else
    install_data(keymaps.keys(), install_dir: qemu_datadir / 'keymaps')
  endif
 
-install_data(['sl', 'sv'], install_dir: qemu_datadir / 'keymaps')
+if get_option('install_keymaps')
+  install_data(['sl', 'sv'], install_dir: qemu_datadir / 'keymaps')
+endif
scripts/meson-buildoptions.sh +4 -1
index aa6e30ea91..f17d9c196e 100644
@@ -11,6 +11,8 @@ meson_options_help() {
    printf "%s\n" '  --datadir=VALUE          Data file directory [share]'
    printf "%s\n" '  --disable-coroutine-pool coroutine freelist (better performance)'
    printf "%s\n" '  --disable-install-blobs  install provided firmware blobs'
+  printf "%s\n" '  --disable-install-keymaps'
+  printf "%s\n" '                           install provided keyboard maps'
    printf "%s\n" '  --docdir=VALUE           Base directory for documentation installation'
    printf "%s\n" '                           (can be empty) [share/doc]'
    printf "%s\n" '  --enable-block-drv-whitelist-in-tools'
@@ -291,6 +293,8 @@ _meson_option_parse() {
      --includedir=*) quote_sh "-Dincludedir=$2" ;;
      --enable-install-blobs) printf "%s" -Dinstall_blobs=true ;;
      --disable-install-blobs) printf "%s" -Dinstall_blobs=false ;;
+    --enable-install-keymaps) printf "%s" -Dinstall_keymaps=true ;;
+    --disable-install-keymaps) printf "%s" -Dinstall_keymaps=false ;;
      --interp-prefix=*) quote_sh "-Dinterp_prefix=$2" ;;
      --enable-jack) printf "%s" -Djack=enabled ;;
      --disable-jack) printf "%s" -Djack=disabled ;;
--
Quoted 2 lines

2.31.1

Thinking a bit more about this patch, I think the correct approach would be to install blobs and keymaps depending on have_system:

     [...]
     install: have_system,
     [...]

And use the same approach for trace-events-all, in trace/meson.build:

Quoted 9 lines
Quoted 5 lines
     [...]
     install: have_linux_user or have_bsd_user or have_system,
     [...]

This would prevent installing useless data.

Yes, similar to:
https://lore.kernel.org/qemu-devel/[email protected]/

Apparently it was reviewed and ack-ed but never applied. :-(

Signature · 4 lines
Carlos Santos
Senior Software Maintenance Engineer
Red Hat
[email protected]    T: +55-11-3534-6186
#4 lore raw
In reply to [email protected]
Quoted 85 lines · On Mon, Jan 2, 2023 at 1:19 PM <[email protected]> wrote:

From: Carlos Santos <[email protected]>

There are situatuions in which the keyboard maps are not necessary (e.g. when building only tools or linux-user emulator). Add an option to avoid installing them, as already possible to do with firmware blobs.

---
 configure                     | 2 ++
 meson_options.txt             | 2 ++
 pc-bios/keymaps/meson.build   | 6 ++++--
 scripts/meson-buildoptions.sh | 4 ++++
 4 files changed, 12 insertions(+), 2 deletions(-)
configure +2 -0
index 789a4f6cc9..c6ed6a23d0 100755
@@ -889,6 +889,8 @@ for opt do
   ;;
   --disable-blobs) meson_option_parse --disable-install-blobs ""
   ;;
+  --disable-keymaps) meson_option_parse --disable-install-keymaps ""
+  ;;
   --enable-vfio-user-server) vfio_user_server="enabled"
   ;;
   --disable-vfio-user-server) vfio_user_server="disabled"
meson_options.txt +2 -0
index 559a571b6b..be27137e98 100644
@@ -48,6 +48,8 @@ option('module_upgrades', type : 'boolean', value : false,
        description: 'try to load modules from alternate paths for upgrades')
 option('install_blobs', type : 'boolean', value : true,
        description: 'install provided firmware blobs')
+option('install_keymaps', type : 'boolean', value : true,
+       description: 'install provided keyboard maps')
 option('sparse', type : 'feature', value : 'auto',
        description: 'sparse checker')
 option('guest_agent', type : 'feature', value : 'auto',
pc-bios/keymaps/meson.build +4 -2
index 06c75e646b..7d80c23005 100644
@@ -47,7 +47,7 @@ if native_qemu_keymap.found()
                        build_by_default: true,
                        output: km,
                        command: [native_qemu_keymap, '-f', '@OUTPUT@', args.split()],
-                       install: true,
+                       install: get_option('install_keymaps'),
                        install_dir: qemu_datadir / 'keymaps')
   endforeach
 
@@ -56,4 +56,6 @@ else
   install_data(keymaps.keys(), install_dir: qemu_datadir / 'keymaps')
 endif
 
-install_data(['sl', 'sv'], install_dir: qemu_datadir / 'keymaps')
+if get_option('install_keymaps')
+  install_data(['sl', 'sv'], install_dir: qemu_datadir / 'keymaps')
+endif
scripts/meson-buildoptions.sh +4 -1
index aa6e30ea91..f17d9c196e 100644
@@ -11,6 +11,8 @@ meson_options_help() {
   printf "%s\n" '  --datadir=VALUE          Data file directory [share]'
   printf "%s\n" '  --disable-coroutine-pool coroutine freelist (better performance)'
   printf "%s\n" '  --disable-install-blobs  install provided firmware blobs'
+  printf "%s\n" '  --disable-install-keymaps'
+  printf "%s\n" '                           install provided keyboard maps'
   printf "%s\n" '  --docdir=VALUE           Base directory for documentation installation'
   printf "%s\n" '                           (can be empty) [share/doc]'
   printf "%s\n" '  --enable-block-drv-whitelist-in-tools'
@@ -291,6 +293,8 @@ _meson_option_parse() {
     --includedir=*) quote_sh "-Dincludedir=$2" ;;
     --enable-install-blobs) printf "%s" -Dinstall_blobs=true ;;
     --disable-install-blobs) printf "%s" -Dinstall_blobs=false ;;
+    --enable-install-keymaps) printf "%s" -Dinstall_keymaps=true ;;
+    --disable-install-keymaps) printf "%s" -Dinstall_keymaps=false ;;
     --interp-prefix=*) quote_sh "-Dinterp_prefix=$2" ;;
     --enable-jack) printf "%s" -Djack=enabled ;;
     --disable-jack) printf "%s" -Djack=disabled ;;
--
Quoted 2 lines

2.31.1

This patch can be ignored. I submitted a better solution, which make the installation depend on have_linux_user or have_bsd_user or have_system.

Signature · 4 lines
Carlos Santos
Senior Software Maintenance Engineer
Red Hat
[email protected]    T: +55-11-3534-6186