Speex is an audio compression format designed specifically for speech. It is well-adapted to Internet applications and provides useful features that are not present in most other CODECs.
Speex download: https://downloads.xiph.org/releases/speex/speex-1.2.1.tar.gz
Speexdsp download: https://downloads.xiph.org/releases/speex/speexdsp-1.2.1.tar.gz
This package consists of two separate tarballs. They will be built one after the other.
When installing multiple packages in a script, the installation needs to be done as the root user. There are three general options that can be used to do this:
Run the entire script as the root user (not recommended).
Use the sudo command from the sudo package.
Use su -c "command arguments" (quotes required) which will ask for the root password for every iteration of the loop.
One way to handle this situation is to create a short bash function that automatically selects the appropriate method. Once the command is set in the environment, it does not need to be set again.
as_root()
{
if [ $EUID = 0 ]; then $*
elif [ -x /usr/bin/sudo ]; then sudo $*
else su -c \\"$*\\"
fi
}
export -f as_root
Start a subshell that will exit on error:
bash -e
Install Speex by running the following commands:
for package in speex-* speexdsp-*; do
packagedir=${package%.tar.?z*}
tar xf $package
pushd $packagedir
./configure --prefix=/usr \
--disable-static \
--docdir=/usr/share/doc/$packagedir
make
as_root make install
popd
rm -rf $packagedir
done
For multilib:
for package in speex-* speexdsp-*; do
packagedir=${package%.tar.?z*}
tar xf $package
pushd $packagedir
CC="gcc -m32" CXX="g++ -m32" \
PKG_CONFIG=/usr/bin/i686-pc-linux-gnu-pkg-config \
./configure --prefix=/usr \
--libdir=/usr/lib32 \
--host=i686-pc-linux-gnu \
--disable-static
make
make DESTDIR=$PWD/DESTDIR install
as_root cp -vR DESTDIR/usr/lib32/* /usr/lib32
as_root ldconfig
popd
rm -rf $packagedir
done
Exit out of the subshell that was started earlier:
exit
Run ./configure --help for a full list of options.
--disable-static: This
switch prevents installation of static versions of the libraries.