blob: e4651b986ac28791fedfa1f3f62ef21138848813 [file] [log] [blame]
#!/bin/bash
set -e
INSTALL_CMD=install-strip
if [[ $# -gt 0 ]]; then
INSTALL_CMD=$1
fi
OPUS_CFLAGS='-O2 -march=armv6k -mtune=arm1136j-s'
OPUS_LDFLAGS='-O2'
OPUS=opus-1.1
OPUS_SOURCE=$OPUS.tar.gz
OPUS_TOOLS=opus-tools-0.1.9
OPUS_TOOLS_SOURCE=$OPUS_TOOLS.tar.gz
source ../../a5s_linux_sdk/ambarella/build/env/CodeSourcery.env
PATH=$PATH:$ARM_LINUX_TOOLCHAIN_DIR/bin
TOP=`pwd`
rm -rf dist
mkdir dist
rm -rf build
mkdir build
# BUILD OPUS
cd build
tar zxfv ../$OPUS_SOURCE
cd $OPUS
./configure --enable-fixed-point \
--host=arm-none-linux-gnueabi \
-prefix=$TOP/dist \
CFLAGS="$OPUS_CFLAGS" \
LDFLAGS="$OPUS_LDFLAGS"
make V=1
make $INSTALL_CMD
cd ../..
# BUILD OPUS-TOOLS
cd build
tar zxfv ../$OPUS_TOOLS_SOURCE
cd $OPUS_TOOLS
(
PKG_CONFIG_LIBDIR=$TOP/dist/lib/pkgconfig
PKG_CONFIG_PATH=$TOP/../speex/dist/lib/pkgconfig
# Check if ogg is installed
if pkg-config --exists ogg; then
echo "libogg found! Starting opus-tools build"
./configure \
--host=arm-none-linux-gnueabi \
-prefix=$TOP/dist \
--without-flac \
--with-ogg=$TOP/../speex/dist \
--with-opus=$TOP/dist \
CFLAGS="$OPUS_CFLAGS" \
LDFLAGS="$OPUS_LDFLAGS"
make V=1
make $INSTALL_CMD
else
echo "libogg not found; to build opus-tools, first build speex package for libogg"
fi
)
cd ../..
# CLEANUP
rm -rf fakeroot
mkdir -p fakeroot/usr/lib
cp -d dist/lib/libopus.so* fakeroot/usr/lib/
tar cjfv opus.tar.bz2 fakeroot
cp opus.tar.bz2 ../../a5s_linux_sdk/ambarella/boards/dropcam/rootfs
rm -rf build_dist
mkdir build_dist
cp -d -r dist/include build_dist/
cp -d -r dist/lib build_dist/
tar cjfv opus-build-dist.tar.bz2 build_dist/*