diff mbox series

[4/6] meson: use subproject for keycodemapdb

Message ID 20230519085647.1104775-5-pbonzini@redhat.com
State New
Headers show
Series meson: use subprojects for bundled projects | expand

Commit Message

Paolo Bonzini May 19, 2023, 8:56 a.m. UTC
By using a subproject, our own meson.build can use variables from
the subproject instead of hard-coded paths.  This is also the first step
towards managing downloads with .wrap files instead of submodule.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 .gitmodules                      | 4 ++--
 configure                        | 4 ++--
 scripts/archive-source.sh        | 2 +-
 {ui => subprojects}/keycodemapdb | 0
 ui/meson.build                   | 8 ++++----
 5 files changed, 9 insertions(+), 9 deletions(-)
 rename {ui => subprojects}/keycodemapdb (100%)

Comments

Daniel P. Berrangé May 19, 2023, 9:06 a.m. UTC | #1
On Fri, May 19, 2023 at 10:56:44AM +0200, Paolo Bonzini wrote:
> By using a subproject, our own meson.build can use variables from
> the subproject instead of hard-coded paths.  This is also the first step
> towards managing downloads with .wrap files instead of submodule.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  .gitmodules                      | 4 ++--
>  configure                        | 4 ++--
>  scripts/archive-source.sh        | 2 +-
>  {ui => subprojects}/keycodemapdb | 0
>  ui/meson.build                   | 8 ++++----
>  5 files changed, 9 insertions(+), 9 deletions(-)
>  rename {ui => subprojects}/keycodemapdb (100%)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


With regards,
Daniel
diff mbox series

Patch

diff --git a/.gitmodules b/.gitmodules
index 3ed5d073d630..f8b2ddf3877c 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -25,8 +25,8 @@ 
 [submodule "roms/QemuMacDrivers"]
 	path = roms/QemuMacDrivers
 	url = https://gitlab.com/qemu-project/QemuMacDrivers.git
-[submodule "ui/keycodemapdb"]
-	path = ui/keycodemapdb
+[submodule "subprojects/keycodemapdb"]
+	path = subprojects/keycodemapdb
 	url = https://gitlab.com/qemu-project/keycodemapdb.git
 [submodule "roms/seabios-hppa"]
 	path = roms/seabios-hppa
diff --git a/configure b/configure
index 5bbca83d9a31..2b6995e16756 100755
--- a/configure
+++ b/configure
@@ -254,7 +254,7 @@  else
     git_submodules_action="ignore"
 fi
 
-git_submodules="ui/keycodemapdb"
+git_submodules="subprojects/keycodemapdb"
 git="git"
 debug_tcg="no"
 docs="auto"
@@ -806,7 +806,7 @@  case $git_submodules_action in
         fi
     ;;
     ignore)
-        if ! test -f "$source_path/ui/keycodemapdb/README"
+        if ! test -f "$source_path/subprojects/keycodemapdb/README"
         then
             echo
             echo "ERROR: missing GIT submodules"
diff --git a/scripts/archive-source.sh b/scripts/archive-source.sh
index a7c2886334f0..dba5ae05b67e 100755
--- a/scripts/archive-source.sh
+++ b/scripts/archive-source.sh
@@ -26,7 +26,7 @@  sub_file="${sub_tdir}/submodule.tar"
 # independent of what the developer currently has initialized
 # in their checkout, because the build environment is completely
 # different to the host OS.
-submodules="subprojects/dtc ui/keycodemapdb"
+submodules="subprojects/dtc subprojects/keycodemapdb"
 submodules="$submodules tests/fp/berkeley-softfloat-3 tests/fp/berkeley-testfloat-3"
 sub_deinit=""
 
diff --git a/ui/keycodemapdb b/subprojects/keycodemapdb
similarity index 100%
rename from ui/keycodemapdb
rename to subprojects/keycodemapdb
diff --git a/ui/meson.build b/ui/meson.build
index 330369707dd7..e09b616a66bc 100644
--- a/ui/meson.build
+++ b/ui/meson.build
@@ -162,15 +162,15 @@  keymaps = [
 ]
 
 if have_system or xkbcommon.found()
+  keycodemapdb_proj = subproject('keycodemapdb', required: true)
   foreach e : keymaps
     output = 'input-keymap-@0@-to-@1@.c.inc'.format(e[0], e[1])
     genh += custom_target(output,
                   output: output,
                   capture: true,
-                  input: files('keycodemapdb/data/keymaps.csv'),
-                  command: [python, files('keycodemapdb/tools/keymap-gen'),
-                            'code-map',
-                            '--lang', 'glib2',
+                  input: keycodemapdb_proj.get_variable('keymaps_csv'),
+                  command: [python, keycodemapdb_proj.get_variable('keymap_gen').full_path(),
+                            'code-map', '--lang', 'glib2',
                             '--varname', 'qemu_input_map_@0@_to_@1@'.format(e[0], e[1]),
                             '@INPUT0@', e[0], e[1]])
   endforeach