build-sys: introduce a special build flag to explicitly disables running from build tree

It is helpful to improve reproducibility build [1] since
PA_SRCDIR/PA_BUILDDIR contains build path,
--disable-running-from-build-tree could drop these macros at
precompilation.

[1] https://reproducible-builds.org/

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
This commit is contained in:
Hongxu Jia 2018-12-07 15:48:49 +08:00 committed by Tanu Kaskinen
parent bae8c16bfa
commit 3d9deb1e56
7 changed files with 29 additions and 5 deletions

View file

@ -155,16 +155,18 @@ pa_daemon_conf *pa_daemon_conf_new(void) {
c->dl_search_path = pa_sprintf_malloc("%s" PA_PATH_SEP "lib" PA_PATH_SEP "pulse-%d.%d" PA_PATH_SEP "modules",
pa_win32_get_toplevel(NULL), PA_MAJOR, PA_MINOR);
#else
#ifdef HAVE_RUNNING_FROM_BUILD_TREE
if (pa_run_from_build_tree()) {
pa_log_notice("Detected that we are run from the build tree, fixing search path.");
#ifdef MESON_BUILD
c->dl_search_path = pa_xstrdup(PA_BUILDDIR PA_PATH_SEP "src" PA_PATH_SEP "modules");
#else
c->dl_search_path = pa_xstrdup(PA_BUILDDIR);
#endif
#endif // Endof #ifdef MESON_BUILD
} else
#endif // Endof #ifdef HAVE_RUNNING_FROM_BUILD_TREE
c->dl_search_path = pa_xstrdup(PA_DLSEARCHPATH);
#endif
#endif // Endof #ifdef OS_IS_WIN32
return c;
}

View file

@ -941,6 +941,12 @@ int main(int argc, char *argv[]) {
pa_log_debug("Running in VM: %s", pa_yes_no(pa_running_in_vm()));
#ifdef HAVE_RUNNING_FROM_BUILD_TREE
pa_log_debug("Running from build tree: %s", pa_yes_no(pa_run_from_build_tree()));
#else
pa_log_debug("Running from build tree: no");
#endif
#ifdef __OPTIMIZE__
pa_log_debug("Optimized build: yes");
#else