Browse Source

play-audio: Fix shared library clash

The play-audio binary links to libOpenSLES, which links indirectly
to libskia. As libskia links to both libpng and libjpeg this means
problems if either of those libraries are installed from a Termux
package into LD_LIBRARY_PATH.

Avoid this by placing the play-audio binary into libexec/, and let
bin/play-audio be a wrapper script which resets LD_LIBRARY_PATH
before calling the binary in libexec/. Fixes #103.
android-5
Fredrik Fornwall 9 years ago
parent
commit
433f51009f
  1. 8
      packages/play-audio/build.sh

8
packages/play-audio/build.sh

@ -1,12 +1,16 @@
TERMUX_PKG_HOMEPAGE=http://termux.com
TERMUX_PKG_DESCRIPTION="Simple commandline audio player for Android"
TERMUX_PKG_VERSION=0.2
TERMUX_PKG_VERSION=0.3
termux_step_make_install () {
local LIBEXEC_BINARY=$TERMUX_PREFIX/libexec/play-audio
$CXX $CFLAGS $LDFLAGS \
-std=c++14 -Wall -Wextra -pedantic -Werror \
-lOpenSLES \
$TERMUX_PKG_BUILDER_DIR/play-audio.cpp -o $TERMUX_PREFIX/bin/play-audio
$TERMUX_PKG_BUILDER_DIR/play-audio.cpp -o $LIBEXEC_BINARY
printf "#!/bin/sh\n\n# Avoid linker errors due to libOpenSLES.so:\nLD_LIBRARY_PATH= exec $LIBEXEC_BINARY \$@\n" > $TERMUX_PREFIX/bin/play-audio
chmod +x $TERMUX_PREFIX/bin/play-audio
mkdir -p $TERMUX_PREFIX/share/man/man1/
cp $TERMUX_PKG_BUILDER_DIR/play-audio.1 $TERMUX_PREFIX/share/man/man1/

Loading…
Cancel
Save