diff options
| author | Colin Guthrie <colin@mageia.org> | 2012-01-20 14:20:54 +0000 |
|---|---|---|
| committer | Colin Guthrie <colin@mageia.org> | 2012-01-20 14:20:54 +0000 |
| commit | 779c0ca043406c64761557f511d2a805ab5beb9e (patch) | |
| tree | 1f68054032de44120a122d3250d0cb6e9372b270 | |
| parent | 4fcee37cb92c689b43a0d8fc1d8e6b2764834cbf (diff) | |
modules: Better code for working out the dynamic module dir.
The current code used libdir from the pkgconfig file, but Debian
and Ubuntu do not put their modules inside this folder and thus it's
a bit flawed.
So take the static module dir and strip of the trailing parts that
might change with a new library version and make that tail end
dynamic. Should work on all platforms.
| -rw-r--r-- | configure.ac | 4 | ||||
| -rw-r--r-- | src/Makefile.am | 2 | ||||
| -rw-r--r-- | src/paprefs.cc | 24 |
3 files changed, 19 insertions, 11 deletions
diff --git a/configure.ac b/configure.ac index 9f4543b..69eea2f 100644 --- a/configure.ac +++ b/configure.ac @@ -43,8 +43,8 @@ AC_SUBST(GUILIBS_CFLAGS) AC_SUBST(GUILIBS_LIBS) PKG_CHECK_MODULES(LIBPULSE, libpulse) -LIBPULSE_MODLIBDIR=`pkg-config libpulse --variable libdir` -AC_SUBST(LIBPULSE_MODLIBDIR) +LIBPULSE_MODLIBEXECDIR=`pkg-config libpulse --variable modlibexecdir` +AC_SUBST(LIBPULSE_MODLIBEXECDIR) # If using GCC specifiy some additional parameters if test "x$GCC" = "xyes" ; then diff --git a/src/Makefile.am b/src/Makefile.am index bacfb1a..34f454f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -31,7 +31,7 @@ paprefs_SOURCES=paprefs.cc paprefs_LDADD=$(AM_LDADD) $(GUILIBS_LIBS) $(LIBPULSE_LIBS) paprefs_CXXFLAGS=$(AM_CXXFLAGS) $(GUILIBS_CFLAGS) $(LIBPULSE_CFLAGS) -paprefs_CXXFLAGS+=-DGLADE_FILE=\"$(gladedir)/paprefs.glade\" -DLOCALEDIR=\"$(localedir)\" -DMODLIBDIR=\""$(LIBPULSE_MODLIBDIR)/"\" -DSHREXT=\"$(SHREXT)\" +paprefs_CXXFLAGS+=-DGLADE_FILE=\"$(gladedir)/paprefs.glade\" -DLOCALEDIR=\"$(localedir)\" -DMODDIR=\""$(LIBPULSE_MODLIBEXECDIR)"\" -DSHREXT=\"$(SHREXT)\" EXTRA_DIST = $(glade_DATA) $(desktop_in_files) diff --git a/src/paprefs.cc b/src/paprefs.cc index 919b15c..9f3ad31 100644 --- a/src/paprefs.cc +++ b/src/paprefs.cc @@ -637,18 +637,26 @@ void MainWindow::readFromGConf() { } gchar * MainWindow::modulePath(const gchar *name) { - gchar *path, *pulsedir, *c, **versions; + gchar *path, *c, **versions; versions = g_strsplit(pa_get_library_version(), ".", 3); - if (versions[0] && versions[1]) - pulsedir = g_strdup_printf ("pulse-%s.%s", versions[0], versions[1]); - else - pulsedir = g_strdup_printf ("pulse-%d.%d", PA_MAJOR, PA_MINOR); + if (versions[0] && versions[1]) { + gchar *pulsedir, *search; + + /* Remove the "/pulse-x.y/modules" suffix so we can dynamically inject + * it again with runtime library version numbers */ + pulsedir = g_strdup_printf ("%s", MODDIR); + if ((search = g_strrstr (pulsedir, G_DIR_SEPARATOR_S))) { + *search = '\0'; + if ((search = g_strrstr (pulsedir, G_DIR_SEPARATOR_S))) + *search = '\0'; + } + path = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "pulse-%s.%s" G_DIR_SEPARATOR_S "modules" G_DIR_SEPARATOR_S "%s", pulsedir, versions[0], versions[1], name); + g_free (pulsedir); + } else + path = g_build_filename (MODDIR, name, NULL); g_strfreev(versions); - path = g_build_filename (MODLIBDIR, pulsedir, "modules", name, NULL); - g_free (pulsedir); - return path; } |
