dpdk: Revert "prevent linking dpdk against libbsd"
[vpp.git] / build / external / patches / dpdk_20.08 / 0002-build-system-selective-libs.patch
1 diff --git a/app/meson.build b/app/meson.build
2 index eb74f215a..93affefa3 100644
3 --- a/app/meson.build
4 +++ b/app/meson.build
5 @@ -42,7 +42,17 @@ foreach app:apps
6  
7         subdir(name)
8  
9 -       if build
10 +       foreach d:deps
11 +               if dpdk_libs_disabled.contains(d)
12 +                       build = false
13 +                       reason = 'missing dependency, "@0@" '.format (d)
14 +               endif
15 +       endforeach
16 +
17 +       if not build
18 +               dpdk_apps_disabled += name
19 +               set_variable(name.underscorify() + '_disable_reason', reason)
20 +       else
21                 dep_objs = []
22                 foreach d:deps
23                         dep_objs += get_variable(get_option('default_library')
24 diff --git a/lib/meson.build b/lib/meson.build
25 index 3852c0156..76996544d 100644
26 --- a/lib/meson.build
27 +++ b/lib/meson.build
28 @@ -44,6 +44,8 @@ if is_windows
29         ] # only supported libraries for windows
30  endif
31  
32 +disabled_libs = get_option('disable_libs').split(',')
33 +
34  default_cflags = machine_args
35  default_cflags += ['-DALLOW_EXPERIMENTAL_API']
36  default_cflags += ['-DALLOW_INTERNAL_API']
37 @@ -78,6 +80,11 @@ foreach l:libraries
38         dir_name = 'librte_' + l
39         subdir(dir_name)
40  
41 +       if disabled_libs.contains(l)
42 +               build = false
43 +               reason = 'Explicitly disabled via build config'
44 +       endif
45 +
46         if build
47                 shared_deps = ext_deps
48                 static_deps = ext_deps
49 diff --git a/meson.build b/meson.build
50 index 61d9a4f5f..cf04f0e0e 100644
51 --- a/meson.build
52 +++ b/meson.build
53 @@ -21,6 +21,7 @@ dpdk_drivers = []
54  dpdk_extra_ldflags = []
55  dpdk_libs_disabled = []
56  dpdk_drvs_disabled = []
57 +dpdk_apps_disabled = []
58  abi_version_file = files('ABI_VERSION')
59  
60  if host_machine.cpu_family().startswith('x86')
61 @@ -106,6 +107,14 @@ foreach class:dpdk_driver_classes
62  endforeach
63  message(output_message + '\n')
64  
65 +output_message = '\n===============\nApplications Disabled\n===============\n'
66 +foreach app:dpdk_apps_disabled
67 +       reason = get_variable(app.underscorify() + '_disable_reason')
68 +       output_message += app + ':\t' + reason + '\n\t'
69 +endforeach
70 +
71 +message(output_message + '\n')
72 +
73  output_message = '\n=================\nContent Skipped\n=================\n'
74  output_message += '\nlibs:\n\t'
75  foreach lib:dpdk_libs_disabled
76 diff --git a/meson_options.txt b/meson_options.txt
77 index 9bf18ab6b..d1aa46b8d 100644
78 --- a/meson_options.txt
79 +++ b/meson_options.txt
80 @@ -4,6 +4,8 @@ option('armv8_crypto_dir', type: 'string', value: '',
81         description: 'path to the armv8_crypto library installation directory')
82  option('disable_drivers', type: 'string', value: '',
83         description: 'Comma-separated list of drivers to explicitly disable.')
84 +option('disable_libs', type: 'string', value: '',
85 +       description: 'Comma-separated list of libs to explicitly disable.')
86  option('drivers_install_subdir', type: 'string', value: 'dpdk/pmds-<VERSION>',
87         description: 'Subdirectory of libdir where to install PMDs. Defaults to using a versioned subdirectory.')
88  option('enable_docs', type: 'boolean', value: false,