[RFC,5/6] build: add lib abi checks to meson

Message ID 20191023010754.65172-6-kevin.laatz@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series Add ABI compatibility checks to the meson build |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Kevin Laatz Oct. 23, 2019, 1:07 a.m. UTC
  This patch adds the ABI compatibility check for the lib directory to the
meson build. If enabled, the ABI compatibility checks will run for all
.so's in the lib directory (provided a matching dump file exists). The
build will fail if an ABI incompatibility is detected.

Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 buildtools/meson.build |  4 ++++
 lib/meson.build        | 17 ++++++++++++++++-
 2 files changed, 20 insertions(+), 1 deletion(-)
  

Patch

diff --git a/buildtools/meson.build b/buildtools/meson.build
index 1ec2c2f95..a895c791c 100644
--- a/buildtools/meson.build
+++ b/buildtools/meson.build
@@ -7,6 +7,10 @@  pmdinfo = find_program('gen-pmdinfo-cfile.sh')
 
 check_experimental_syms = find_program('check-experimental-syms.sh')
 
+if get_option('abi_compat_checks')
+	abidiff = find_program('abidiff')
+endif
+
 # set up map-to-def script using python, either built-in or external
 python3 = import('python').find_installation(required: false)
 if python3.found()
diff --git a/lib/meson.build b/lib/meson.build
index 7849ac9f7..da180fb37 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -146,7 +146,9 @@  foreach l:libraries
 						version_map, '@INPUT@'],
 					capture: true,
 					input: static_lib,
-					output: name + '.exp_chk')
+					output: name + '.exp_chk',
+					install: false,
+					build_by_default: get_option('abi_compat_checks'))
 			endif
 
 			shared_lib = shared_library(libname,
@@ -164,6 +166,19 @@  foreach l:libraries
 					include_directories: includes,
 					dependencies: shared_deps)
 
+			if is_experimental == 0
+				custom_target(dir_name + '.abi_chk',
+					command: [abidiff,
+						meson.source_root() + '/lib/abi/'
+						+ dir_name + '.dump',
+						'@INPUT@'],
+					input: shared_lib,
+					output: dir_name + '.abi_chk',
+					capture: true,
+					install: false,
+					build_by_default: get_option('abi_compat_checks'))
+			endif
+
 			dpdk_libraries = [shared_lib] + dpdk_libraries
 			dpdk_static_libraries = [static_lib] + dpdk_static_libraries
 		endif # sources.length() > 0