build: add option to version libs using DPDK version
authorBruce Richardson <bruce.richardson@intel.com>
Thu, 31 Aug 2017 10:36:43 +0000 (11:36 +0100)
committerBruce Richardson <bruce.richardson@intel.com>
Tue, 30 Jan 2018 16:49:16 +0000 (17:49 +0100)
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>
Reviewed-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Keith Wiles <keith.wiles@intel.com>
Acked-by: Luca Boccassi <luca.boccassi@gmail.com>
drivers/meson.build
lib/librte_eal/bsdapp/eal/meson.build
lib/librte_eal/linuxapp/eal/meson.build
lib/meson.build
meson_options.txt

index b4abc32..ee3bb47 100644 (file)
@@ -97,6 +97,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(
@@ -110,7 +120,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)
 
index 2bd62dd..28ea4f3 100644 (file)
@@ -43,10 +43,20 @@ sources = ['eal_alarm.c',
 eal_extra_link_arg = '-lexecinfo'
 
 eal_inc += include_directories('../../../librte_compat')
+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
+
 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', '-DALLOW_EXPERIMENTAL_API'],
                        link_depends: version_map,
                        link_args: [eal_extra_link_arg,
index cb1b8fe..d4cdf3f 100644 (file)
@@ -48,10 +48,20 @@ 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
+
 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', '-DALLOW_EXPERIMENTAL_API'],
                        link_depends: version_map,
                        link_args: [eal_extra_link_arg,
index a4f5f28..0d4ec0d 100644 (file)
@@ -86,6 +86,15 @@ foreach l:libraries
                        cflags += '-DALLOW_EXPERIMENTAL_API'
                endif
 
+               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
@@ -97,7 +106,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),
index 9c45b81..636226c 100644 (file)
@@ -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')