From bb056174146ae01448e0281ea204d2ddd60ebe3c Mon Sep 17 00:00:00 2001 From: Manuel Stoeckl Date: Tue, 16 Jul 2019 13:04:27 -0400 Subject: Use -fmacro-prefix-map to strip build path This commit matches sway's 2dc4978d8af326c310057ca8fd22a4c7f5d09335. To help ensure a reproducible build (when debug info is disabled), the meson build script now uses the -fmacro-prefix-map command line argument supported by GCC to strip the build-path dependent bytes of each __FILE__ string used by wlr_log and related functions. A rather ugly algorithm is used to compute the relative path between the build and source folders, because meson has no specific function for this. When the compiler does not support -fmacro-prefix-map, fall back to shifting the start of each __FILE__ string by the length of the relative path to the source directory. --- util/log.c | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'util/log.c') diff --git a/util/log.c b/util/log.c index 2f4ed86d..25629e05 100644 --- a/util/log.c +++ b/util/log.c @@ -81,23 +81,6 @@ void _wlr_log(enum wlr_log_importance verbosity, const char *fmt, ...) { va_end(args); } -// strips the path prefix from filepath -// will try to strip WLR_SRC_DIR as well as a relative src dir -// e.g. '/src/build/wlroots/backend/wayland/backend.c' and -// '../backend/wayland/backend.c' will both be stripped to -// 'backend/wayland/backend.c' -const char *_wlr_strip_path(const char *filepath) { - static int srclen = sizeof(WLR_SRC_DIR); - if (strstr(filepath, WLR_SRC_DIR) == filepath) { - filepath += srclen; - } else if (*filepath == '.') { - while (*filepath == '.' || *filepath == '/') { - ++filepath; - } - } - return filepath; -} - enum wlr_log_importance wlr_log_get_verbosity(void) { return log_importance; } -- cgit v1.2.3