#!/bin/sh set -eu makei() { echo "==> Running: make DESTDIR=\"$pkgdir\" install $*" make DESTDIR="$pkgdir" install "$@" } mesoni() { echo "==> Running: meson install --destdir \"$pkgdir\" $*" meson install --destdir "$pkgdir" "$@" } cmakei() { echo "==> Running: cmake --install $*" DESTDIR="$pkgdir" cmake --install "$@" } starmove() { [ "$#" -ge 1 ] || { echo "starmove: requires at least one path pattern" >&2 return 1 } [ "${DEPOT_OUTPUT_NAME:-}" != "" ] || { echo "starmove: DEPOT_OUTPUT_NAME is not set" >&2 return 1 } haul "$DEPOT_OUTPUT_NAME" "$@" } depot_starbuild_sync_srcdir() { workdir=${DEPOT_STARBUILD_WORKDIR:?} compat_root="$workdir/.depot-starbuild" mkdir -p "$compat_root/packages" for entry in "$workdir"/* "$workdir"/.[!.]* "$workdir"/..?*; do [ -e "$entry" ] || [ -L "$entry" ] || continue base=$(basename "$entry") [ "$base" = ".depot-starbuild" ] && continue [ "$base" = "packages" ] && continue ln -snf "$entry" "$compat_root/$base" done mkdir -p "$compat_root/packages/bluez/" ln -snf "${DEPOT_PRIMARY_DESTDIR:-$DESTDIR}" "$compat_root/packages/bluez/files" mkdir -p "$compat_root/packages/bluez-cups/" ln -snf "$(subdestdir 'bluez-cups')" "$compat_root/packages/bluez-cups/files" mkdir -p "$compat_root/packages/bluez-deprecated-tools/" ln -snf "$(subdestdir 'bluez-deprecated-tools')" "$compat_root/packages/bluez-deprecated-tools/files" mkdir -p "$compat_root/packages/bluez-hid2hci/" ln -snf "$(subdestdir 'bluez-hid2hci')" "$compat_root/packages/bluez-hid2hci/files" mkdir -p "$compat_root/packages/bluez-libs/" ln -snf "$(subdestdir 'bluez-libs')" "$compat_root/packages/bluez-libs/files" mkdir -p "$compat_root/packages/bluez-mesh/" ln -snf "$(subdestdir 'bluez-mesh')" "$compat_root/packages/bluez-mesh/files" mkdir -p "$compat_root/packages/bluez-obex/" ln -snf "$(subdestdir 'bluez-obex')" "$compat_root/packages/bluez-obex/files" mkdir -p "$compat_root/packages/bluez-utils/" ln -snf "$(subdestdir 'bluez-utils')" "$compat_root/packages/bluez-utils/files" srcdir="$compat_root" export srcdir } depot_starbuild_setup_env() { package_name=$1 package_version='5.86' pkgdir=${DESTDIR:?} export package_name package_version pkgdir LANG=C LC_ALL=C export LANG LC_ALL depot_starbuild_sync_srcdir } depot_build() { depot_starbuild_setup_env 'bluez' rm -rf ell ./configure \ --prefix=/usr \ --mandir=/usr/share/man \ --sysconfdir=/etc \ --localstatedir=/var \ --libexecdir=/usr/lib \ --with-udevdir=/usr/lib/udev \ --with-dbusconfdir=/usr/share \ --enable-btpclient \ --enable-midi \ --enable-sixaxis \ --enable-mesh \ --enable-hid2hci \ --enable-experimental \ --enable-datafiles \ --enable-external-ell \ --enable-library --enable-deprecated --disable-systemd make } depot_install() { depot_starbuild_setup_env 'bluez' make DESTDIR="$pkgdir" install install-pluginLTLIBRARIES install -D -m644 src/main.conf "$pkgdir"/etc/bluetooth/main.conf install -Dm755 "$srcdir"/bluetooth.initd "$pkgdir"/etc/init.d/bluetooth install -Dm755 "$srcdir"/rfcomm.initd "$pkgdir"/etc/init.d/rfcomm install -Dm644 "$srcdir"/rfcomm.confd "$pkgdir"/etc/conf.d/rfcomm install -Dm755 test/simple-agent "$pkgdir"/usr/bin/bluez-simple-agent install -Dm755 tools/btmgmt -t "$pkgdir"/usr/bin/ install -Dm755 attrib/gatttool -t "$pkgdir"/usr/bin/ install -Dm755 tools/obex-client-tool -t "$pkgdir"/usr/bin/ install -Dm644 "$srcdir"/org.bluez.obex.service "$pkgdir"/usr/share/dbus-1/services/org.bluez.obex.service # Autostart mpris-proxy to pass through MPRIS control over BlueZ install -Dm644 "$srcdir"/mpris-proxy.desktop -t "$pkgdir"/etc/xdg/autostart/ # modules which are required for some bluetooth accessories (keyboards, AVRCP, etc) install -Dm644 "$srcdir"/modules-load.conf "$pkgdir"/usr/lib/modules-load.d/bluez.conf for files in $(find tools/ -type f -perm -755); do filename=$(basename "$files") install -Dm755 "$files" "$pkgdir/usr/bin/$filename" done } depot_install_bluez_cups() { depot_starbuild_setup_env 'bluez-cups' starmove usr/lib/cups/backend/bluetooth } depot_install_bluez_deprecated_tools() { depot_starbuild_setup_env 'bluez-deprecated-tools' starmove usr/bin/ciptool usr/bin/hciattach usr/bin/hciconfig usr/bin/hcidump usr/bin/hcitool usr/bin/meshctl usr/bin/rfcomm usr/bin/sdptool starmove usr/share/man/man1/ciptool.1 usr/share/man/man1/hciattach.1 usr/share/man/man1/hciconfig.1 usr/share/man/man1/hcidump.1 usr/share/man/man1/hcitool.1 usr/share/man/man1/rfcomm.1 usr/share/man/man1/sdptool.1 starmove usr/share/man/man7/rfcomm.7 } depot_install_bluez_hid2hci() { depot_starbuild_setup_env 'bluez-hid2hci' starmove usr/lib/udev/* starmove usr/share/man/man1/hid2hci.1 } depot_install_bluez_libs() { depot_starbuild_setup_env 'bluez-libs' starmove usr/include/bluetooth/* starmove usr/lib/libbluetooth.so* starmove usr/lib/pkgconfig/* } depot_install_bluez_mesh() { depot_starbuild_setup_env 'bluez-mesh' starmove etc/bluetooth/mesh-main.conf starmove usr/bin/mesh-cfgclient usr/bin/mesh-cfgtest starmove usr/lib/bluetooth/bluetooth-meshd starmove usr/share/dbus-1/system.d/bluetooth-mesh.conf starmove usr/share/man/man8/bluetooth-meshd.8 chmod -v 555 "${pkgdir}"/etc/bluetooth } depot_install_bluez_obex() { depot_starbuild_setup_env 'bluez-obex' install -Dm755 tools/obexctl -t "$pkgdir"/usr/bin/ cd $srcdir starmove usr/bin/obex-client-tool usr/bin/obex-server-tool starmove usr/lib/bluetooth/obexd starmove usr/share/dbus-1/system.d/obex.conf starmove usr/share/man/man5/org.bluez.obex*.5 starmove usr/share/dbus-1/services/org.bluez.obex.service } depot_install_bluez_utils() { depot_starbuild_setup_env 'bluez-utils' for files in $(find "${DEPOT_PRIMARY_DESTDIR}/usr/bin" -maxdepth 1 -type f -perm -755 2>/dev/null); do filename=$(basename "$files") case "$filename" in advtest|avinfo|avtest|bcmfw|bdaddr|bluemoon|bluetoothctl|bluetooth-player|bneptest|btattach|btconfig|btgatt-client|btgatt-server|btinfo|btiotest|btmgmt|btmon|btpclient|btpclientctl|btproxy|btsnoop|check-selftest|cltest|create-image|eddystone|gatt-service|hcieventmask|hcisecfilter|hex2hcd|hid2hci|hwdb|ibeacon|isotest|l2ping|l2test|mpris-proxy|nokfw|oobtest|rctest|rtlfw|scotest|seq2bseq|test-runner) starmove "usr/bin/$filename" ;; esac done for files in $(find "${DEPOT_PRIMARY_DESTDIR}/usr/share/man/man1" -maxdepth 1 -type f 2>/dev/null); do filename=$(basename "$files") case "$filename" in bluetoothctl*.1|btattach.1|btmgmt.1|btmon.1|isotest.1|l2ping.1|rctest.1) starmove "usr/share/man/man1/$filename" ;; esac done for files in $(find "${DEPOT_PRIMARY_DESTDIR}/usr/share/man/man5" -maxdepth 1 -type f 2>/dev/null); do filename=$(basename "$files") case "$filename" in org.bluez.A*.5|org.bluez.B*.5|org.bluez.D*.5|org.bluez.G*.5|org.bluez.I*.5|org.bluez.L*.5|org.bluez.M*.5|org.bluez.N*.5|org.bluez.P*.5) starmove "usr/share/man/man5/$filename" ;; esac done for files in $(find "${DEPOT_PRIMARY_DESTDIR}/usr/share/man/man7" -maxdepth 1 -type f 2>/dev/null); do filename=$(basename "$files") case "$filename" in hci.7|l2cap.7|mgmt.7|sco.7|iso.7) starmove "usr/share/man/man7/$filename" ;; esac done [ -f "${DEPOT_PRIMARY_DESTDIR}/usr/share/zsh/site-functions/_bluetoothctl" ] && starmove usr/share/zsh/site-functions/_bluetoothctl }