build: add option to version libs using DPDK version

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>
This commit is contained in:
Bruce Richardson 2017-08-31 11:36:43 +01:00
parent 7dd34c71de
commit 7b67398e60
5 changed files with 46 additions and 4 deletions

View 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)

View 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,

View 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,

View 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),

View 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')