QEMU-Devel Archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: philmd@linaro.org
Subject: [PATCH 1/4] meson: remove system/internal distinction for libfdt
Date: Tue,  7 May 2024 09:19:45 +0200	[thread overview]
Message-ID: <20240507071948.105022-2-pbonzini@redhat.com> (raw)
In-Reply-To: <20240507071948.105022-1-pbonzini@redhat.com>

Treat libfdt like slirp and the other dependencies that use --enable-download;
remove the ability to force usage of the subproject.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 meson.build                   | 69 +++++++++++++++--------------------
 meson_options.txt             |  6 +--
 scripts/meson-buildoptions.sh |  4 +-
 3 files changed, 34 insertions(+), 45 deletions(-)

diff --git a/meson.build b/meson.build
index 43da4923721..530f92c0a9c 100644
--- a/meson.build
+++ b/meson.build
@@ -1858,6 +1858,30 @@ if numa.found() and not cc.links('''
   endif
 endif
 
+fdt = not_found
+if get_option('fdt').disable_auto_if(not have_system).allowed()
+  fdt = cc.find_library('fdt', required: false)
+  if fdt.found()
+    if not cc.links('''
+      #include <libfdt.h>
+      #include <libfdt_env.h>
+      int main(void) { fdt_find_max_phandle(NULL, NULL); return 0; }''',
+        dependencies: fdt)
+      libfdt_proj = subproject('dtc', required: get_option('fdt'),
+                               default_options: ['tools=false',  'yaml=disabled',
+                                                 'python=disabled', 'default_library=static'])
+      fdt = libfdt_proj.get_variable('libfdt_dep')
+    endif
+    if not fdt.found()
+      if get_option('fdt').enabled()
+        error('libfdt found but too old (1.5.1 or newer required)')
+      else
+        warning('libfdt found but too old (1.5.1 or newer required)')
+      endif
+    endif
+  endif
+endif
+
 rdma = not_found
 if not get_option('rdma').auto() or have_system
   libumad = cc.find_library('ibumad', required: get_option('rdma'))
@@ -2199,6 +2223,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())
@@ -3120,6 +3145,10 @@ genh += custom_target('config-poison.h',
                       command: [find_program('scripts/make-config-poison.sh'),
                                 target_configs_h])
 
+if fdt_required.length() > 0 and not fdt.found()
+  error('fdt disabled but required by targets ' + ', '.join(fdt_required))
+endif
+
 ###############
 # Subprojects #
 ###############
@@ -3130,44 +3159,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')
@@ -4411,7 +4402,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}
 summary_info += {'libcap-ng support': libcap_ng}
 summary_info += {'bpf support':       libbpf}
 summary_info += {'rbd support':       rbd}
diff --git a/meson_options.txt b/meson_options.txt
index adc77bae0cd..90902c19d1c 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -308,9 +308,9 @@ option('vduse_blk_export', type: 'feature', value: 'auto',
 
 option('capstone', type: 'feature', value: 'auto',
        description: 'Whether and how to find the capstone library')
-option('fdt', type: 'combo', value: 'auto',
-       choices: ['disabled', 'enabled', 'auto', 'system', 'internal'],
-       description: 'Whether and how to find the libfdt library')
+option('fdt', type: 'feature', value: 'auto',
+       deprecated: { 'system': 'enabled' },
+       description: 'device tree support')
 
 option('selinux', type: 'feature', value: 'auto',
        description: 'SELinux support in qemu-nbd')
diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
index 0a29d35fdb6..d816b35a2f4 100644
--- a/scripts/meson-buildoptions.sh
+++ b/scripts/meson-buildoptions.sh
@@ -33,8 +33,6 @@ meson_options_help() {
   printf "%s\n" '  --enable-debug-stack-usage'
   printf "%s\n" '                           measure coroutine stack usage'
   printf "%s\n" '  --enable-debug-tcg       TCG debugging'
-  printf "%s\n" '  --enable-fdt[=CHOICE]    Whether and how to find the libfdt library'
-  printf "%s\n" '                           (choices: auto/disabled/enabled/internal/system)'
   printf "%s\n" '  --enable-fuzzing         build fuzzing targets'
   printf "%s\n" '  --enable-gcov            Enable coverage tracking.'
   printf "%s\n" '  --enable-lto             Use link time optimization'
@@ -113,6 +111,7 @@ meson_options_help() {
   printf "%s\n" '  dmg             dmg image format support'
   printf "%s\n" '  docs            Documentations build support'
   printf "%s\n" '  dsound          DirectSound sound support'
+  printf "%s\n" '  fdt             device tree support'
   printf "%s\n" '  fuse            FUSE block device export'
   printf "%s\n" '  fuse-lseek      SEEK_HOLE/SEEK_DATA support for FUSE exports'
   printf "%s\n" '  gcrypt          libgcrypt cryptography support'
@@ -310,7 +309,6 @@ _meson_option_parse() {
     --disable-dsound) printf "%s" -Ddsound=disabled ;;
     --enable-fdt) printf "%s" -Dfdt=enabled ;;
     --disable-fdt) printf "%s" -Dfdt=disabled ;;
-    --enable-fdt=*) quote_sh "-Dfdt=$2" ;;
     --enable-fuse) printf "%s" -Dfuse=enabled ;;
     --disable-fuse) printf "%s" -Dfuse=disabled ;;
     --enable-fuse-lseek) printf "%s" -Dfuse_lseek=enabled ;;
-- 
2.45.0



  reply	other threads:[~2024-05-07  7:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-07  7:19 [PATCH 0/4] express dependency of individual boards on libfdt Paolo Bonzini
2024-05-07  7:19 ` Paolo Bonzini [this message]
2024-05-07  7:40   ` [PATCH 1/4] meson: remove system/internal distinction for libfdt Philippe Mathieu-Daudé
2024-05-07  7:19 ` [PATCH 2/4] kconfig: express dependency of individual boards on libfdt Paolo Bonzini
2024-05-07  7:48   ` Philippe Mathieu-Daudé
2024-05-07 10:25     ` Paolo Bonzini
2024-05-07  7:19 ` [PATCH 3/4] hw/xtensa: require libfdt Paolo Bonzini
2024-05-07  7:34   ` Philippe Mathieu-Daudé
2024-05-07  7:19 ` [PATCH 4/4] configs: disable emulators that require it if libfdt is not found Paolo Bonzini
2024-05-07  7:51   ` Philippe Mathieu-Daudé

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=20240507071948.105022-2-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 read-only IMAP folder(s) and NNTP newsgroup(s).