Skip to contentSkip to conversation

meson: Move the creation of the library to the main meson.build

PATCH Applied Philippe Mathieu-Daudé 3 participants 13 messages Oct 6, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover meson: Move the creation of the library to the main meson.build

Make Meson machinery more consistent, as requested by Paolo.

Since v1: addressed Paolo's review comments
- Drop migration RFC patch
- Move comment block

Series coded while listening to Brass Against songs:

https://www.youtube.com/channel/UClJMqrWQJ8OYWJ4ZdfqZdeQ

and available in the Git repository at:

https://gitlab.com/philmd/qemu.git branches/meson_libraries_consistency

Philippe Mathieu-Daudé (9):
meson.build: Add comments to clarify code organization meson.build: Sort sourcesets alphabetically
hw/core: Move the creation of the library to the main meson.build
chardev: Move the creation of the library to the main meson.build
migration: Move the creation of the library to the main meson.build
io: Move the creation of the library to the main meson.build
crypto: Move the creation of the library to the main meson.build
authz: Move the creation of the library to the main meson.build
qom: Move the creation of the library to the main meson.build

 meson.build           | 86 ++++++++++++++++++++++++++++++++++++++-----
 authz/meson.build     | 10 -----
 chardev/meson.build   |  6 ---
 crypto/meson.build    | 10 -----
 hw/core/meson.build   |  6 ---
 io/meson.build        | 10 -----
 migration/meson.build |  8 +---
 qom/meson.build       |  8 ----
 8 files changed, 77 insertions(+), 67 deletions(-)
Signature · 1 line
2.26.2
#1 lore raw

PATCH v2 1/9 meson.build: Add comments to clarify code organization

---
 meson.build | 8 ++++++++
 1 file changed, 8 insertions(+)
meson.build +8 -0
index a02c743794..4101620777 100644
@@ -1323,6 +1323,10 @@ qemu_syms = custom_target('qemu.syms', output: 'qemu.syms',
                              capture: true,
                              command: [undefsym, nm, '@INPUT@'])
 
+########################
+# Library dependencies #
+########################
+
 block_ss = block_ss.apply(config_host, strict: false)
 libblock = static_library('block', block_ss.sources() + genh,
                           dependencies: block_ss.dependencies(),
@@ -1342,6 +1346,10 @@ libqmp = static_library('qmp', qmp_ss.sources() + genh,
 
 qmp = declare_dependency(link_whole: [libqmp])
 
+###########
+# Targets #
+###########
+
 foreach m : block_mods + softmmu_mods
   shared_module(m.name(),
                 name_prefix: '',
Signature · 1 line
2.26.2
#2 lore raw

PATCH v2 2/9 meson.build: Sort sourcesets alphabetically

In reply to Philippe Mathieu-Daudé
---
 meson.build | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
meson.build +10 -10
index 4101620777..60497f5615 100644
@@ -1059,19 +1059,19 @@ sphinx_extn_depends = [ meson.source_root() / 'docs/sphinx/depfile.py',
 
 # Collect sourcesets.
 
-util_ss = ss.source_set()
+blockdev_ss = ss.source_set()
+block_ss = ss.source_set()
+bsd_user_ss = ss.source_set()
+common_ss = ss.source_set()
+linux_user_ss = ss.source_set()
+qmp_ss = ss.source_set()
+softmmu_ss = ss.source_set()
+specific_fuzz_ss = ss.source_set()
+specific_ss = ss.source_set()
 stub_ss = ss.source_set()
 trace_ss = ss.source_set()
-block_ss = ss.source_set()
-blockdev_ss = ss.source_set()
-qmp_ss = ss.source_set()
-common_ss = ss.source_set()
-softmmu_ss = ss.source_set()
 user_ss = ss.source_set()
-bsd_user_ss = ss.source_set()
-linux_user_ss = ss.source_set()
-specific_ss = ss.source_set()
-specific_fuzz_ss = ss.source_set()
+util_ss = ss.source_set()
 
 modules = {}
 hw_arch = {}
Signature · 1 line
2.26.2
#3 lore raw

PATCH v2 3/9 hw/core: Move the creation of the library to the main meson.build

In reply to Philippe Mathieu-Daudé

Be consistent creating all the libraries in the main meson.build file.

---
 meson.build         | 6 ++++++
 hw/core/meson.build | 6 ------
 2 files changed, 6 insertions(+), 6 deletions(-)
meson.build +6 -0
index 60497f5615..47eb7d3709 100644
@@ -1346,6 +1346,12 @@ libqmp = static_library('qmp', qmp_ss.sources() + genh,
 
 qmp = declare_dependency(link_whole: [libqmp])
 
+libhwcore = static_library('hwcore', sources: hwcore_files + genh,
+                           name_suffix: 'fa',
+                           build_by_default: false)
+hwcore = declare_dependency(link_whole: libhwcore)
+common_ss.add(hwcore)
+
 ###########
 # Targets #
 ###########
hw/core/meson.build +0 -6
index fc91f98075..4a744f3b5e 100644
@@ -14,12 +14,6 @@ hwcore_files = files(
   'qdev-clock.c',
 )
 
-libhwcore = static_library('hwcore', sources: hwcore_files + genh,
-                           name_suffix: 'fa',
-                           build_by_default: false)
-hwcore = declare_dependency(link_whole: libhwcore)
-common_ss.add(hwcore)
-
 common_ss.add(files('cpu.c'))
 common_ss.add(when: 'CONFIG_FITLOADER', if_true: files('loader-fit.c'))
 common_ss.add(when: 'CONFIG_GENERIC_LOADER', if_true: files('generic-loader.c'))
Signature · 1 line
2.26.2
#4 lore raw

PATCH v2 4/9 chardev: Move the creation of the library to the main meson.build

In reply to Philippe Mathieu-Daudé

Be consistent creating all the libraries in the main meson.build file.

---
 meson.build         | 7 +++++++
 chardev/meson.build | 6 ------
 2 files changed, 7 insertions(+), 6 deletions(-)
meson.build +7 -0
index 47eb7d3709..3c0d7b4d44 100644
@@ -1062,6 +1062,7 @@ sphinx_extn_depends = [ meson.source_root() / 'docs/sphinx/depfile.py',
 blockdev_ss = ss.source_set()
 block_ss = ss.source_set()
 bsd_user_ss = ss.source_set()
+chardev_ss = ss.source_set()
 common_ss = ss.source_set()
 linux_user_ss = ss.source_set()
 qmp_ss = ss.source_set()
@@ -1346,6 +1347,12 @@ libqmp = static_library('qmp', qmp_ss.sources() + genh,
 
 qmp = declare_dependency(link_whole: [libqmp])
 
+libchardev = static_library('chardev', chardev_ss.sources() + genh,
+                            name_suffix: 'fa',
+                            build_by_default: false)
+
+chardev = declare_dependency(link_whole: libchardev)
+
 libhwcore = static_library('hwcore', sources: hwcore_files + genh,
                            name_suffix: 'fa',
                            build_by_default: false)
chardev/meson.build +0 -6
index 54e88d0310..dd2699a11b 100644
@@ -1,4 +1,3 @@
-chardev_ss = ss.source_set()
 chardev_ss.add(files(
   'char-fe.c',
   'char-file.c',
@@ -25,11 +24,6 @@ chardev_ss.add(when: 'CONFIG_WIN32', if_true: files(
 ))
 
 chardev_ss = chardev_ss.apply(config_host, strict: false)
-libchardev = static_library('chardev', chardev_ss.sources() + genh,
-                            name_suffix: 'fa',
-                            build_by_default: false)
-
-chardev = declare_dependency(link_whole: libchardev)
 
 softmmu_ss.add(files('chardev-sysemu.c', 'msmouse.c', 'wctablet.c', 'testdev.c'))
 softmmu_ss.add(when: ['CONFIG_SPICE', spice], if_true: files('spice.c'))
Signature · 1 line
2.26.2
#5 lore raw

PATCH v2 5/9 migration: Move the creation of the library to the main meson.build

In reply to Philippe Mathieu-Daudé

Be consistent creating all the libraries in the main meson.build file.

---
 meson.build           | 7 +++++++
 migration/meson.build | 8 +-------
 2 files changed, 8 insertions(+), 7 deletions(-)
meson.build +7 -0
index 3c0d7b4d44..0e3598e267 100644
@@ -1328,6 +1328,13 @@ qemu_syms = custom_target('qemu.syms', output: 'qemu.syms',
 # Library dependencies #
 ########################
 
+libmigration = static_library('migration', sources: migration_files + genh,
+                              name_suffix: 'fa',
+                              build_by_default: false)
+migration = declare_dependency(link_with: libmigration,
+                               dependencies: [zlib, qom, io])
+softmmu_ss.add(migration)
+
 block_ss = block_ss.apply(config_host, strict: false)
 libblock = static_library('block', block_ss.sources() + genh,
                           dependencies: block_ss.dependencies(),
migration/meson.build +1 -7
index b5b71c8060..980e37865c 100644
@@ -8,13 +8,7 @@ migration_files = files(
   'qemu-file.c',
   'qjson.c',
 )
-
-libmigration = static_library('migration', sources: migration_files + genh,
-                              name_suffix: 'fa',
-                              build_by_default: false)
-migration = declare_dependency(link_with: libmigration,
-                               dependencies: [zlib, qom, io])
-softmmu_ss.add(migration)
+softmmu_ss.add(migration_files)
 
 softmmu_ss.add(files(
   'block-dirty-bitmap.c',
Signature · 1 line
2.26.2
#6 lore raw

PATCH v2 6/9 io: Move the creation of the library to the main meson.build

In reply to Philippe Mathieu-Daudé

Be consistent creating all the libraries in the main meson.build file.

---
 meson.build    | 10 ++++++++++
 io/meson.build | 10 ----------
 2 files changed, 10 insertions(+), 10 deletions(-)
meson.build +10 -0
index 0e3598e267..f9d952d685 100644
@@ -1064,6 +1064,7 @@ block_ss = ss.source_set()
 bsd_user_ss = ss.source_set()
 chardev_ss = ss.source_set()
 common_ss = ss.source_set()
+io_ss = ss.source_set()
 linux_user_ss = ss.source_set()
 qmp_ss = ss.source_set()
 softmmu_ss = ss.source_set()
@@ -1328,6 +1329,15 @@ qemu_syms = custom_target('qemu.syms', output: 'qemu.syms',
 # Library dependencies #
 ########################
 
+io_ss = io_ss.apply(config_host, strict: false)
+libio = static_library('io', io_ss.sources() + genh,
+                       dependencies: [io_ss.dependencies()],
+                       link_with: libqemuutil,
+                       name_suffix: 'fa',
+                       build_by_default: false)
+
+io = declare_dependency(link_whole: libio, dependencies: [crypto, qom])
+
 libmigration = static_library('migration', sources: migration_files + genh,
                               name_suffix: 'fa',
                               build_by_default: false)
io/meson.build +0 -10
index 768c1b5ec3..bcd8b1e737 100644
@@ -1,4 +1,3 @@
-io_ss = ss.source_set()
 io_ss.add(genh)
 io_ss.add(files(
   'channel-buffer.c',
@@ -14,12 +13,3 @@ io_ss.add(files(
   'net-listener.c',
   'task.c',
 ))
-
-io_ss = io_ss.apply(config_host, strict: false)
-libio = static_library('io', io_ss.sources() + genh,
-                       dependencies: [io_ss.dependencies()],
-                       link_with: libqemuutil,
-                       name_suffix: 'fa',
-                       build_by_default: false)
-
-io = declare_dependency(link_whole: libio, dependencies: [crypto, qom])
Signature · 1 line
2.26.2
#7 lore raw

PATCH v2 7/9 crypto: Move the creation of the library to the main meson.build

In reply to Philippe Mathieu-Daudé

Be consistent creating all the libraries in the main meson.build file.

---
 meson.build        | 10 ++++++++++
 crypto/meson.build | 10 ----------
 2 files changed, 10 insertions(+), 10 deletions(-)
meson.build +10 -0
index f9d952d685..d064d07dae 100644
@@ -1064,6 +1064,7 @@ block_ss = ss.source_set()
 bsd_user_ss = ss.source_set()
 chardev_ss = ss.source_set()
 common_ss = ss.source_set()
+crypto_ss = ss.source_set()
 io_ss = ss.source_set()
 linux_user_ss = ss.source_set()
 qmp_ss = ss.source_set()
@@ -1329,6 +1330,15 @@ qemu_syms = custom_target('qemu.syms', output: 'qemu.syms',
 # Library dependencies #
 ########################
 
+crypto_ss = crypto_ss.apply(config_host, strict: false)
+libcrypto = static_library('crypto', crypto_ss.sources() + genh,
+                           dependencies: [crypto_ss.dependencies()],
+                           name_suffix: 'fa',
+                           build_by_default: false)
+
+crypto = declare_dependency(link_whole: libcrypto,
+                            dependencies: [authz, qom])
+
 io_ss = io_ss.apply(config_host, strict: false)
 libio = static_library('io', io_ss.sources() + genh,
                        dependencies: [io_ss.dependencies()],
crypto/meson.build +0 -10
index f6f5ce1ecd..7f37b5d335 100644
@@ -1,4 +1,3 @@
-crypto_ss = ss.source_set()
 crypto_ss.add(genh)
 crypto_ss.add(files(
   'afsplit.c',
@@ -52,15 +51,6 @@ if 'CONFIG_GNUTLS' in config_host
 endif
 
 
-crypto_ss = crypto_ss.apply(config_host, strict: false)
-libcrypto = static_library('crypto', crypto_ss.sources() + genh,
-                           dependencies: [crypto_ss.dependencies()],
-                           name_suffix: 'fa',
-                           build_by_default: false)
-
-crypto = declare_dependency(link_whole: libcrypto,
-                            dependencies: [authz, qom])
-
 util_ss.add(files('aes.c'))
 util_ss.add(files('init.c'))
 
Signature · 1 line
2.26.2
#8 lore raw

PATCH v2 8/9 authz: Move the creation of the library to the main meson.build

In reply to Philippe Mathieu-Daudé

Be consistent creating all the libraries in the main meson.build file.

---
 meson.build       | 10 ++++++++++
 authz/meson.build | 10 ----------
 2 files changed, 10 insertions(+), 10 deletions(-)
meson.build +10 -0
index d064d07dae..73838d1d4f 100644
@@ -1059,6 +1059,7 @@ sphinx_extn_depends = [ meson.source_root() / 'docs/sphinx/depfile.py',
 
 # Collect sourcesets.
 
+authz_ss = ss.source_set()
 blockdev_ss = ss.source_set()
 block_ss = ss.source_set()
 bsd_user_ss = ss.source_set()
@@ -1330,6 +1331,15 @@ qemu_syms = custom_target('qemu.syms', output: 'qemu.syms',
 # Library dependencies #
 ########################
 
+authz_ss = authz_ss.apply(config_host, strict: false)
+libauthz = static_library('authz', authz_ss.sources() + genh,
+                          dependencies: [authz_ss.dependencies()],
+                          name_suffix: 'fa',
+                          build_by_default: false)
+
+authz = declare_dependency(link_whole: libauthz,
+                           dependencies: qom)
+
 crypto_ss = crypto_ss.apply(config_host, strict: false)
 libcrypto = static_library('crypto', crypto_ss.sources() + genh,
                            dependencies: [crypto_ss.dependencies()],
authz/meson.build +0 -10
index 516d71f2e2..88fa7769cb 100644
@@ -1,4 +1,3 @@
-authz_ss = ss.source_set()
 authz_ss.add(genh)
 authz_ss.add(files(
   'base.c',
@@ -8,12 +7,3 @@ authz_ss.add(files(
 ))
 
 authz_ss.add(when: ['CONFIG_AUTH_PAM', pam], if_true: files('pamacct.c'))
-
-authz_ss = authz_ss.apply(config_host, strict: false)
-libauthz = static_library('authz', authz_ss.sources() + genh,
-                          dependencies: [authz_ss.dependencies()],
-                          name_suffix: 'fa',
-                          build_by_default: false)
-
-authz = declare_dependency(link_whole: libauthz,
-                           dependencies: qom)
Signature · 1 line
2.26.2
#9 lore raw

PATCH v2 9/9 qom: Move the creation of the library to the main meson.build

In reply to Philippe Mathieu-Daudé

Be consistent creating all the libraries in the main meson.build file.

---
 meson.build     | 8 ++++++++
 qom/meson.build | 8 --------
 2 files changed, 8 insertions(+), 8 deletions(-)
meson.build +8 -0
index 73838d1d4f..72c8d3ad39 100644
@@ -1069,6 +1069,7 @@ crypto_ss = ss.source_set()
 io_ss = ss.source_set()
 linux_user_ss = ss.source_set()
 qmp_ss = ss.source_set()
+qom_ss = ss.source_set()
 softmmu_ss = ss.source_set()
 specific_fuzz_ss = ss.source_set()
 specific_ss = ss.source_set()
@@ -1331,6 +1332,13 @@ qemu_syms = custom_target('qemu.syms', output: 'qemu.syms',
 # Library dependencies #
 ########################
 
+qom_ss = qom_ss.apply(config_host, strict: false)
+libqom = static_library('qom', qom_ss.sources() + genh,
+                        dependencies: [qom_ss.dependencies()],
+                        name_suffix: 'fa')
+
+qom = declare_dependency(link_whole: libqom)
+
 authz_ss = authz_ss.apply(config_host, strict: false)
 libauthz = static_library('authz', authz_ss.sources() + genh,
                           dependencies: [authz_ss.dependencies()],
qom/meson.build +0 -8
index a1cd03c82c..062a3789d8 100644
@@ -1,4 +1,3 @@
-qom_ss = ss.source_set()
 qom_ss.add(genh)
 qom_ss.add(files(
   'container.c',
@@ -9,10 +8,3 @@ qom_ss.add(files(
 
 qmp_ss.add(files('qom-qmp-cmds.c'))
 softmmu_ss.add(files('qom-hmp-cmds.c'))
-
-qom_ss = qom_ss.apply(config_host, strict: false)
-libqom = static_library('qom', qom_ss.sources() + genh,
-                        dependencies: [qom_ss.dependencies()],
-                        name_suffix: 'fa')
-
-qom = declare_dependency(link_whole: libqom)
Signature · 1 line
2.26.2
#10 lore raw
In reply to Philippe Mathieu-Daudé
Patchew URL: https://patchew.org/QEMU/[email protected]/

Patchew URL: https://patchew.org/QEMU/[email protected]/

Hi,

This series seems to have some coding style problems. See output below for more information:

N/A. Internal error while reading log file

The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]

#12 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 25 lines · Philippe Mathieu-Daudé

Make Meson machinery more consistent, as requested by Paolo.

Since v1: addressed Paolo's review comments
- Drop migration RFC patch
- Move comment block

Series coded while listening to Brass Against songs:

https://www.youtube.com/channel/UClJMqrWQJ8OYWJ4ZdfqZdeQ

and available in the Git repository at:

https://gitlab.com/philmd/qemu.git branches/meson_libraries_consistency

Philippe Mathieu-Daudé (9):
meson.build: Add comments to clarify code organization meson.build: Sort sourcesets alphabetically
hw/core: Move the creation of the library to the main meson.build
chardev: Move the creation of the library to the main meson.build
migration: Move the creation of the library to the main meson.build
io: Move the creation of the library to the main meson.build
crypto: Move the creation of the library to the main meson.build
authz: Move the creation of the library to the main meson.build
qom: Move the creation of the library to the main meson.build

Quoted 10 lines
 meson.build           | 86 ++++++++++++++++++++++++++++++++++++++-----
 authz/meson.build     | 10 -----
 chardev/meson.build   |  6 ---
 crypto/meson.build    | 10 -----
 hw/core/meson.build   |  6 ---
 io/meson.build        | 10 -----
 migration/meson.build |  8 +---
 qom/meson.build       |  8 ----
 8 files changed, 77 insertions(+), 67 deletions(-)

Queued, thanks.

Paolo