On Fri, Nov 25, 2016 at 11:28 AM, Albert Astals Cid <[email protected]> wrote: > On Thu, Nov 24, 2016 at 9:51 PM, Tanu Kaskinen <[email protected]> wrote: >> On Wed, 2016-11-23 at 17:10 +0100, Albert Astals Cid wrote: >>> Helps making pulseaudio relocatable >> >> Could you provide more information in the commit message about what use >> case requires pulseaudio to be relocatable? > > In this particular case is making pulseaudio part of a snap file [1] > > But it seems somehow the problem we were having has been solved in a > different way by a colleague, i need to find out what he did and if we > still want to pursue this patch approach or not.
Ok, so no there was no solution, just that i was using the tooling wrong and it was picking up a library i had built somewhere else with a hardcoded path in it ^_^ So i've updated the patch to be just one environment variable named PULSE_DATA_PATH What do you think? Cheers, Albert > > Cheers, > Albert > > [1] http://snapcraft.io/ > >> >> The existing convention for environment variable names is to use >> "PULSE_" as the prefix, and I think this patch should use the same >> convention. >> >> I think it would be better to add an environment variable for the data >> directory (/usr/share/pulseaudio). If and when we install more things >> to the data directory in the future, we would have to create more >> environment variables just to keep the relocation support working if >> each thing in the data directory needs a separate environment variable. >> >> -- >> Tanu >> >> https://www.patreon.com/tanuk >> _______________________________________________ >> pulseaudio-discuss mailing list >> [email protected] >> https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
commit 5621ce4ecc63c289a99ec09cddd8088fa65db726 Author: Albert Astals Cid <[email protected]> Date: Wed Nov 23 17:03:41 2016 +0100 Add env var for data dir Helps making pulseaudio relocatable, i.e. having the code and data in a different root path than the one that was decided on compilation time diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c index 3dbf6b1..da5b657 100644 --- a/src/modules/alsa/alsa-mixer.c +++ b/src/modules/alsa/alsa-mixer.c @@ -2507,8 +2507,17 @@ static int path_verify(pa_alsa_path *p) { static const char *get_default_paths_dir(void) { if (pa_run_from_build_tree()) return PA_SRCDIR "/modules/alsa/mixer/paths/"; - else - return PA_ALSA_PATHS_DIR; + else { + static const char *paths_dir = NULL; + if (!paths_dir) { + paths_dir = getenv("PULSE_DATA_PATH"); + if (!paths_dir) + paths_dir = PA_ALSA_PATHS_DIR; + else + paths_dir = pa_sprintf_malloc("%s/alsa-mixer/paths", paths_dir); + } + return paths_dir; + } } pa_alsa_path* pa_alsa_path_new(const char *paths_dir, const char *fname, pa_alsa_direction_t direction) { @@ -4333,6 +4342,23 @@ void pa_alsa_decibel_fix_dump(pa_alsa_decibel_fix *db_fix) { pa_xfree(db_values); } +static const char *alsa_profile_sets_dir() { + if (pa_run_from_build_tree()) + return PA_SRCDIR "/modules/alsa/mixer/profile-sets/"; + else { + static const char *profile_sets_dir = NULL; + if (!profile_sets_dir) { + profile_sets_dir = getenv("PULSE_DATA_PATH"); + if (!profile_sets_dir) + profile_sets_dir = PA_ALSA_PROFILE_SETS_DIR; + else + profile_sets_dir = pa_sprintf_malloc("%s/alsa-mixer/profile-sets", profile_sets_dir); + + } + return profile_sets_dir; + } +} + pa_alsa_profile_set* pa_alsa_profile_set_new(const char *fname, const pa_channel_map *bonus) { pa_alsa_profile_set *ps; pa_alsa_profile *p; @@ -4383,9 +4409,7 @@ pa_alsa_profile_set* pa_alsa_profile_set_new(const char *fname, const pa_channel if (!fname) fname = "default.conf"; - fn = pa_maybe_prefix_path(fname, - pa_run_from_build_tree() ? PA_SRCDIR "/modules/alsa/mixer/profile-sets/" : - PA_ALSA_PROFILE_SETS_DIR); + fn = pa_maybe_prefix_path(fname, alsa_profile_sets_dir()); r = pa_config_parse(fn, NULL, items, NULL, false, ps); pa_xfree(fn);
_______________________________________________ pulseaudio-discuss mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
