Mercurial > vanilla
changeset 737:24249b89d047
bluetooth/bluez: initial import, closes #1216
author | David Demelier <markand@malikania.fr> |
---|---|
date | Tue, 06 Aug 2019 20:34:00 +0200 |
parents | 5c0ac6497f9f |
children | eae54468321b |
files | bluetooth/bluez/bluetooth bluetooth/bluez/bluez.sh bluetooth/bluez/bluez.sha1 bluetooth/bluez/bluez.txt |
diffstat | 4 files changed, 182 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetooth/bluez/bluetooth Tue Aug 06 20:34:00 2019 +0200 @@ -0,0 +1,79 @@ +#!/bin/sh +# +# /etc/rc.d/bluetooth -- run control script for bluetooth +# +# Copyright (c) 2019 David Demelier <markand@malikania.fr> +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# + +if [ -f /etc/rc.conf ]; then + . /etc/rc.conf +fi + +: ${BLUETOOTH_CMD:=/libexec/bluetooth/bluetoothd} +: ${BLUETOOTH_ARGS:=} +: ${BLUETOOTH_PID:=/var/run/bluetooth.pid} + +bluetooth_start() +{ + if [ -s $BLUETOOTH_PID ]; then + echo "bluetooth is already running with pid: $(cat $BLUETOOTH_PID)" + exit 1 + fi + + echo "Starting bluetooth: $BLUETOOTH_CMD $BLUETOOTH_ARGS" + start-stop-daemon -Sbvp $BLUETOOTH_PID -x $BLUETOOTH_CMD -- $BLUETOOTH_ARGS +} + +bluetooth_status() +{ + if [ -s $BLUETOOTH_PID ]; then + echo "bluetooth is running with pid: $(cat $BLUETOOTH_PID)" + else + echo "bluetooth is not running" + fi +} + +bluetooth_stop() +{ + if [ -s $BLUETOOTH_PID ]; then + echo "Stopping bluetooth." + start-stop-daemon -Kp $BLUETOOTH_PID + fi +} + +bluetooth_restart() +{ + bluetooth_stop + sleep 3 + bluetooth_start +} + +case $1 in +start) + bluetooth_start + ;; +status) + bluetooth_status + ;; +stop) + bluetooth_stop + ;; +restart) + bluetooth_restart + ;; +*) + echo "usage: $(basename $0) restart|start|status|stop" + ;; +esac
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetooth/bluez/bluez.sh Tue Aug 06 20:34:00 2019 +0200 @@ -0,0 +1,98 @@ +#!/bin/sh +# +# Copyright (c) 2019 David Demelier <markand@malikania.fr> +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# + +PKGNAME=bluez +PKGVERSION=5.50 +PKGREVISION=1 +PKGLICENSE="GPLv2 LGPLv21" +PKGSUMMARY="official bluetooth protocol stack for Linux" +PKGDOWNLOAD="http://www.kernel.org/pub/linux/bluetooth/$PKGNAME-$PKGVERSION.tar.xz" +PKGDEPENDS="" +PKGOPTIONS="AUDIO CUPS LEGACY UDEV" +PKGPROTECT="etc/bluetooth/main.conf + etc/rc.d/bluetooth" + +: ${CHOST:=$(uname -m)-linux-musl} +: ${CBUILD:=$(uname -m)-linux-musl} +: ${CC:=clang} +: ${CFLAGS:=-O2} +: ${CXX:=clang++} +: ${CXXFLAGS:=-O2} +: ${LDFLAGS:=} +: ${LIBS:=} +: ${AUDIO:=yes} +: ${CUPS:=yes} +: ${LEGACY:=no} +: ${UDEV:=yes} + +if [ "$AUDIO" = "yes" ]; then + with_audio="--enable-a2dp" +else + with_audio="--disable-a2dp" +fi + +if [ "$CUPS" = "yes" ]; then + with_cups="--enable-cups" +else + with_cups="--disable-cups" +fi + +if [ "$LEGACY" = "yes" ]; then + with_legacy="--enable-deprecated" +else + with_legacy="--disable-deprecated" +fi + +if [ "$UDEV" = "yes" ]; then + PKGDEPENDS="core/eudev $PKGDEPENDS" + with_udev="--enable-udev" +else + with_udev="--disable-udev" +fi + +build() +{ + rm -rf $PKGNAME-$PKGVERSION + tar xvf $PKGNAME-$PKGVERSION.tar.xz + cd $PKGNAME-$PKGVERSION + + # --enable-library: required by many packages. + CC="$CC" \ + CFLAGS="$CFLAGS" \ + CXX="$CXX" \ + CXXFLAGS="$CXXFLAGS" \ + LDFLAGS="$LDFLAGS" \ + LIBS="$LIBS" \ + ./configure \ + --build=$CBUILD \ + --host=$CHOST \ + --prefix= \ + --disable-systemd \ + --enable-library \ + $with_audio \ + $with_cups \ + $with_legacy \ + $with_udev + make + make install DESTDIR=$DESTDIR + rm -f $DESTDIR/lib/libbluetooth.la + install -Dm0644 src/main.conf $DESTDIR/etc/bluetooth/main.conf + install -Dm0644 ../bluetooth $DESTDIR/etc/rc.d/bluetooth + + cd .. + rm -rf $PKGNAME-$PKGVERSION +}