From 5abe9a96f9966613bd415cfcefe1a76d9291d5c8 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Tue, 22 Jan 2019 11:21:50 +0000 Subject: Bump minimum meson version to 0.47.1 and backport patches Fixes various bugs with Meson and dependencies parsing and generation. Change-Id: I2e7351e0954e16b1f4f928d2c09b653504fe8dc9 Signed-off-by: Luca Boccassi --- debian/control | 2 +- ...d-mention-march-in-pkg-config-description.patch | 20 +++ ...uild-bump-minimum-Meson-version-to-0.47.1.patch | 83 ++++++++++++ ...ld-use-dependency-instead-of-find_library.patch | 144 +++++++++++++++++++++ ...er-libraries-and-build-eal-before-cmdline.patch | 21 +++ ...ependency-for-libbsd-instead-of-manual-ap.patch | 36 ++++++ debian/patches/series | 5 + 7 files changed, 310 insertions(+), 1 deletion(-) create mode 100644 debian/patches/0003-build-mention-march-in-pkg-config-description.patch create mode 100644 debian/patches/0004-build-bump-minimum-Meson-version-to-0.47.1.patch create mode 100644 debian/patches/0005-build-use-dependency-instead-of-find_library.patch create mode 100644 debian/patches/0006-build-reorder-libraries-and-build-eal-before-cmdline.patch create mode 100644 debian/patches/0007-build-use-dependency-for-libbsd-instead-of-manual-ap.patch diff --git a/debian/control b/debian/control index 90d50ba1..8d130437 100644 --- a/debian/control +++ b/debian/control @@ -20,7 +20,7 @@ Build-Depends: debhelper (>= 10.3~), libnuma-dev, libpcap-dev, libssl-dev, - meson (>= 0.41~), + meson (>= 0.47.1~), pkg-config, python3, python3-sphinx , diff --git a/debian/patches/0003-build-mention-march-in-pkg-config-description.patch b/debian/patches/0003-build-mention-march-in-pkg-config-description.patch new file mode 100644 index 00000000..5b0af6fc --- /dev/null +++ b/debian/patches/0003-build-mention-march-in-pkg-config-description.patch @@ -0,0 +1,20 @@ +Author: Luca Boccassi +Description: mention -march in pkg-config description + Applications need to at least match DPDK's -march option to build + successfully due to some static inline functions in the public headers. + This might cause problems, especially in distributions, so add a note + in the pkg-config description. +Origin: https://patches.dpdk.org/patch/49629/ +--- a/meson.build ++++ b/meson.build +@@ -83,7 +83,9 @@ pkg.generate(name: meson.project_name(), + libraries: dpdk_libraries, + libraries_private: dpdk_drivers + dpdk_libraries + + ['-Wl,-Bdynamic'] + dpdk_extra_ldflags, +- description: 'The Data Plane Development Kit (DPDK)', ++ description: '''The Data Plane Development Kit (DPDK). ++Note that CFLAGS might contain an -march flag higher than typical baseline. ++This is required for a number of static inline functions in the public headers.''', + subdirs: [get_option('include_subdir_arch'), '.'], + extra_cflags: ['-include', 'rte_config.h'] + machine_args + ) diff --git a/debian/patches/0004-build-bump-minimum-Meson-version-to-0.47.1.patch b/debian/patches/0004-build-bump-minimum-Meson-version-to-0.47.1.patch new file mode 100644 index 00000000..89cc6c42 --- /dev/null +++ b/debian/patches/0004-build-bump-minimum-Meson-version-to-0.47.1.patch @@ -0,0 +1,83 @@ +Author: Luca Boccassi +Description: bump minimum Meson version to 0.47.1 + Meson 0.47.1 fixed a bug that is difficult to work around, which causes + the linker flag of dependencies to be repeated dozens of times, which + causes issues especially when using the built-in dependency() API. + Bump the minimum version and remove obsolete version checks. +Origin: https://patches.dpdk.org/patch/49995/ +--- a/drivers/meson.build ++++ b/drivers/meson.build +@@ -148,8 +148,5 @@ foreach class:driver_classes + endif # build + endforeach + +- if meson.version().version_compare('>=0.47') +- # prior to 0.47, set_variable can't take array params +- set_variable(class + '_drivers', class_drivers) +- endif ++ set_variable(class + '_drivers', class_drivers) + endforeach +--- a/kernel/linux/meson.build ++++ b/kernel/linux/meson.build +@@ -27,11 +27,7 @@ else + make_returncode = run_command('make', '-sC', kernel_dir, + 'kernelversion').returncode() + if make_returncode != 0 +- if meson.version().version_compare('>=0.44') +- warning(WARN_NO_HEADERS) +- else +- message('WARNING: ' + WARN_NO_HEADERS) +- endif ++ warning(WARN_NO_HEADERS) + else # returncode == 0 + + # DO ACTUAL MODULE BUILDING +--- a/meson.build ++++ b/meson.build +@@ -5,7 +5,7 @@ project('DPDK', 'C', + version: '18.11.0', + license: 'BSD', + default_options: ['buildtype=release', 'default_library=static'], +- meson_version: '>= 0.41' ++ meson_version: '>= 0.47.1' + ) + + # set up some global vars for compiler, platform, configuration, etc. +@@ -105,23 +105,18 @@ foreach lib:enabled_libs + endforeach + message(output_message + '\n') + +- +-# prior to 0.47 set_variable didn't work with arrays, so we can't +-# track driver lists easily +-if meson.version().version_compare('>=0.47') +- output_message = '\n===============\nDrivers Enabled\n===============\n' +- foreach class:driver_classes +- class_drivers = get_variable(class + '_drivers') +- output_message += '\n' + class + ':\n\t' +- output_count = 0 +- foreach drv:class_drivers +- output_message += drv + ', ' +- output_count += 1 +- if output_count == 8 +- output_message += '\n\t' +- output_count = 0 +- endif +- endforeach ++output_message = '\n===============\nDrivers Enabled\n===============\n' ++foreach class:driver_classes ++ class_drivers = get_variable(class + '_drivers') ++ output_message += '\n' + class + ':\n\t' ++ output_count = 0 ++ foreach drv:class_drivers ++ output_message += drv + ', ' ++ output_count += 1 ++ if output_count == 8 ++ output_message += '\n\t' ++ output_count = 0 ++ endif + endforeach +- message(output_message + '\n') +-endif ++endforeach ++message(output_message + '\n') diff --git a/debian/patches/0005-build-use-dependency-instead-of-find_library.patch b/debian/patches/0005-build-use-dependency-instead-of-find_library.patch new file mode 100644 index 00000000..12bc7cda --- /dev/null +++ b/debian/patches/0005-build-use-dependency-instead-of-find_library.patch @@ -0,0 +1,144 @@ +Author: Luca Boccassi +Description: use dependency() instead of find_library() + Whenever possible (if the library ships a pkg-config file) use meson's + dependency() function to look for it, as it will automatically add it + to the Requires.private list if needed, to allow for static builds to + succeed for reverse dependencies of DPDK. Otherwise the recursive + dependencies are not parsed, and users doing static builds have to + resolve them manually by themselves. + When using this API avoid additional checks that are superfluous and + take extra time, and avoid adding the linker flag manually which causes + it to be duplicated. +Origin: https://patches.dpdk.org/patch/49996/ +--- a/drivers/crypto/ccp/meson.build ++++ b/drivers/crypto/ccp/meson.build +@@ -18,4 +18,3 @@ sources = files('rte_ccp_pmd.c', + 'ccp_pmd_ops.c') + + ext_deps += dep +-pkgconfig_extra_libs += '-lcrypto' +--- a/drivers/crypto/openssl/meson.build ++++ b/drivers/crypto/openssl/meson.build +@@ -8,4 +8,3 @@ endif + deps += 'bus_vdev' + sources = files('rte_openssl_pmd.c', 'rte_openssl_pmd_ops.c') + ext_deps += dep +-pkgconfig_extra_libs += '-lcrypto' +--- a/drivers/crypto/qat/meson.build ++++ b/drivers/crypto/qat/meson.build +@@ -13,6 +13,5 @@ if dep.found() + 'qat_sym.c', + 'qat_sym_session.c') + qat_ext_deps += dep +- pkgconfig_extra_libs += '-lcrypto' + qat_cflags += '-DBUILD_QAT_SYM' + endif +--- a/drivers/meson.build ++++ b/drivers/meson.build +@@ -46,10 +46,11 @@ foreach class:driver_classes + # set up internal deps. Drivers can append/override as necessary + deps = std_deps + # ext_deps: Stores external library dependency got +- # using dependency() or cc.find_library(). For most cases, we +- # probably also need to specify the "-l" flags in +- # pkgconfig_extra_libs variable too, so that it can be reflected +- # in the pkgconfig output for static builds ++ # using dependency() (preferred) or find_library(). ++ # For the find_library() case (but not with dependency()) we also ++ # need to specify the "-l" flags in pkgconfig_extra_libs variable ++ # too, so that it can be reflected in the pkgconfig output for ++ # static builds. + ext_deps = [] + pkgconfig_extra_libs = [] + +--- a/drivers/net/bnx2x/meson.build ++++ b/drivers/net/bnx2x/meson.build +@@ -1,7 +1,7 @@ + # SPDX-License-Identifier: BSD-3-Clause + # Copyright(c) 2018 Intel Corporation + +-dep = cc.find_library('z', required: false) ++dep = dependency('zlib', required: false) + build = dep.found() + ext_deps += dep + cflags += '-DZLIB_CONST' +--- a/drivers/net/mlx4/meson.build ++++ b/drivers/net/mlx4/meson.build +@@ -14,9 +14,9 @@ if pmd_dlopen + ] + endif + libs = [ +- cc.find_library('mnl', required:false), +- cc.find_library('mlx4', required:false), +- cc.find_library('ibverbs', required:false), ++ dependency('libmnl', required:false), ++ dependency('libmlx4', required:false), ++ dependency('libibverbs', required:false), + ] + build = true + foreach lib:libs +--- a/drivers/net/mlx5/meson.build ++++ b/drivers/net/mlx5/meson.build +@@ -14,9 +14,9 @@ if pmd_dlopen + ] + endif + libs = [ +- cc.find_library('mnl', required:false), +- cc.find_library('mlx5', required:false), +- cc.find_library('ibverbs', required:false), ++ dependency('libmnl', required:false), ++ dependency('libmlx5', required:false), ++ dependency('libibverbs', required:false), + ] + build = true + foreach lib:libs +--- a/drivers/net/pcap/meson.build ++++ b/drivers/net/pcap/meson.build +@@ -1,12 +1,11 @@ + # SPDX-License-Identifier: BSD-3-Clause + # Copyright(c) 2017 Intel Corporation + +-pcap_dep = cc.find_library('pcap', required: false) +-if pcap_dep.found() and cc.has_header('pcap.h', dependencies: pcap_dep) ++pcap_dep = dependency('pcap', required: false) ++if pcap_dep.found() + build = true + else + build = false + endif + sources = files('rte_eth_pcap.c') + ext_deps += pcap_dep +-pkgconfig_extra_libs += '-lpcap' +--- a/lib/librte_bpf/meson.build ++++ b/lib/librte_bpf/meson.build +@@ -18,8 +18,8 @@ install_headers = files('bpf_def.h', + + deps += ['mbuf', 'net', 'ethdev'] + +-dep = cc.find_library('elf', required: false) +-if dep.found() == true and cc.has_header('libelf.h', dependencies: dep) ++dep = dependency('libelf', required: false) ++if dep.found() + sources += files('bpf_load_elf.c') + ext_deps += dep + endif +--- a/lib/librte_telemetry/meson.build ++++ b/lib/librte_telemetry/meson.build +@@ -6,7 +6,7 @@ headers = files('rte_telemetry.h', 'rte_ + deps += ['metrics', 'ethdev'] + cflags += '-DALLOW_EXPERIMENTAL_API' + +-jansson = cc.find_library('jansson', required: false) ++jansson = dependency('jansson', required: false) + if jansson.found() + ext_deps += jansson + dpdk_app_link_libraries += ['telemetry'] +--- a/drivers/compress/zlib/meson.build ++++ b/drivers/compress/zlib/meson.build +@@ -9,6 +9,5 @@ endif + deps += 'bus_vdev' + sources = files('zlib_pmd.c', 'zlib_pmd_ops.c') + ext_deps += dep +-pkgconfig_extra_libs += '-lz' + + allow_experimental_apis = true diff --git a/debian/patches/0006-build-reorder-libraries-and-build-eal-before-cmdline.patch b/debian/patches/0006-build-reorder-libraries-and-build-eal-before-cmdline.patch new file mode 100644 index 00000000..282ca019 --- /dev/null +++ b/debian/patches/0006-build-reorder-libraries-and-build-eal-before-cmdline.patch @@ -0,0 +1,21 @@ +Author: Luca Boccassi +Description: reorder libraries and build eal before cmdline + Most libraries and PMDs depend on eal, and eal depends only on kvargs, + so reorder the list in Meson to reflect this and take advantage of this + dependency chain. +Origin: https://patches.dpdk.org/patch/49997/ +--- a/lib/meson.build ++++ b/lib/meson.build +@@ -9,9 +9,10 @@ + # given as a dep, no need to mention ring. This is especially true for the + # core libs which are widely reused, so their deps are kept to a minimum. + libraries = [ 'compat', # just a header, used for versioning +- 'cmdline', # ethdev depends on cmdline for parsing functions + 'kvargs', # eal depends on kvargs +- 'eal', 'ring', 'mempool', 'mbuf', 'net', 'ethdev', 'pci', # core ++ 'eal', # everything depends on eal ++ 'cmdline', # ethdev depends on cmdline for parsing functions ++ 'ring', 'mempool', 'mbuf', 'net', 'ethdev', 'pci', # core + 'metrics', # bitrate/latency stats depends on this + 'hash', # efd depends on this + 'timer', # eventdev depends on this diff --git a/debian/patches/0007-build-use-dependency-for-libbsd-instead-of-manual-ap.patch b/debian/patches/0007-build-use-dependency-for-libbsd-instead-of-manual-ap.patch new file mode 100644 index 00000000..2da9bedd --- /dev/null +++ b/debian/patches/0007-build-use-dependency-for-libbsd-instead-of-manual-ap.patch @@ -0,0 +1,36 @@ +Author: Luca Boccassi +Description: use dependency() for libbsd instead of manual append to ldflags + Move libbsd inclusion to librte_eal, so that all other libraries and + PMDs will inherit it. +Origin: https://patches.dpdk.org/patch/49998/ +--- a/config/meson.build ++++ b/config/meson.build +@@ -74,11 +74,11 @@ if numa_dep.found() and cc.has_header('n + endif + + # check for strlcpy +-if host_machine.system() == 'linux' and cc.find_library('bsd', +- required: false).found() and cc.has_header('bsd/string.h') +- dpdk_conf.set('RTE_USE_LIBBSD', 1) +- add_project_link_arguments('-lbsd', language: 'c') +- dpdk_extra_ldflags += '-lbsd' ++if host_machine.system() == 'linux' ++ libbsd = dependency('libbsd', required: false) ++ if libbsd.found() ++ dpdk_conf.set('RTE_USE_LIBBSD', 1) ++ endif + endif + + # add -include rte_config to cflags +--- a/lib/librte_eal/meson.build ++++ b/lib/librte_eal/meson.build +@@ -25,6 +25,9 @@ version = 9 # the version of the EAL AP + allow_experimental_apis = true + deps += 'compat' + deps += 'kvargs' ++if dpdk_conf.has('RTE_USE_LIBBSD') ++ ext_deps += libbsd ++endif + sources = common_sources + env_sources + objs = common_objs + env_objs + headers = common_headers + env_headers diff --git a/debian/patches/series b/debian/patches/series index a673de8c..8b6c6fe5 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,2 +1,7 @@ 0001-doc-fix-garbage-text-in-generated-HTML-guides.patch 0002-build-use-generic-march-on-arm64-when-using-default.patch +0003-build-mention-march-in-pkg-config-description.patch +0004-build-bump-minimum-Meson-version-to-0.47.1.patch +0005-build-use-dependency-instead-of-find_library.patch +0006-build-reorder-libraries-and-build-eal-before-cmdline.patch +0007-build-use-dependency-for-libbsd-instead-of-manual-ap.patch -- cgit 1.2.3-korg