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)
This commit is contained in:
Đoàn Trần Công Danh 2022-10-23 07:32:23 +07:00 committed by Đoàn Trần Công Danh
parent e02dc5110b
commit 3dcac23aff
1 changed files with 6 additions and 6 deletions

View File

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