2 # SPDX-License-Identifier: BSD-3-Clause
3 # Copyright(c) 2020 Intel Corporation
5 # Script to fix flags for static linking in pkgconfig files from meson
6 # Should be called from meson build itself
12 if not f.startswith('-lrte_'):
14 return '-l:lib' + f[2:] + '.a'
17 def fix_libs_private(line):
18 if not line.startswith('Libs.private'):
20 ldflags = [fix_ldflag(flag) for flag in line.split()]
21 return ' '.join(ldflags) + '\n'
24 def process_pc_file(filepath):
25 print('Processing', filepath)
26 with open(filepath) as src:
27 lines = src.readlines()
28 with open(filepath, 'w') as dst:
29 dst.writelines([fix_libs_private(line) for line in lines])
32 if 'MESON_BUILD_ROOT' not in os.environ:
33 print('This script must be called from a meson build environment')
35 for root, dirs, files in os.walk(os.environ['MESON_BUILD_ROOT']):
36 pc_files = [f for f in files if f.endswith('.pc')]
38 process_pc_file(os.path.join(root, f))