[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 23/27] meson: move libfdt together with other dependencies
From: |
Paolo Bonzini |
Subject: |
[PULL 23/27] meson: move libfdt together with other dependencies |
Date: |
Sun, 12 May 2024 12:49:41 +0200 |
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.
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
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 ab1f44b25c2..dd4a28f8f8f 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())
@@ -3024,14 +3053,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']}
@@ -3119,6 +3150,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 #
###############
@@ -3129,44 +3164,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')
@@ -4417,7 +4414,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
- [PULL 14/27] xen: initialize legacy backends from xen_bus_init(), (continued)
- [PULL 14/27] xen: initialize legacy backends from xen_bus_init(), Paolo Bonzini, 2024/05/12
- [PULL 15/27] xen: register legacy backends via xen_backend_init, Paolo Bonzini, 2024/05/12
- [PULL 13/27] tests/qtest: s390x: fix operation in a build without any boards or devices, Paolo Bonzini, 2024/05/12
- [PULL 19/27] hw/i386: move rtc-reset-reinjection command out of hw/rtc, Paolo Bonzini, 2024/05/12
- [PULL 17/27] i386: pc: remove unnecessary MachineClass overrides, Paolo Bonzini, 2024/05/12
- [PULL 18/27] hw/i386: split x86.c in multiple parts, Paolo Bonzini, 2024/05/12
- [PULL 08/27] sh4: select correct components for no-board build, Paolo Bonzini, 2024/05/12
- [PULL 16/27] i386: correctly select code in hw/i386 that depends on other components, Paolo Bonzini, 2024/05/12
- [PULL 20/27] i386: select correct components for no-board build, Paolo Bonzini, 2024/05/12
- [PULL 21/27] tests/qtest: arm: fix operation in a build without any boards or devices, Paolo Bonzini, 2024/05/12
- [PULL 23/27] meson: move libfdt together with other dependencies,
Paolo Bonzini <=
- [PULL 22/27] meson: pick libfdt from common_ss when building target-specific files, Paolo Bonzini, 2024/05/12
- [PULL 25/27] kconfig: express dependency of individual boards on libfdt, Paolo Bonzini, 2024/05/12
- [PULL 27/27] configs: disable emulators that require it if libfdt is not found, Paolo Bonzini, 2024/05/12
- [PULL 24/27] kconfig: allow compiling out QEMU device tree code per target, Paolo Bonzini, 2024/05/12
- [PULL 26/27] hw/xtensa: require libfdt, Paolo Bonzini, 2024/05/12
- [PULL 01/27] target/i386: remove PCOMMIT from TCG, deprecate property, Paolo Bonzini, 2024/05/12
- Re: [PULL 00/27] Build/arch cleanups, target/i386 fixes for 2024-05-10, Richard Henderson, 2024/05/14