2017-12-18 15:56:25 +00:00
|
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
2019-04-02 03:54:58 +00:00
|
|
|
# Copyright(c) 2017-2019 Intel Corporation
|
|
|
|
|
net/mlx: workaround static linkage with meson
If ibverbs_link is static and the application choose to link DPDK
as static libraries, both PMD and ibverbs libraries must be linked
as static libraries. And the dependencies of ibverbs (netlink) must
still be linked as shared libraries.
Unfortunately, meson forget about the static requirement for ibverbs
when generating the .pc file.
As a result, libibverbs, libmlx4, libmlx5 are listed in Requires.private
section (allowing to be linked as shared libraries) and libnl is missing.
A fix is in progress for meson, but anyway we will have to live without
such a fix until a better version of meson is widely available:
https://github.com/mesonbuild/meson/pull/6393
In order to avoid meson suggesting shared libraries in the section
Requires.private of the .pc file, the dependency object is recreated
with declare_dependency():
- cflags are extracted the libibverbs.pc
- ldflags, from libibverbs.pc, are processed to force
static flavor of ibverbs libraries, thanks to this syntax:
-l:libfoo.a
Fixes: 6affeabaf321 ("net/mlx: add static ibverbs linkage with meson")
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
2020-02-12 22:07:06 +00:00
|
|
|
pkgconf = find_program('pkg-config', 'pkgconf', required: false)
|
2020-04-25 10:56:17 +00:00
|
|
|
check_symbols = find_program('check-symbols.sh')
|
net/mlx: workaround static linkage with meson
If ibverbs_link is static and the application choose to link DPDK
as static libraries, both PMD and ibverbs libraries must be linked
as static libraries. And the dependencies of ibverbs (netlink) must
still be linked as shared libraries.
Unfortunately, meson forget about the static requirement for ibverbs
when generating the .pc file.
As a result, libibverbs, libmlx4, libmlx5 are listed in Requires.private
section (allowing to be linked as shared libraries) and libnl is missing.
A fix is in progress for meson, but anyway we will have to live without
such a fix until a better version of meson is widely available:
https://github.com/mesonbuild/meson/pull/6393
In order to avoid meson suggesting shared libraries in the section
Requires.private of the .pc file, the dependency object is recreated
with declare_dependency():
- cflags are extracted the libibverbs.pc
- ldflags, from libibverbs.pc, are processed to force
static flavor of ibverbs libraries, thanks to this syntax:
-l:libfoo.a
Fixes: 6affeabaf321 ("net/mlx: add static ibverbs linkage with meson")
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
2020-02-12 22:07:06 +00:00
|
|
|
ldflags_ibverbs_static = find_program('options-ibverbs-static.sh')
|
2021-11-12 21:48:25 +00:00
|
|
|
objdump = find_program('objdump', 'llvm-objdump')
|
2019-10-08 14:36:27 +00:00
|
|
|
|
2019-04-12 08:29:00 +00:00
|
|
|
python3 = import('python').find_installation(required: false)
|
|
|
|
if python3.found()
|
2021-04-20 10:22:23 +00:00
|
|
|
py3 = [python3]
|
2019-04-12 08:29:00 +00:00
|
|
|
else
|
2021-04-20 10:22:23 +00:00
|
|
|
py3 = ['meson', 'runpython']
|
2019-04-12 08:29:00 +00:00
|
|
|
endif
|
2021-06-30 16:22:35 +00:00
|
|
|
echo = py3 + ['-c', 'import sys; print(*sys.argv[1:])']
|
2021-05-07 11:54:04 +00:00
|
|
|
list_dir_globs = py3 + files('list-dir-globs.py')
|
2020-06-29 12:37:41 +00:00
|
|
|
map_to_win_cmd = py3 + files('map_to_win.py')
|
2020-01-10 21:52:04 +00:00
|
|
|
sphinx_wrapper = py3 + files('call-sphinx-build.py')
|
2021-08-17 10:45:56 +00:00
|
|
|
get_cpu_count_cmd = py3 + files('get-cpu-count.py')
|
|
|
|
get_numa_count_cmd = py3 + files('get-numa-count.py')
|
2021-11-12 21:48:25 +00:00
|
|
|
binutils_avx512_check = (py3 + files('binutils-avx512-check.py') +
|
|
|
|
[objdump] + cc.cmd_array())
|
2021-01-08 02:47:20 +00:00
|
|
|
|
2021-01-08 02:47:22 +00:00
|
|
|
# select library and object file format
|
2021-01-25 22:12:50 +00:00
|
|
|
pmdinfo = py3 + files('gen-pmdinfo-cfile.py') + [meson.current_build_dir()]
|
2021-01-24 20:51:56 +00:00
|
|
|
pmdinfogen = py3 + files('pmdinfogen.py')
|
2021-01-08 02:47:20 +00:00
|
|
|
if host_machine.system() == 'windows'
|
2021-04-20 10:22:23 +00:00
|
|
|
if cc.get_id() == 'gcc'
|
|
|
|
pmdinfo += 'ar'
|
|
|
|
else
|
|
|
|
pmdinfo += 'llvm-ar'
|
|
|
|
endif
|
|
|
|
pmdinfogen += 'coff'
|
2022-02-14 11:43:13 +00:00
|
|
|
elif host_machine.system() == 'freebsd'
|
|
|
|
pmdinfo += 'llvm-ar'
|
|
|
|
pmdinfogen += 'elf'
|
2021-01-08 02:47:20 +00:00
|
|
|
else
|
2021-04-20 10:22:23 +00:00
|
|
|
pmdinfo += 'ar'
|
|
|
|
pmdinfogen += 'elf'
|
2021-01-08 02:47:20 +00:00
|
|
|
endif
|
2021-01-24 20:51:56 +00:00
|
|
|
|
|
|
|
# TODO: starting from Meson 0.51.0 use
|
2021-04-20 10:22:23 +00:00
|
|
|
# python3 = import('python').find_installation('python',
|
|
|
|
# modules : python3_required_modules)
|
2021-01-24 20:51:56 +00:00
|
|
|
python3_required_modules = []
|
|
|
|
if host_machine.system() != 'windows'
|
2021-04-20 10:22:23 +00:00
|
|
|
python3_required_modules = ['elftools']
|
2021-01-24 20:51:56 +00:00
|
|
|
endif
|
|
|
|
foreach module : python3_required_modules
|
2021-04-20 10:22:23 +00:00
|
|
|
script = 'import importlib.util; import sys; exit(importlib.util.find_spec("@0@") is None)'
|
2022-01-20 18:06:39 +00:00
|
|
|
if run_command(py3, '-c', script.format(module), check: false).returncode() != 0
|
2021-04-20 10:22:23 +00:00
|
|
|
error('missing python module: @0@'.format(module))
|
|
|
|
endif
|
2021-01-24 20:51:56 +00:00
|
|
|
endforeach
|