void-packages/common/environment/configure/debug-debug-prefix-map.sh
Đoàn Trần Công Danh 3dcac23aff environment: set -ffile-prefix-map
We're setting -fdebug-prefix-map to strip directory prefixes from debug
info, which will help ccache and reproducibility.

However, -fdebug-prefix-map doesn't help with those macros like __FILE__
and __BASE_FILE__, which needs another flags: -fmacro-prefix-map.

Replaces -fdebug-prefix-map with -ffile-prefix-map which is an alias for
both `-fdebug-prefix-map` and `-fmacro-prefix-map`. (This flag is
available since GCC 8 and Clang 10)
2023-01-05 08:23:26 +07:00

16 lines
529 B
Bash

local _wrksrc="$wrksrc${build_wrksrc:+/$build_wrksrc}"
case "$build_style" in
cmake)
CFLAGS="${CFLAGS} -ffile-prefix-map=$_wrksrc/${cmake_builddir:-build}=."
CXXFLAGS="${CXXFLAGS} -ffile-prefix-map=$_wrksrc/${cmake_builddir:-build}=."
;;
meson)
CFLAGS="${CFLAGS} -ffile-prefix-map=$_wrksrc/${meson_builddir:-build}=."
CXXFLAGS="${CXXFLAGS} -ffile-prefix-map=$_wrksrc/${meson_builddir:-build}=."
;;
*)
CFLAGS="${CFLAGS} -ffile-prefix-map=$_wrksrc=."
CXXFLAGS="${CXXFLAGS} -ffile-prefix-map=$_wrksrc=."
esac
unset _wrksrc