From a9943200f5d8766493e774cd1a68b17018ad8f6c Mon Sep 17 00:00:00 2001 From: Daniel Engberg Date: Mon, 30 Apr 2018 08:11:13 +0200 Subject: [PATCH] bluez: Update to 5.49 Update bluez to 5.49 Fix issue https://github.com/openwrt/packages/issues/1497 Fix issue https://github.com/openwrt/packages/issues/1503 Cherry pick patches from Alpine Linux repo Apply --gc-sections, saves about 500kbyte Drop audio.conf (not needed and deprecated) Remove bluetooth.dbus as upstream supplies a working copy Based on patch provided by Johnny Vogels https://github.com/openwrt/packages/pull/5937 Source: https://git.alpinelinux.org/cgit/aports/commit/main/bluez/fix-endianness.patch?id=1c6991b32a22be2c905cc1709be1376c4e79e451 https://git.alpinelinux.org/cgit/aports/commit/main/bluez/bluez-5.40-obexd_without_systemd-1.patch?id=980b2d04ae4339594701b33cf9460757c989c94c Signed-off-by: Daniel Engberg --- utils/bluez/Makefile | 20 +++--- utils/bluez/files/audio.conf | 1 - utils/bluez/files/bluetooth.dbus | 37 ----------- utils/bluez/files/bluetoothd.init | 1 + utils/bluez/patches/201-readline.patch | 22 +++---- utils/bluez/patches/202-fix-endianness.patch | 10 +++ .../patches/203-obexd_without_systemd.patch | 61 +++++++++++++++++++ 7 files changed, 93 insertions(+), 59 deletions(-) delete mode 100644 utils/bluez/files/audio.conf delete mode 100644 utils/bluez/files/bluetooth.dbus create mode 100644 utils/bluez/patches/202-fix-endianness.patch create mode 100644 utils/bluez/patches/203-obexd_without_systemd.patch diff --git a/utils/bluez/Makefile b/utils/bluez/Makefile index 245e45d5f5..81deda23d4 100644 --- a/utils/bluez/Makefile +++ b/utils/bluez/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=bluez -PKG_VERSION:=5.47 +PKG_VERSION:=5.49 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/linux/bluetooth/ -PKG_HASH:=cf75bf7cd5d564f21cc4a2bd01d5c39ce425397335fd47d9bbe43af0a58342c8 +PKG_HASH:=33301d7a514c73d535ee1f91c2aed1af1f2e53efe11d3ac06bcf0d7abed2ce95 PKG_LICENSE:=GPL-2.0+ PKG_LICENSE_FILES:=COPYING @@ -55,7 +55,7 @@ $(call Package/bluez/Default) SECTION:=utils CATEGORY:=Utilities TITLE+= utilities - DEPENDS:=+bluez-libs +libpthread +librt +glib2 +libncurses +libreadline $(INTL_DEPENDS) $(ICONV_DEPENDS) + DEPENDS:=+bluez-libs +libpthread +librt +glib2 +libncurses +libreadline $(INTL_DEPENDS) $(ICONV_DEPENDS) +dbus endef define Package/bluez-daemon @@ -70,10 +70,13 @@ define Package/bluez-daemon/conffiles /etc/bluetooth/main.conf /etc/bluetooth/network.conf /etc/bluetooth/input.conf -/etc/bluetooth/audio.conf +/etc/bluetooth/keys /etc/config/bluetooth endef +TARGET_CFLAGS += -D_GNU_SOURCE -ffunction-sections -fdata-sections +TARGET_LDFLAGS += -Wl,--gc-sections + CONFIGURE_ARGS += \ --enable-static \ --enable-shared \ @@ -94,9 +97,6 @@ CONFIGURE_ARGS += \ --disable-udev \ --enable-deprecated -TARGET_CPPFLAGS += \ - -D_GNU_SOURCE - define Build/InstallDev $(INSTALL_DIR) $(1)/usr/include $(CP) $(PKG_INSTALL_DIR)/usr/include/bluetooth $(1)/usr/include/ @@ -120,6 +120,7 @@ define Package/bluez-utils/install $(INSTALL_DIR) $(1)/usr/bin $(CP) $(PKG_INSTALL_DIR)/usr/bin/bccmd $(1)/usr/bin/ $(CP) $(PKG_INSTALL_DIR)/usr/bin/bluemoon $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/btattach $(1)/usr/bin/ $(CP) $(PKG_INSTALL_DIR)/usr/bin/btmon $(1)/usr/bin/ $(CP) $(PKG_BUILD_DIR)/tools/btmgmt $(1)/usr/bin/ $(CP) $(PKG_INSTALL_DIR)/usr/bin/ciptool $(1)/usr/bin/ @@ -130,6 +131,7 @@ define Package/bluez-utils/install $(CP) $(PKG_INSTALL_DIR)/usr/bin/hex2hcd $(1)/usr/bin/ $(CP) $(PKG_INSTALL_DIR)/usr/bin/l2ping $(1)/usr/bin/ $(CP) $(PKG_INSTALL_DIR)/usr/bin/l2test $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/mpris-proxy $(1)/usr/bin/ $(CP) $(PKG_INSTALL_DIR)/usr/bin/rctest $(1)/usr/bin/ $(CP) $(PKG_INSTALL_DIR)/usr/bin/rfcomm $(1)/usr/bin/ $(CP) $(PKG_INSTALL_DIR)/usr/bin/sdptool $(1)/usr/bin/ @@ -144,12 +146,12 @@ define Package/bluez-daemon/install $(INSTALL_DIR) $(1)/etc/config $(INSTALL_DATA) ./files/bluetooth.config $(1)/etc/config/bluetooth $(INSTALL_DIR) $(1)/etc/dbus-1/system.d/ - $(INSTALL_DATA) ./files/bluetooth.dbus $(1)/etc/dbus-1/system.d/bluetooth.conf + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/bluetooth.conf $(1)/etc/dbus-1/system.d/bluetooth.conf $(INSTALL_DIR) $(1)/etc/bluetooth + $(INSTALL_DIR) $(1)/etc/bluetooth/keys $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/main.conf $(1)/etc/bluetooth/main.conf $(INSTALL_DATA) $(PKG_BUILD_DIR)/profiles/network/network.conf $(1)/etc/bluetooth/network.conf $(INSTALL_DATA) $(PKG_BUILD_DIR)/profiles/input/input.conf $(1)/etc/bluetooth/input.conf - $(INSTALL_DATA) ./files/audio.conf $(1)/etc/bluetooth/audio.conf $(INSTALL_DIR) $(1)/etc/init.d $(INSTALL_BIN) ./files/bluetoothd.init $(1)/etc/init.d/bluetoothd endef diff --git a/utils/bluez/files/audio.conf b/utils/bluez/files/audio.conf deleted file mode 100644 index 0455c6c01b..0000000000 --- a/utils/bluez/files/audio.conf +++ /dev/null @@ -1 +0,0 @@ -Enable=Source,Sink,Media,Socket diff --git a/utils/bluez/files/bluetooth.dbus b/utils/bluez/files/bluetooth.dbus deleted file mode 100644 index 88545fac97..0000000000 --- a/utils/bluez/files/bluetooth.dbus +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/utils/bluez/files/bluetoothd.init b/utils/bluez/files/bluetoothd.init index 75f4d96646..8c548bcdbf 100644 --- a/utils/bluez/files/bluetoothd.init +++ b/utils/bluez/files/bluetoothd.init @@ -7,6 +7,7 @@ USE_PROCD=1 PROG=/usr/bin/bluetoothd start_service() { + ln -snf /etc/bluetooth/keys/ /var/lib/bluetooth procd_open_instance procd_set_param command "$PROG" -n procd_close_instance diff --git a/utils/bluez/patches/201-readline.patch b/utils/bluez/patches/201-readline.patch index 5794371620..ac42cb08cd 100644 --- a/utils/bluez/patches/201-readline.patch +++ b/utils/bluez/patches/201-readline.patch @@ -1,7 +1,7 @@ --- a/Makefile.in 2017-09-14 11:47:06.000000000 +0200 +++ b/Makefile.in 2017-09-15 02:52:39.315926972 +0200 -@@ -2447,7 +2447,7 @@ - @CLIENT_TRUE@ monitor/uuid.h monitor/uuid.c +@@ -2472,7 +2472,7 @@ + @CLIENT_TRUE@ client/gatt.h client/gatt.c @CLIENT_TRUE@client_bluetoothctl_LDADD = gdbus/libgdbus-internal.la src/libshared-glib.la \ -@CLIENT_TRUE@ @GLIB_LIBS@ @DBUS_LIBS@ -lreadline @@ -9,7 +9,7 @@ @MESH_TRUE@mesh_meshctl_SOURCES = mesh/main.c \ @MESH_TRUE@ mesh/mesh-net.h \ -@@ -2468,7 +2468,7 @@ +@@ -2491,7 +2491,7 @@ @MESH_TRUE@mesh_meshctl_LDADD = gdbus/libgdbus-internal.la src/libshared-glib.la \ @MESH_TRUE@ lib/libbluetooth-internal.la \ @@ -18,7 +18,7 @@ @MONITOR_TRUE@monitor_btmon_SOURCES = monitor/main.c monitor/bt.h \ @MONITOR_TRUE@ monitor/display.h monitor/display.c \ -@@ -2724,7 +2724,7 @@ +@@ -2747,7 +2747,7 @@ @READLINE_TRUE@ tools/obex-client-tool.c @READLINE_TRUE@tools_obex_client_tool_LDADD = lib/libbluetooth-internal.la \ @@ -27,17 +27,15 @@ @READLINE_TRUE@tools_obex_server_tool_SOURCES = $(gobex_sources) $(btio_sources) \ @READLINE_TRUE@ tools/obex-server-tool.c -@@ -2734,17 +2734,17 @@ - @READLINE_TRUE@ client/display.h client/display.c - +@@ -2756,15 +2756,15 @@ + @READLINE_TRUE@tools_bluetooth_player_SOURCES = tools/bluetooth-player.c @READLINE_TRUE@tools_bluetooth_player_LDADD = gdbus/libgdbus-internal.la \ + @READLINE_TRUE@ src/libshared-glib.la \ -@READLINE_TRUE@ @GLIB_LIBS@ @DBUS_LIBS@ -lreadline +@READLINE_TRUE@ @GLIB_LIBS@ @DBUS_LIBS@ -lreadline -lncurses - @READLINE_TRUE@tools_obexctl_SOURCES = tools/obexctl.c \ - @READLINE_TRUE@ client/display.h client/display.c - - @READLINE_TRUE@tools_obexctl_LDADD = gdbus/libgdbus-internal.la \ + @READLINE_TRUE@tools_obexctl_SOURCES = tools/obexctl.c + @READLINE_TRUE@tools_obexctl_LDADD = gdbus/libgdbus-internal.la src/libshared-glib.la \ -@READLINE_TRUE@ @GLIB_LIBS@ @DBUS_LIBS@ -lreadline +@READLINE_TRUE@ @GLIB_LIBS@ @DBUS_LIBS@ -lreadline -lncurses @@ -48,7 +46,7 @@ @DEPRECATED_TRUE@@READLINE_TRUE@attrib_gatttool_SOURCES = attrib/gatttool.c attrib/att.c attrib/gatt.c \ @DEPRECATED_TRUE@@READLINE_TRUE@ attrib/gattrib.c btio/btio.c \ -@@ -2753,7 +2753,7 @@ +@@ -2773,7 +2773,7 @@ @DEPRECATED_TRUE@@READLINE_TRUE@ client/display.h @DEPRECATED_TRUE@@READLINE_TRUE@attrib_gatttool_LDADD = lib/libbluetooth-internal.la \ diff --git a/utils/bluez/patches/202-fix-endianness.patch b/utils/bluez/patches/202-fix-endianness.patch new file mode 100644 index 0000000000..cf76ae149c --- /dev/null +++ b/utils/bluez/patches/202-fix-endianness.patch @@ -0,0 +1,10 @@ +--- a/src/shared/util.h.old 2016-09-26 07:29:00.000000000 -0500 ++++ b/src/shared/util.h 2017-12-27 22:49:50.538716424 -0600 +@@ -26,6 +26,7 @@ + #include + #include + #include ++#include + + #if __BYTE_ORDER == __LITTLE_ENDIAN + #define le16_to_cpu(val) (val) diff --git a/utils/bluez/patches/203-obexd_without_systemd.patch b/utils/bluez/patches/203-obexd_without_systemd.patch new file mode 100644 index 0000000000..749787c5b3 --- /dev/null +++ b/utils/bluez/patches/203-obexd_without_systemd.patch @@ -0,0 +1,61 @@ +Submitted By: Armin K. +Date: 2013-04-29 +Initial Package Version: 5.17 +Upstream Status: unknown +Origin: Arch Linux (Giovanni Campagna) +Description: Allow using obexd without systemd in the user session + +Not all sessions run systemd --user (actually, the majority +doesn't), so the dbus daemon must be able to spawn obexd +directly, and to do so it needs the full path of the daemon. +--- + Makefile.obexd | 4 ++-- + obexd/src/org.bluez.obex.service | 4 ---- + obexd/src/org.bluez.obex.service.in | 4 ++++ + 3 files changed, 6 insertions(+), 6 deletions(-) + delete mode 100644 obexd/src/org.bluez.obex.service + create mode 100644 obexd/src/org.bluez.obex.service.in + +diff --git a/Makefile.obexd b/Makefile.obexd +index 3760867..142e7c3 100644 +--- a/Makefile.obexd ++++ b/Makefile.obexd +@@ -2,12 +2,12 @@ + if SYSTEMD + systemduserunitdir = @SYSTEMD_USERUNITDIR@ + systemduserunit_DATA = obexd/src/obex.service ++endif + + dbussessionbusdir = @DBUS_SESSIONBUSDIR@ + dbussessionbus_DATA = obexd/src/org.bluez.obex.service +-endif + +-EXTRA_DIST += obexd/src/obex.service.in obexd/src/org.bluez.obex.service ++EXTRA_DIST += obexd/src/obex.service.in obexd/src/org.bluez.obex.service.in + + obex_plugindir = $(libdir)/obex/plugins + +diff --git a/obexd/src/org.bluez.obex.service b/obexd/src/org.bluez.obex.service +deleted file mode 100644 +index a538088..0000000 +--- a/obexd/src/org.bluez.obex.service ++++ /dev/null +@@ -1,4 +0,0 @@ +-[D-BUS Service] +-Name=org.bluez.obex +-Exec=/bin/false +-SystemdService=dbus-org.bluez.obex.service +diff --git a/obexd/src/org.bluez.obex.service.in b/obexd/src/org.bluez.obex.service.in +new file mode 100644 +index 0000000..9c815f2 +--- /dev/null ++++ b/obexd/src/org.bluez.obex.service.in +@@ -0,0 +1,4 @@ ++[D-BUS Service] ++Name=org.bluez.obex ++Exec=@libexecdir@/obexd ++SystemdService=dbus-org.bluez.obex.service +-- +1.8.3.1 + + -- 2.30.2