@@ -17,3 +17,21 @@ else
endif
map_to_win_cmd = py3 + files('map_to_win.py')
sphinx_wrapper = py3 + files('call-sphinx-build.py')
+
+abi_check_version = get_option('abi_checks')
+check_abi = (abi_check_version != '')
+
+abi_dir = ''
+# If abi checks enabled setup abi dump directory
+if check_abi
+ message('ABI checks are being setup. This could take several minutes')
+ setup_run = run_command('abi-setup.py', '-t', abi_check_version, '-d', meson.source_root())
+ # Check if error returned from script
+ if setup_run.returncode() != 0
+ setup_err = setup_run.stderr().strip()
+ error('ABI checks setup script returned an error: ' + setup_err)
+ endif
+ abi_dir = setup_run.stdout().strip()
+endif
+abidiff = find_program('abidiff', required: check_abi)
+abignore = files('../devtools/libabigail.abignore')
@@ -47,6 +47,21 @@ else
dpdk_conf.set('RTE_VER_RELEASE', 99)
endif
+# abi checks cannot be run on windows
+if is_windows and check_abi
+ error('ABI checks cannot be run on windows')
+endif
+# abi checks can only be run on a debug build
+# meson <0.48 does not support get_option('debug')
+if meson.version().version_compare('>=0.48')
+ debug_enabled = get_option('debug')
+else
+ debug_enabled = get_option('buildtype').startswith('debug')
+endif
+if check_abi and not debug_enabled
+ error('Build type must have debug symbols when abi_checks are enabled')
+endif
+
pmd_subdir_opt = get_option('drivers_install_subdir')
if pmd_subdir_opt.contains('<VERSION>')
pmd_subdir_opt = abi_version.join(pmd_subdir_opt.split('<VERSION>'))
@@ -208,6 +208,20 @@ foreach subpath:subdirs
include_directories: includes,
dependencies: static_deps)
+ # If abidiff found, abi checks are enabled and the abi dump files for the library are available run abi check
+ dump_name = abi_dir+'/lib' + lib_name + '.dump'
+ if check_abi and run_command('[', '-f', dump_name, ']').returncode() == 0
+ custom_target('lib' + lib_name + '.abi_chk',
+ command: [abidiff, '--no-added-syms',
+ '--suppr', abignore,
+ '@INPUT@'],
+ input: [dump_name, shared_lib],
+ output: 'lib' + lib_name + '.abi_chk',
+ capture: true,
+ install: false,
+ build_by_default: true)
+ endif
+
dpdk_drivers += static_lib
set_variable('shared_@0@'.format(lib_name), shared_dep)
@@ -190,6 +190,20 @@ foreach l:libraries
include_directories: includes,
dependencies: shared_deps)
+ # If abidiff found, abi checks are enabled and the abi dump files for the library are available run abi check
+ dump_name = abi_dir+'/' + dir_name + '.dump'
+ if check_abi and run_command('[', '-f', dump_name, ']').returncode() == 0
+ custom_target(dir_name + '.abi_chk',
+ command: [abidiff, '--no-added-syms',
+ '--suppr', abignore,
+ '@INPUT@'],
+ input: [dump_name, shared_lib],
+ output: dir_name + '.abi_chk',
+ capture: true,
+ install: false,
+ build_by_default: true)
+ endif
+
dpdk_libraries = [shared_lib] + dpdk_libraries
dpdk_static_libraries = [static_lib] + dpdk_static_libraries
endif # sources.length() > 0
@@ -1,5 +1,7 @@
# Please keep these options sorted alphabetically.
+option('abi_checks', type: 'string', value: '',
+ description: 'Enable abi compatibility checks to run during the build. This requires debug build to be enabled. Input is latest or git tag e.g. v20.11')
option('armv8_crypto_dir', type: 'string', value: '',
description: 'path to the armv8_crypto library installation directory')
option('disable_drivers', type: 'string', value: '',