[PATCH] padsp: allow overriding library install location

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The current build script hardcodes the $pkglibdir in the padsp command.
This works and is a reasonable default. However, distributions that
know where they install, can override this path and thus make padsp
work for any architecture that has the library installed by using the
following configure argument:

   --with-pulsedsp-location='/usr/\\$$LIB/pulseaudio'

This works because ld.so considers $LIB a variable that will expand to
several location paths, depending on the architecture of the binary
being executed.

In debian, for example, this would work for libpulsedsp.so installed in
/usr/lib/x86_64-linux-gnu/ for amd64 and /usr/lib/i386-linux-gnu/ for
i386, with a single padsp command.

---

The idea is that pulseaudio-utils package can provide the padsp command, and
the dsp wrapper for multiple architecture can be co-installed. Then the loader
does the job of picking which library to use according to the running program's
architecture.

---
 configure.ac       | 8 ++++++++
 src/Makefile.am    | 2 +-
 src/utils/padsp.in | 4 ++--
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 809e705..3e473fd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -759,6 +759,9 @@ AC_ARG_ENABLE([oss-output],
 AC_ARG_ENABLE([oss-wrapper],
     AS_HELP_STRING([--disable-oss-wrapper],[Disable optional OSS wrapper support]))
 
+AC_ARG_WITH([pulsedsp-location],
+    AS_HELP_STRING([--with-pulsedsp-location],[Specify location where OSS wrapper will be installed]))
+
 AS_IF([test "x$enable_oss_output" != "xno" -o "x$enable_oss_wrapper" != "xno"],
     [AC_CHECK_HEADERS([sys/soundcard.h], HAVE_OSS=1, HAVE_OSS=0)],
     HAVE_OSS=0)
@@ -774,7 +777,12 @@ AS_IF([test "x$enable_oss_wrapper" != "xno"],
     [AS_IF([test "x$HAVE_OSS" = "x1"], HAVE_OSS_WRAPPER=1, HAVE_OSS_WRAPPER=0)],
     HAVE_OSS_WRAPPER=0)
 
+AS_IF([test "x$with_pulsedsp_location" != "x"],
+    [PULSEDSP_LOCATION="$with_pulsedsp_location"],
+    [PULSEDSP_LOCATION="\$(pkglibdir)"])
+
 AC_SUBST(HAVE_OSS_OUTPUT)
+AC_SUBST(PULSEDSP_LOCATION)
 AM_CONDITIONAL([HAVE_OSS_OUTPUT], [test "x$HAVE_OSS_OUTPUT" = "x1"])
 AM_CONDITIONAL([HAVE_OSS_WRAPPER], [test "x$HAVE_OSS_WRAPPER" = "x1"])
 AS_IF([test "x$HAVE_OSS_OUTPUT" = "x1"], AC_DEFINE([HAVE_OSS_OUTPUT], 1, [Have OSS output?]))
diff --git a/src/Makefile.am b/src/Makefile.am
index 2d5bdd4..ca702c1 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -922,7 +922,7 @@ padsplib_LTLIBRARIES = libpulsedsp.la
 bin_SCRIPTS += padsp
 
 edit = @SED@ \
-       -e "s|@pkglibdir[@]|$(pkglibdir)|g"
+       -e 's|@PULSEDSP_LOCATION[@]|$(PULSEDSP_LOCATION)|g'
 
 padsp: utils/padsp.in
 	$(edit) $< > $@
diff --git a/src/utils/padsp.in b/src/utils/padsp.in
index 3430a65..fea00d2 100644
--- a/src/utils/padsp.in
+++ b/src/utils/padsp.in
@@ -74,9 +74,9 @@ done
 shift $(( $OPTIND - 1 ))
 
 if [ x"$LD_PRELOAD" = x ] ; then
-   LD_PRELOAD="@pkglibdir@/libpulsedsp.so"
+   LD_PRELOAD="@PULSEDSP_LOCATION@/libpulsedsp.so"
 else
-   LD_PRELOAD="$LD_PRELOAD @pkglibdir@/libpulsedsp.so"
+   LD_PRELOAD="$LD_PRELOAD @PULSEDSP_LOCATION@/libpulsedsp.so"
 fi
 
 export LD_PRELOAD
-- 
2.10.2



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux