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

Message ID 20170901100416.80264-17-bruce.richardson@intel.com (mailing list archive)
State Superseded, archived
Headers

Checks

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

Commit Message

Bruce Richardson Sept. 1, 2017, 10:04 a.m. UTC
  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 | 8 +++++++-
 lib/meson.build     | 8 +++++++-
 meson_options.txt   | 1 +
 3 files changed, 15 insertions(+), 2 deletions(-)
  

Comments

Neil Horman Sept. 7, 2017, 5:07 p.m. UTC | #1
On Fri, Sep 01, 2017 at 11:04:15AM +0100, Bruce Richardson wrote:
> 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 | 8 +++++++-
>  lib/meson.build     | 8 +++++++-
>  meson_options.txt   | 1 +
>  3 files changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/meson.build b/drivers/meson.build
> index d7a614f83..76d610a5b 100644
> --- a/drivers/meson.build
> +++ b/drivers/meson.build
> @@ -92,6 +92,12 @@ foreach class:driver_classes
>  						depends: [pmdinfogen, tmp_lib])
>  			endforeach
>  
> +			if get_option('per_library_versions')
> +				so_version = '@0@.1'.format(version)
> +			else
> +				so_version = meson.project_version()
> +			endif
> +

I'm not sure this is a good idea.  If we default to using the defined project
version number, we commit to, by default incrementing the library version number
on each release, even if the ABI hasn't changed, which means that the purpose of
versioning (creating compatibility between library releases), is rendered
useless.

Neil
  
Bruce Richardson Sept. 8, 2017, 8:58 a.m. UTC | #2
On Thu, Sep 07, 2017 at 01:07:19PM -0400, Neil Horman wrote:
> On Fri, Sep 01, 2017 at 11:04:15AM +0100, Bruce Richardson wrote:
> > 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 | 8 +++++++- lib/meson.build     | 8 +++++++-
> > meson_options.txt   | 1 + 3 files changed, 15 insertions(+), 2
> > deletions(-)
> > 
> > diff --git a/drivers/meson.build b/drivers/meson.build index
> > d7a614f83..76d610a5b 100644 --- a/drivers/meson.build +++
> > b/drivers/meson.build @@ -92,6 +92,12 @@ foreach
> > class:driver_classes depends: [pmdinfogen, tmp_lib]) endforeach
> >  
> > +			if get_option('per_library_versions') +
> > so_version = '@0@.1'.format(version) +			else +
> > so_version = meson.project_version() +			endif +
> 
> I'm not sure this is a good idea.  If we default to using the defined
> project version number, we commit to, by default incrementing the
> library version number on each release, even if the ABI hasn't
> changed, which means that the purpose of versioning (creating
> compatibility between library releases), is rendered useless.
>
Yes, I agree on the compatibility, so the default for this option is to
have individual .so versions, as right now. This option itself was added
at the request of some distros [1][2], who wanted to just use a single
version number across all DPDK.

/Bruce

[1] http://dpdk.org/ml/archives/dev/2017-August/072969.html
[2] http://dpdk.org/ml/archives/dev/2017-August/072976.html
  

Patch

diff --git a/drivers/meson.build b/drivers/meson.build
index d7a614f83..76d610a5b 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -92,6 +92,12 @@  foreach class:driver_classes
 						depends: [pmdinfogen, tmp_lib])
 			endforeach
 
+			if get_option('per_library_versions')
+				so_version = '@0@.1'.format(version)
+			else
+				so_version = meson.project_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 +111,7 @@  foreach class:driver_classes
 				c_args: cflags,
 				link_args: '-Wl,--version-script=' + version_map,
 				link_depends: version_map,
-				version: '@0@.1'.format(version),
+				version: so_version,
 				install: true,
 				install_dir: driver_install_path)
 
diff --git a/lib/meson.build b/lib/meson.build
index b8c4304de..e20a9ab59 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -76,6 +76,12 @@  foreach l:libraries
 			dep_objs += [get_variable('dep_rte_' + d)]
 		endforeach
 
+		if get_option('per_library_versions')
+			so_version = '@0@.1'.format(version)
+		else
+			so_version = meson.project_version()
+		endif
+
 		version_map = '@0@/@1@/rte_@2@_version.map'.format(
 				meson.current_source_dir(), dir_name, name)
 		libname = 'rte_' + name
@@ -87,7 +93,7 @@  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: 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')