From 0f997fee82f4129275ec7263a7af34d1f41ba5ec Mon Sep 17 00:00:00 2001 From: Cyteen May Date: Sat, 15 Feb 2020 18:13:57 +0000 Subject: [PATCH] Example deb build scripts. --- build_deb_from_dsc.sh | 38 +++++++++ build_deb_from_git.sh | 194 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 232 insertions(+) create mode 100644 build_deb_from_dsc.sh create mode 100755 build_deb_from_git.sh diff --git a/build_deb_from_dsc.sh b/build_deb_from_dsc.sh new file mode 100644 index 0000000..e3153ae --- /dev/null +++ b/build_deb_from_dsc.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash + +# http://deb.debian.org/debian/pool/main/s/shellcheck/shellcheck_0.7.0-2.dsc +# http://deb.debian.org/debian/pool/main/s/shellcheck/shellcheck_0.7.0-2~bpo10+1.dsc + +if [ "$1" == "-h" ]; then + echo "Usage: `basename $0` Takes a build location and a dsc file + or a url to one and builds and installs the result." + exit 0 +fi + + +BUILD_DIR=$1/build +mkdir -p ${BUILD_DIR} +cd ${BUILD_DIR} + +gbp import-dsc -v --allow-unauthenticated $2 + +cd * + +mk-build-deps debian/control +DEPS_DEB=$(ls *deb) +dpkg -i ${DEPS_DEB} +apt-get -f install +dpkg-buildpackage -us -uc -b + +APT_REMOVE=${DEPS_DEB%%\_*} +apt-get -y remove --purge ${APT_REMOVE} +apt-get -y autoremove + +INSTALL_DEB=${APT_REMOVE%%-*} +dpkg -i ../${INSTALL_DEB}_*deb + + + + + + diff --git a/build_deb_from_git.sh b/build_deb_from_git.sh new file mode 100755 index 0000000..f4bc73b --- /dev/null +++ b/build_deb_from_git.sh @@ -0,0 +1,194 @@ +#!/usr/bin/env bash +set -x +sudo apt-get -y install \ + dh-autoreconf \ + dh-make \ + check \ + bluez \ + bluetooth \ + bluez-tools \ + libbluetooth-dev \ + libbsd-dev \ + libusb-dev \ + libglib2.0-dev \ + libudev-dev \ + libical-dev \ + libmp3lame-dev \ + libmpg123-dev \ + libncurses-dev \ + libfdk-aac-dev \ + libreadline-dev + libsbc1 \ + libsbc-dev \ + libfdk-aac-dev \ + libasound2-dev \ + libortp-dev + + +USER="Arkq" +PROJECT="bluez-alsa" +LICENSE="mit" +SECTION="admin" +HOMEPAGE="http://www.bluez.org" +BUILD_HOME="/var/tmp/bluez-alsa-git_build" +#VERSION="2.1.0" +PACKAGE="bluealsa" +VERSION=$(curl "https://api.github.com/repos/${USER}/${PROJECT}/tags?per_page=5" | jq -r '.[0] | .name') +VERSION=${VERSION:1} # strip the preceding 'v' +DEBEMAIL="person@company.tld" +DEBFULLNAME="Testy McTester" +DESCRIPTION="Integration between BlueZ and ALSA." +LONG_DESCRIPTION=" With BlueALSA one can achieve the same goal as with PulseAudio, but with fewer\n dependencies and less overhead. BlueALSA registers all known Bluetooth audio\n profiles in BlueZ, so in theory every Bluetooth audio device can be connected.\n In order to access the audio stream, one has to connect to the ALSA PCM device\n called bluealsa." + +# Disable discoverable timeout in the main.conf from the bluez package +sed -i 's,^\(DiscoverableTimeout = \).*,\1'\"0\"',' /etc/bluetooth/main.conf + +# Make the BUILD_HOME directory and clone upstream +mkdir -p ${BUILD_HOME} +cd ${BUILD_HOME} || exit + +git clone https://github.com/${USER}/${PROJECT}.git ${PACKAGE}-${VERSION} + +cd ${PACKAGE}-${VERSION} || exit + +mkdir -p m4 + + +cat < .git/gbp.conf +[DEFAULT] +# this is the upstream-branch: +upstream-branch=master +EOF + +# debianize the BUILD_HOME directory +echo ${DEBFULLNAME} +dh_make \ + --createorig \ + --single \ + --native \ + --copyright ${LICENSE} \ + --yes + + + +# Customize the debian directory values +#sed -i 's,^\(Description: \).*,\1'${DESCRIPTION}',' debian/control +sed -i "s,^\(Description: \).*,\1${DESCRIPTION}," debian/control +sed -i 's,^\(Section: \).*,\1'${SECTION}',' debian/control +sed -i "s,^\(Maintainer: \).*,\1'${DEBFULLNAME}\ \<${DEBEMAIL}\>'," debian/control +sed -i 's,^\(Homepage: \).*,\1'${HOMEPAGE}',' debian/control +sed -i "s/.*insert\ long.*/${LONG_DESCRIPTION}/" debian/control + + +echo **************** +cat debian/control +echo **************** + +BUILD_OPTIONS="--enable-aac --enable-ofono --enable-debug" + +cat < debian/rules +#!/usr/bin/make -f +%: + dh \$@ + +override_dh_auto_configure: + dh_auto_configure -- ${BUILD_OPTIONS} +EOF + +cat < debian/watch +version=4 +opts=filenamemangle=s/.+\/v?(\d\S+)\.tar\.gz/${PROJECT}-$1\.tar\.gz/ \ + https://github.com/${USER}/${PROJECT}/tags .*/v?(\d\S+)\.tar\.gz +EOF + +dpkg-buildpackage -us -uc -b + +echo ${PACKAGE}_${VERSION}_amd64.deb + +sudo dpkg -i ../${PACKAGE}_${VERSION}_amd64.deb + +#------------------------------------------------------------------------------- +## When BlueALSA has been created, then you can start BlueALSA as background task: +#bluealsa --disable-hfp & + +# Now - for using your bluetooth-speaker/headset - with BlueALSA you have to intoduce the device to the bluetooth-stack using bluetoothctl: +# bluetoothctl > +# scan on +# [NEW] Device 30:23:23:F4:48:2C TH-S10U +# scan off +# pair 30:23:23:F4:48:2C +# trust 30:23:23:F4:48:2C +# exit + +# After that power off&on the bt-speaker device and the device will connect automatically as a trusted device. + +# Before we try our first audio-command we had to export one thing to make BlueALSA mor system-friendly: +export LIBASOUND_THREAD_SAFE=0 + +# autostart bluealsa +#cat < /etc/rc.local +## Start bluealsa as root +#export LIBASOUND_THREAD_SAFE=0 +#/usr/bin/bluealsa -S & +#EOF + +# Text to speech: + +# espeak "Hello, how are you?" -w /home/guido/espeak.wav -s145 +# aplay -D bluealsa:HCI=hci0,DEV=30:23:23:F4:48:2C,PROFILE=a2dp /home/guido/espeak.wav + +# arecord -D bluealsa capture.wav + +# bluealsa-aplay XX:XX:XX:XX:XX:XX + +# $ aplay -D bluealsa:SRV=org.bluealsa,DEV=XX:XX:XX:XX:XX:XX,PROFILE=sco Bourree_in_E_minor.wav + +# amixer -D bluealsa sset '' 70% +# amixer -D bluealsa sset 'Jabra MOVE v2.3.0 - A2DP' 50% + + +# Internetradio: + +# mpg123 -a bluealsa:HCI=hci0,DEV=30:23:23:F4:48:2C,PROFILE=a2dp -@ /home/guido/ffh80s.pls + +# For shorting the command you could create a ~/.asoundrc with the following content: + +# defaults.bluealsa.interface "hci0" +# defaults.bluealsa.device "30:23:23:F4:48:2C" +# defaults.bluealsa.profile "a2dp" +# defaults.bluealsa.delay 10000 + +# Now you can the shorter version of the command: + +# mpg123 -a bluealsa -@ /home/guido/ffh80s.pls + +# For set the volume of such a device you have to know the "real" name of the device out of the bluetoothctl and the name of the used protocol: + +# Device: 30:23:23:F4:48:2C TH-S10U +# Protocol: A2DP +# amixer -D bluealsa sset 'TH-S10U - A2DP ' 70% + +#------------------------------------------------------------------------ +## ldacBT +## +## AOSP libldac dispatcher +## https://android.googlesource.com/platform/external/libldac +## https://github.com/EHfive/ldacBT + +#git clone https://github.com/EHfive/ldacBT.git +#cd ldacBT +#git submodule update --init +# +#mkdir build && cd build +#cmake \ +# -DCMAKE_INSTALL_PREFIX=/usr \ +# -DINSTALL_LIBDIR=/usr/lib \ +# -DLDAC_SOFT_FLOAT=OFF \ +# ../ +#make DESTDIR=$DEST_DIR install + +#------------------------------------------------------------------------ +## [open]aptx - reverse-engineered apt-X +## https://github.com/Arkq/openaptx + +#------------------------------------------------------------------------