From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: philmd@linaro.org
Subject: [PATCH 2/6] meson: move libfdt together with other dependencies
Date: Wed, 8 May 2024 09:51:01 +0200 [thread overview]
Message-ID: <20240508075105.15510-3-pbonzini@redhat.com> (raw)
In-Reply-To: <20240508075105.15510-1-pbonzini@redhat.com>
Move the libfdt detection code together with other dependencies instead
of keeping it with subprojects. This has the disadvantage of performing
the detection even if no target requires libfdt; but it has the advantage
that Kconfig will be able to observe the availability of the library.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
meson.build | 79 ++++++++++++++++++++++++++---------------------------
1 file changed, 38 insertions(+), 41 deletions(-)
diff --git a/meson.build b/meson.build
index 7ca0ba4987f..2e7e2b15406 100644
--- a/meson.build
+++ b/meson.build
@@ -1858,6 +1858,34 @@ if numa.found() and not cc.links('''
endif
endif
+fdt = not_found
+fdt_opt = get_option('fdt')
+if fdt_opt == 'enabled' and get_option('wrap_mode') == 'nodownload'
+ fdt_opt = 'system'
+endif
+if fdt_opt in ['enabled', 'system'] or (fdt_opt == 'auto' and have_system)
+ fdt = cc.find_library('fdt', required: fdt_opt == 'system')
+ if fdt.found() and cc.links('''
+ #include <libfdt.h>
+ #include <libfdt_env.h>
+ int main(void) { fdt_find_max_phandle(NULL, NULL); return 0; }''',
+ dependencies: fdt)
+ fdt_opt = 'system'
+ elif fdt_opt != 'system'
+ fdt_opt = get_option('wrap_mode') == 'nodownload' ? 'disabled' : 'internal'
+ fdt = not_found
+ else
+ error('system libfdt is too old (1.5.1 or newer required)')
+ endif
+endif
+if fdt_opt == 'internal'
+ assert(not fdt.found())
+ libfdt_proj = subproject('dtc', required: true,
+ default_options: ['tools=false', 'yaml=disabled',
+ 'python=disabled', 'default_library=static'])
+ fdt = libfdt_proj.get_variable('libfdt_dep')
+endif
+
rdma = not_found
if not get_option('rdma').auto() or have_system
libumad = cc.find_library('ibumad', required: get_option('rdma'))
@@ -2199,6 +2227,7 @@ config_host_data.set('CONFIG_BSD', host_os in bsd_oses)
config_host_data.set('CONFIG_CAPSTONE', capstone.found())
config_host_data.set('CONFIG_COCOA', cocoa.found())
config_host_data.set('CONFIG_DARWIN', host_os == 'darwin')
+config_host_data.set('CONFIG_FDT', fdt.found())
config_host_data.set('CONFIG_FUZZ', get_option('fuzzing'))
config_host_data.set('CONFIG_GCOV', get_option('b_coverage'))
config_host_data.set('CONFIG_LIBUDEV', libudev.found())
@@ -3025,14 +3054,16 @@ foreach target : target_dirs
error('No accelerator available for target @0@'.format(target))
endif
- actual_target_dirs += target
config_target += keyval.load('configs/targets' / target + '.mak')
config_target += { 'TARGET_' + config_target['TARGET_ARCH'].to_upper(): 'y' }
- if 'TARGET_NEED_FDT' in config_target
+ if 'TARGET_NEED_FDT' in config_target and not fdt.found()
fdt_required += target
+ continue
endif
+ actual_target_dirs += target
+
# Add default keys
if 'TARGET_BASE_ARCH' not in config_target
config_target += {'TARGET_BASE_ARCH': config_target['TARGET_ARCH']}
@@ -3120,6 +3151,10 @@ genh += custom_target('config-poison.h',
command: [find_program('scripts/make-config-poison.sh'),
target_configs_h])
+if fdt_required.length() > 0
+ error('fdt disabled but required by targets ' + ', '.join(fdt_required))
+endif
+
###############
# Subprojects #
###############
@@ -3130,44 +3165,6 @@ if have_system and vfio_user_server_allowed
libvfio_user_dep = libvfio_user_proj.get_variable('libvfio_user_dep')
endif
-fdt = not_found
-fdt_opt = get_option('fdt')
-if fdt_required.length() > 0 or fdt_opt == 'enabled'
- if fdt_opt == 'disabled'
- error('fdt disabled but required by targets ' + ', '.join(fdt_required))
- endif
-
- if fdt_opt in ['enabled', 'auto', 'system']
- if get_option('wrap_mode') == 'nodownload'
- fdt_opt = 'system'
- endif
- fdt = cc.find_library('fdt', required: fdt_opt == 'system')
- if fdt.found() and cc.links('''
- #include <libfdt.h>
- #include <libfdt_env.h>
- int main(void) { fdt_find_max_phandle(NULL, NULL); return 0; }''',
- dependencies: fdt)
- fdt_opt = 'system'
- elif fdt_opt == 'system'
- error('system libfdt requested, but it is too old (1.5.1 or newer required)')
- else
- fdt_opt = 'internal'
- fdt = not_found
- endif
- endif
- if not fdt.found()
- assert(fdt_opt == 'internal')
- libfdt_proj = subproject('dtc', required: true,
- default_options: ['tools=false', 'yaml=disabled',
- 'python=disabled', 'default_library=static'])
- fdt = libfdt_proj.get_variable('libfdt_dep')
- endif
-else
- fdt_opt = 'disabled'
-endif
-
-config_host_data.set('CONFIG_FDT', fdt.found())
-
vhost_user = not_found
if host_os == 'linux' and have_vhost_user
libvhost_user = subproject('libvhost-user')
@@ -4419,7 +4416,7 @@ summary_info += {'Linux AIO support': libaio}
summary_info += {'Linux io_uring support': linux_io_uring}
summary_info += {'ATTR/XATTR support': libattr}
summary_info += {'RDMA support': rdma}
-summary_info += {'fdt support': fdt_opt == 'disabled' ? false : fdt_opt}
+summary_info += {'fdt support': fdt_opt == 'internal' ? 'internal' : fdt}
summary_info += {'libcap-ng support': libcap_ng}
summary_info += {'bpf support': libbpf}
summary_info += {'rbd support': rbd}
--
2.45.0
next prev parent reply other threads:[~2024-05-08 7:52 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-08 7:50 [PATCH v2 0/6] kconfig: express dependency of individual boards on libfdt Paolo Bonzini
2024-05-08 7:51 ` [PATCH 1/6] meson: pick libfdt from common_ss when building target-specific files Paolo Bonzini
2024-05-08 8:24 ` Philippe Mathieu-Daudé
2024-05-08 7:51 ` Paolo Bonzini [this message]
2024-05-08 8:21 ` [PATCH 2/6] meson: move libfdt together with other dependencies Philippe Mathieu-Daudé
2024-05-08 7:51 ` [PATCH 3/6] kconfig: allow compiling out QEMU device tree code per target Paolo Bonzini
2024-05-08 7:51 ` [PATCH 4/6] kconfig: express dependency of individual boards on libfdt Paolo Bonzini
2024-05-08 7:51 ` [PATCH 5/6] hw/xtensa: require libfdt Paolo Bonzini
2024-05-08 7:51 ` [PATCH 6/6] configs: disable emulators that require it if libfdt is not found Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240508075105.15510-3-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).