Files
BMLFS/build-scripts/bluez.build
2024-01-04 17:10:58 -06:00

95 lines
3.9 KiB
Bash

#! /bin/bash
# BlueZ
# Source: https://www.kernel.org/pub/linux/bluetooth/bluez-5.70.tar.xz
#
# $BUILD = Directory to temporarily install
# $PKGS = Directory to store built packages
#
# DEPS
# Required: dbus, GLib, json-c and libical
# Recommended: NONE
# Optional: docutils (if not, add --disable-manpages)
# if optimizing with GCC
export CFLAGS="-march=native -pipe "
export CFLAGS+="-fno-lto -fstack-protector-strong -fzero-call-used-regs=used "
patch -Np1 -i ../patches/bluez-chimera/0001-enable-dbus-without-systemd.patch
patch -Np1 -i ../patches/bluez-chimera/0002-allow-obexd-on-non-systemd-system.patch
patch -Np1 -i ../patches/bluez-chimera/0003-allow-mesh-on-non-systemd-system.patch
patch -Np1 -i ../patches/bluez-chimera/0004-include-sys-time.h-for-musl-build.patch
patch -Np1 -i ../patches/bluez-chimera/0006-musl-fix.patch
patch -Np1 -i ../patches/bluez-chimera/0007-include-string.h.patch
patch -Np1 -i ../patches/bluez-chimera/0008-grant-permission-to-bluetooth-group.patch
patch -Np1 -i ../patches/bluez-chimera/max-input.patch
patch -Np1 -i ../patches/bluez-chimera/001-bcm43xx-Add-bcm43xx-3wire-variant.patch
patch -Np1 -i ../patches/bluez-chimera/002-bcm43xx-The-UART-speed-must-be-reset-after-the-firmw.patch
patch -Np1 -i ../patches/bluez-chimera/003-Increase-firmware-load-timeout-to-30s.patch
patch -Np1 -i ../patches/bluez-chimera/004-Move-the-43xx-firmware-into-lib-firmware.patch
patch -Np1 -i ../patches/bluez-chimera/005-hostname-Use-phone-class-for-handhelds.patch
patch -Np1 -i ../patches/bluez-chimera/fix-endianness.patch
patch -Np1 -i ../patches/bluez-chimera/test-mesh-crypto.patch
# If building with LLVM-17's LLD, set the LDFLAGS
# https://github.com/termux/termux-packages/issues/18761#issuecomment-1864098542
LDFLAGS="-Wl,--undefined-version" \
./configure --prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var \
--enable-library \
--disable-systemd \
--enable-hid2hci \
--enable-deprecated \
--enable-mesh \
--enable-btpclient \
--disable-manpages $BUILDTRUPLE &&
read -p "Compile?" && make -j2 &&
sudo -S make DESTDIR=$BUILD install &&
sudo -S install -D -m644 src/main.conf ${BUILD}/etc/bluetooth/main.conf &&
sed 's|^#!/usr/bin/python$|#!/usr/bin/env python3|g' -i test/simple-agent &&
sudo -S install -Dm755 test/simple-agent ${BUILD}/usr/bin/bluez-simple-agent &&
sudo mkdir -pv /BMAN/install
sudo mkdir -pv /BMAN/usr/share
sudo mv $BUILD/usr/share/man /BMAN/usr/share/
cd $BUILD && sudo -S mkdir -v ${BUILD}/install &&
cat > /tmp/slack-desc << "EOF"
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':' except on otherwise blank lines.
|-----handy-ruler------------------------------------------------------|
bluez: bluez (Bluetooth libraries and utilities)
bluez:
bluez: Bluez is the Bluetooth stack for Linux, allowing Bluetooth adaptors
bluez: and devices to be used with Linux. This package contains the Bluez
bluez: libraries, utilities, and other support files.
bluez:
bluez: Homepage: http://www.bluez.org
bluez:
bluez:
bluez:
bluez:
EOF
sudo -S mv -v /tmp/slack-desc install/ &&
sudo -S makepkg -l y -c n $PKGS/bluez-5.70-$PSUFFIX &&
cd /BMAN
cat > /tmp/slack-desc << "EOF"
bluez-doc: Manuals for bluez (Bluetooth libraries and utilities)
bluez-doc:
bluez-doc: Bluez is the Bluetooth stack for Linux, allowing Bluetooth adaptors
bluez-doc: and devices to be used with Linux.
bluez-doc:
bluez-doc: http://www.bluez.org
bluez-doc:
EOF
sudo -S mv -v /tmp/slack-desc install/ &&
sudo -S makepkg -l y -c n $PKGS/bluez-doc-5.70-$NOPSUFFIX
sudo -S rm -rf /BMAN/*
sudo -S rm -rf ${BUILD}/*