mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2024-12-12 10:04:14 +02:00
Generate -fmacro-prefix-map to strip relative path from __FILE__.
This provides reproducible builds and minimizes the file path in debug messages, just like an in-tree make build. For test source, prefix with test/ in case there are any module name collisions.
This commit is contained in:
parent
f863fc9888
commit
59f148bf6e
19
meson.build
19
meson.build
@ -112,6 +112,25 @@ if get_option('fatal-errors')
|
||||
add_project_arguments(cc.get_supported_arguments('-Wfatal-errors'), language: 'c')
|
||||
endif
|
||||
|
||||
####################################################################################################################################
|
||||
# Generate -fmacro-prefix-map so the relative path to the source directory is not included in the __FILE__ macro. This provides
|
||||
# reproducible builds and minimizes the file path in debug messages, just like an in-tree make build. For test source, prefix with
|
||||
# test/ in case there are any module name collisions.
|
||||
####################################################################################################################################
|
||||
file_prefix = run_command(
|
||||
[
|
||||
'python3',
|
||||
'-c',
|
||||
'import sys, os; print(os.path.relpath(sys.argv[1], sys.argv[2]))',
|
||||
meson.current_source_dir(),
|
||||
meson.current_build_dir(),
|
||||
],
|
||||
check: true,
|
||||
).stdout().strip()
|
||||
|
||||
add_project_arguments(cc.get_supported_arguments('-fmacro-prefix-map=@0@/src/=' . format(file_prefix)), language: 'c')
|
||||
add_project_arguments(cc.get_supported_arguments('-fmacro-prefix-map=@0@/test/src/=test/' . format(file_prefix)), language: 'c')
|
||||
|
||||
####################################################################################################################################
|
||||
# Build configuration
|
||||
####################################################################################################################################
|
||||
|
Loading…
Reference in New Issue
Block a user