Files
debugcc/meson.build
Christopher Obbard 73b135d125 meson: add option to build debugcc as a dynamically linked binary
debugcc is currently linked statically using -static and -static-libgcc.
This can cause issues for distributions that prefer dynamically linked
binaries (e.g. larger binaries and duplicated runtime code which could
otherwise be shared).

Add a Meson boolean option `dynamic-linking` which when enabled removes
the explicit static link flags so that debugcc is built as a dynamically
linked binary using the default toolchain behaviour. The default for this
option is false so that existing builds continue to get a statically
linked binary unless they opt in to dynamic linking.

Signed-off-by: Christopher Obbard <christopher.obbard@linaro.org>
2025-12-05 11:46:19 +00:00

71 lines
1.3 KiB
Meson

# SPDX-License-Identifier: BSD-3-Clause
project('debugcc',
'c',
license: ['BSD-3-Clause'],
meson_version : '>= 0.61.0', # for install_symlink
default_options: [
'buildtype=release',
]
)
platforms = [
'ipq8064',
'msm8936',
'msm8974',
'msm8994',
'msm8996',
'msm8998',
'qcm2290',
'qcs404',
'sc7180',
'sc8280xp',
'sdm845',
'sm6115',
'sm6125',
'sm6350',
'sm6375',
'sm8150',
'sm8250',
'sm8350',
'sm8450',
'sm8550',
'sm8650',
]
debugcc_srcs = [
'debugcc.c',
]
platform_defs = []
platform_array = []
foreach p: platforms
debugcc_srcs += p + '.c'
platform_defs += 'extern struct debugcc_platform ' + p + '_debugcc;'
platform_array += '\t&' + p + '_debugcc,'
install_symlink(p + '-debugcc',
install_dir: get_option('bindir'),
pointing_to: 'debugcc')
endforeach
platforms = configuration_data()
platforms.set('PLATFORM_DEFS', '\n'.join(platform_defs))
platforms.set('PLATFORM_ARRAY', '\n'.join(platform_array))
debugcc_srcs += configure_file(
input: 'platforms.c.in',
output: 'platforms.c',
configuration: platforms)
debugcc_link_args = []
if not get_option('dynamic-linking')
debugcc_link_args += ['-static', '-static-libgcc']
endif
executable('debugcc',
debugcc_srcs,
link_args: debugcc_link_args,
install: true)