blob: 5e96cb9d137ace656ce34b443e8abf92e6647c2c [file] [log] [blame] [edit]
#!/bin/bash
set -e
INCLUDE_GATTOOL="N"
CONFIGURE_GATTOOL_OPT="--disable-client"
READLINE_INC=""
READLINE_LIB=""
if [[ "$#" -eq 1 && $1 == "GPLv3" ]]; then
INCLUDE_GATTOOL="Y"
CONFIGURE_GATTOOL_OPT="--enable-client"
READLINE_INC="-I$TOP/../readline/dist/usr/include"
READLINE_LIB="-L$TOP/../readline/dist/usr/lib"
echo "GPLv3 specified. Including gattool in the build."
fi
source ../../a5s_linux_sdk/ambarella/build/env/CodeSourcery.env
PATH=$PATH:$ARM_LINUX_TOOLCHAIN_DIR/bin
TOP=`pwd`
rm -rf dist
mkdir dist
pushd bluez
./configure --prefix=/usr --sysconfdir=/etc \
--localstatedir=/var \
--libexecdir=/lib \
--disable-systemd --disable-obex --disable-cups --disable-udev --enable-experimental \
--host=arm-none-linux-gnueabi \
--enable-library \
CFLAGS="-mtune=arm1136j-s -march=armv6 -Os $READLINE_INC" \
DBUS_CFLAGS="-I$TOP/../dbus/dist/include/dbus-1.0 -I$TOP/../dbus/dist/lib/dbus-1.0/include" \
GLIB_CFLAGS="-I$TOP/../glib/dist/usr/include/glib-2.0 -I$TOP/../glib/dist/usr/lib/glib-2.0/include" \
LDFLAGS="-Os -L$TOP/dist/usr/lib -L$TOP/../../a5s_linux_sdk/ambarella/prebuild/third-party/ncurses/lib -ltinfo $READLINE_LIB" \
DBUS_LIBS="-L$TOP/../dbus/dist/lib -ldbus-1" \
GLIB_LIBS="-L$TOP/../glib/dist/usr/lib -lglib-2.0" \
UDEV_CFLAGS="-I$TOP/../../a5s_linux_sdk/ambarella/prebuild/third-party/udev/include" \
UDEV_LIBS="-L$TOP/../../a5s_linux_sdk/ambarella/prebuild/third-party/udev/lib" \
--with-dbusconfdir=/etc/dbus-1 \
--with-dbussystembusdir=/etc/dbus-1/system.d \
--with-dbussessionbusdir=/etc/dbus-1/session.d \
$CONFIGURE_GATTOOL_OPT
make install-strip DESTDIR=$TOP/dist
if [[ $INCLUDE_GATTOOL == "Y" ]]; then
cp attrib/gatttool $TOP/dist/usr/bin/
arm-none-linux-gnueabi-strip $TOP/dist/usr/bin/gatttool
fi
mkdir -p $TOP/dist/etc/bluetooth
install -v -m644 src/main.conf $TOP/dist/etc/bluetooth/main.conf
install -v -m644 profiles/input/input.conf $TOP/dist/etc/bluetooth/input.conf
install -v -m644 profiles/proximity/proximity.conf $TOP/dist/etc/bluetooth/proximity.conf
install -v -m644 profiles/network/network.conf $TOP/dist/etc/bluetooth/network.conf
popd
mv $TOP/dist/etc/dbus-1/dbus-1/system.d $TOP/dist/etc/dbus-1/
rmdir $TOP/dist/etc/dbus-1/dbus-1
rm -rf fakeroot
mkdir fakeroot
cp -R dist/* fakeroot/
rm -rf fakeroot/usr/share/man
tar cjfv bluez.tar.bz2 fakeroot
cp bluez.tar.bz2 ../../a5s_linux_sdk/ambarella/boards/dropcam/rootfs/