[dpdk-dev,v3,16/17] build: add option to version libs using DPDK version

Message ID 20170913141222.253688-17-bruce.richardson@intel.com
State Accepted, archived
Delegated to: Bruce Richardson
Headers show

Checks

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

Commit Message

Bruce Richardson Sept. 13, 2017, 2:12 p.m.
Normally, each library has it's own version number based on the ABI.
Add an option to have all libs just use the DPDK version number as the
.so version.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/meson.build                     | 13 ++++++++++++-
 lib/librte_eal/bsdapp/eal/meson.build   | 12 +++++++++++-
 lib/librte_eal/linuxapp/eal/meson.build | 12 +++++++++++-
 lib/meson.build                         | 12 +++++++++++-
 meson_options.txt                       |  1 +
 5 files changed, 46 insertions(+), 4 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/meson.build b/drivers/meson.build
index f19da16fb..3ea42b04b 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -92,6 +92,16 @@  foreach class:driver_classes
 						depends: [pmdinfogen, tmp_lib])
 			endforeach
 
+			if get_option('per_library_versions')
+				lib_version = '@0@.1'.format(version)
+				so_version = '@0@'.format(version)
+			else
+				pver = meson.project_version().split('.')
+				lib_version = '@0@.@1@'.format(pver.get(0),
+						pver.get(1))
+				so_version = lib_version
+			endif
+
 			# now build the driver itself, and add to the drivers list
 			lib_name = driver_name_fmt.format(name)
 			version_map = '@0@/@1@/@2@_version.map'.format(
@@ -105,7 +115,8 @@  foreach class:driver_classes
 				c_args: cflags,
 				link_args: '-Wl,--version-script=' + version_map,
 				link_depends: version_map,
-				version: '@0@.1'.format(version),
+				version: lib_version,
+				soversion: so_version,
 				install: true,
 				install_dir: driver_install_path)
 
diff --git a/lib/librte_eal/bsdapp/eal/meson.build b/lib/librte_eal/bsdapp/eal/meson.build
index 00973122a..f6c43fd44 100644
--- a/lib/librte_eal/bsdapp/eal/meson.build
+++ b/lib/librte_eal/bsdapp/eal/meson.build
@@ -46,11 +46,21 @@  sources = ['eal_alarm.c',
 
 eal_extra_link_arg = '-lexecinfo'
 
+if get_option('per_library_versions')
+	lib_version = '@0@.1'.format(version)
+	so_version = '@0@'.format(version)
+else
+	pver = meson.project_version().split('.')
+	lib_version = '@0@.@1@'.format(pver.get(0), pver.get(1))
+	so_version = lib_version
+endif
+
 version_map = join_paths(meson.current_source_dir(), 'rte_eal_version.map')
 eal_lib = library('rte_eal', sources, eal_common_sources, eal_common_arch_sources,
 			dependencies: dependency('threads'),
 			include_directories : eal_inc,
-			version: '@0@.1'.format(version),
+			version: lib_version,
+			soversion: so_version,
 			c_args: '-D_GNU_SOURCE',
 			link_depends: version_map,
 			link_args: [eal_extra_link_arg,
diff --git a/lib/librte_eal/linuxapp/eal/meson.build b/lib/librte_eal/linuxapp/eal/meson.build
index e7daed499..bffbd7e66 100644
--- a/lib/librte_eal/linuxapp/eal/meson.build
+++ b/lib/librte_eal/linuxapp/eal/meson.build
@@ -51,11 +51,21 @@  sources = ['eal_alarm.c',
 
 eal_extra_link_arg = '-ldl'
 
+if get_option('per_library_versions')
+	lib_version = '@0@.1'.format(version)
+	so_version = '@0@'.format(version)
+else
+	pver = meson.project_version().split('.')
+	lib_version = '@0@.@1@'.format(pver.get(0), pver.get(1))
+	so_version = lib_version
+endif
+
 version_map = join_paths(meson.current_source_dir(), 'rte_eal_version.map')
 eal_lib = library('rte_eal', sources, eal_common_sources, eal_common_arch_sources,
 			dependencies: dependency('threads'),
 			include_directories : eal_inc,
-			version: '@0@.1'.format(version),
+			version: lib_version,
+			soversion: so_version,
 			c_args: '-D_GNU_SOURCE',
 			link_depends: version_map,
 			link_args: [eal_extra_link_arg,
diff --git a/lib/meson.build b/lib/meson.build
index d814721de..5244fe4a5 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -76,6 +76,15 @@  foreach l:libraries
 			dep_objs += [get_variable('dep_rte_' + d)]
 		endforeach
 
+		if get_option('per_library_versions')
+			lib_version = '@0@.1'.format(version)
+			so_version = '@0@'.format(version)
+		else
+			pver = meson.project_version().split('.')
+			lib_version = '@0@.@1@'.format(pver.get(0), pver.get(1))
+			so_version = lib_version
+		endif
+
 		version_map = '@0@/@1@/rte_@2@_version.map'.format(
 				meson.current_source_dir(), dir_name, name)
 		libname = 'rte_' + name
@@ -87,7 +96,8 @@  foreach l:libraries
 				include_directories: include_directories(dir_name),
 				link_args: '-Wl,--version-script=' + version_map,
 				link_depends: version_map,
-				version: '@0@.1'.format(version),
+				version: lib_version,
+				soversion: so_version,
 				install: true)
 		dep = declare_dependency(link_with: lib,
 				include_directories: include_directories(dir_name),
diff --git a/meson_options.txt b/meson_options.txt
index 9c45b8159..636226ce8 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -6,3 +6,4 @@  option('allow_invalid_socket_id', type: 'boolean', value: false,
 	description: 'allow out-of-range NUMA socket id\'s for platforms that don\'t report the value correctly')
 option('enable_kmods', type: 'boolean', value: true, description: 'build kernel modules')
 option('kernel_dir', type: 'string', value: '', description: 'path to the kernel for building kernel modules')
+option('per_library_versions', type: 'boolean', value: true, description: 'true: each lib gets its own version number, false: DPDK version used for each lib')