Re: [pulseaudio-discuss] [PATCH] improve reproducibility build
(Hongxu Jia is not subscribed to the list, so I added him to Cc.) On Thu, 2018-12-06 at 14:17 +0500, Alexander E. Patrakov wrote: > Hongxu Jia : > > While running pulseaudio out of build dir (especially for cross > > compiling), we should not expose pulseaudio build path[1], it is > > helpful for reproducibility build[2]. > > > > As commit introduced [3cae4a0 doc: Add info about running pulseaudio > > from the build dir], run pulseaudio from the build dir, __OPTIMIZE__ > > should be diabled, so add macro checking to drop PA_SRCDIR/PA_BUILDDIR > > (in which contains build path) at precompilation. > > > > [1] https://reproducible-builds.org/docs/build-path/ > > [2] https://reproducible-builds.org/ > > > > Signed-off-by: Hongxu Jia > > I don't believe that the doc that you are basing your decisions on is > correct. Anyway, basing such decisions automagically on the > optimization level is very non-obvious. Maybe it is a better idea to > introduce a special build flag (for autotools it would be something > like --disable-running-from-build-tree or --enable-reproducible-build) > that explicitly disables running from build tree and thus enables a > reproducible build? Yes, adding a configure option with an associated define is much more clear and reliable than using __OPTIMIZE__. I think --disable-running- from-build-tree would be better than --enable-reproducible-build, because the latter promises that the build will be reproducible, while in reality there are reproducibility issues that aren't (at least yet) addressed (PA_CFLAGS definition is one example that can cause problems, and I wouldn't be surprised if there were other things too). -- Tanu https://www.patreon.com/tanuk https://liberapay.com/tanuk ___ pulseaudio-discuss mailing list pulseaudio-discuss@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] [PATCH] improve reproducibility build
Hongxu Jia : > > While running pulseaudio out of build dir (especially for cross > compiling), we should not expose pulseaudio build path[1], it is > helpful for reproducibility build[2]. > > As commit introduced [3cae4a0 doc: Add info about running pulseaudio > from the build dir], run pulseaudio from the build dir, __OPTIMIZE__ > should be diabled, so add macro checking to drop PA_SRCDIR/PA_BUILDDIR > (in which contains build path) at precompilation. > > [1] https://reproducible-builds.org/docs/build-path/ > [2] https://reproducible-builds.org/ > > Signed-off-by: Hongxu Jia I don't believe that the doc that you are basing your decisions on is correct. Anyway, basing such decisions automagically on the optimization level is very non-obvious. Maybe it is a better idea to introduce a special build flag (for autotools it would be something like --disable-running-from-build-tree or --enable-reproducible-build) that explicitly disables running from build tree and thus enables a reproducible build? -- Alexander E. Patrakov ___ pulseaudio-discuss mailing list pulseaudio-discuss@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] [PATCH] improve reproducibility build
While running pulseaudio out of build dir (especially for cross compiling), we should not expose pulseaudio build path[1], it is helpful for reproducibility build[2]. As commit introduced [3cae4a0 doc: Add info about running pulseaudio from the build dir], run pulseaudio from the build dir, __OPTIMIZE__ should be diabled, so add macro checking to drop PA_SRCDIR/PA_BUILDDIR (in which contains build path) at precompilation. [1] https://reproducible-builds.org/docs/build-path/ [2] https://reproducible-builds.org/ Signed-off-by: Hongxu Jia --- src/daemon/daemon-conf.c | 6 -- src/modules/alsa/alsa-mixer.c | 4 src/pulsecore/core-util.c | 4 +++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/daemon/daemon-conf.c b/src/daemon/daemon-conf.c index f956a55..ba3ab6e 100644 --- a/src/daemon/daemon-conf.c +++ b/src/daemon/daemon-conf.c @@ -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 +#if !defined(__OPTIMIZE__) 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 #if !defined(__OPTIMIZE__) c->dl_search_path = pa_xstrdup(PA_DLSEARCHPATH); -#endif +#endif // Endof #ifdef OS_IS_WIN32 return c; } diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c index 7d50fc7..e1f9361 100644 --- a/src/modules/alsa/alsa-mixer.c +++ b/src/modules/alsa/alsa-mixer.c @@ -2573,9 +2573,11 @@ static int path_verify(pa_alsa_path *p) { } static const char *get_default_paths_dir(void) { +#if defined(__linux__) && !defined(__OPTIMIZE__) if (pa_run_from_build_tree()) return PA_SRCDIR "/modules/alsa/mixer/paths/"; else +#endif return PA_ALSA_PATHS_DIR; } @@ -4458,7 +4460,9 @@ pa_alsa_profile_set* pa_alsa_profile_set_new(const char *fname, const pa_channel fname = "default.conf"; fn = pa_maybe_prefix_path(fname, +#if defined(__linux__) && !defined(__OPTIMIZE__) pa_run_from_build_tree() ? PA_SRCDIR "/modules/alsa/mixer/profile-sets/" : +#endif PA_ALSA_PROFILE_SETS_DIR); r = pa_config_parse(fn, NULL, items, NULL, false, ps); diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c index 367e767..b7d352b 100644 --- a/src/pulsecore/core-util.c +++ b/src/pulsecore/core-util.c @@ -3269,15 +3269,17 @@ void pa_reset_personality(void) { } bool pa_run_from_build_tree(void) { -char *rp; static bool b = false; +#if defined(__linux__) && !defined(__OPTIMIZE__) +char *rp; PA_ONCE_BEGIN { if ((rp = pa_readlink("/proc/self/exe"))) { b = pa_startswith(rp, PA_BUILDDIR); pa_xfree(rp); } } PA_ONCE_END; +#endif return b; } -- 2.7.4 ___ pulseaudio-discuss mailing list pulseaudio-discuss@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss