This patch add bluetooth-headers module which is fake static library
to provide headers from lib/ directory in proper manner, i.e. from
bluetooth/ directory. Headers are copied to intermediates directory
and proper include path is added by build system once dependency to
this module is added. It's not longer necessary to specify lib/
directory on include path for each module.
This is to avoid modyfing source repository by creating symlinks in
lib/ directory - now it's possible to build BlueZ without touching
source repository at all.
---
android/Android.mk | 64 +++++++++++++++++++++++++++++++++---------------------
1 file changed, 39 insertions(+), 25 deletions(-)
diff --git a/android/Android.mk b/android/Android.mk
index 3a62485..c31b57e 100644
--- a/android/Android.mk
+++ b/android/Android.mk
@@ -74,27 +74,14 @@ LOCAL_C_INCLUDES := \
LOCAL_C_INCLUDES += \
$(LOCAL_PATH)/bluez \
- $(LOCAL_PATH)/bluez/lib \
LOCAL_CFLAGS := $(BLUEZ_COMMON_CFLAGS)
LOCAL_SHARED_LIBRARIES := \
libglib \
-lib_headers := \
- bluetooth.h \
- hci.h \
- hci_lib.h \
- l2cap.h \
- sdp_lib.h \
- sdp.h \
- rfcomm.h \
- sco.h \
- bnep.h \
-
-$(shell mkdir -p $(LOCAL_PATH)/bluez/lib/bluetooth)
-
-$(foreach file,$(lib_headers), $(shell ln -sf ../$(file) $(LOCAL_PATH)/bluez/lib/bluetooth/$(file)))
+LOCAL_STATIC_LIBRARIES := \
+ bluetooth-headers \
LOCAL_MODULE_TAGS := optional
@@ -215,10 +202,12 @@ LOCAL_SRC_FILES := \
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/bluez \
- $(LOCAL_PATH)/bluez/lib \
LOCAL_CFLAGS := $(BLUEZ_COMMON_CFLAGS)
+LOCAL_STATIC_LIBRARIES := \
+ bluetooth-headers \
+
LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
LOCAL_MODULE_TAGS := debug
LOCAL_MODULE := btmon
@@ -285,10 +274,12 @@ LOCAL_SRC_FILES := \
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/bluez \
- $(LOCAL_PATH)/bluez/lib \
LOCAL_CFLAGS := $(BLUEZ_COMMON_CFLAGS)
+LOCAL_STATIC_LIBRARIES := \
+ bluetooth-headers \
+
LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
LOCAL_MODULE_TAGS := debug
LOCAL_MODULE := l2test
@@ -350,10 +341,12 @@ LOCAL_SRC_FILES := \
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/bluez \
- $(LOCAL_PATH)/bluez/lib \
LOCAL_CFLAGS := $(BLUEZ_COMMON_CFLAGS)
+LOCAL_STATIC_LIBRARIES := \
+ bluetooth-headers \
+
LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
LOCAL_MODULE_TAGS := debug
LOCAL_MODULE := btmgmt
@@ -374,10 +367,12 @@ LOCAL_SRC_FILES := \
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/bluez \
- $(LOCAL_PATH)/bluez/lib \
LOCAL_CFLAGS := $(BLUEZ_COMMON_CFLAGS)
+LOCAL_STATIC_LIBRARIES := \
+ bluetooth-headers \
+
LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
LOCAL_MODULE_TAGS := debug
LOCAL_MODULE := hcitool
@@ -395,11 +390,11 @@ LOCAL_SRC_FILES := \
bluez/lib/bluetooth.c \
bluez/lib/hci.c \
-LOCAL_C_INCLUDES := \
- $(LOCAL_PATH)/bluez/lib \
-
LOCAL_CFLAGS := $(BLUEZ_COMMON_CFLAGS)
+LOCAL_STATIC_LIBRARIES := \
+ bluetooth-headers \
+
LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
LOCAL_MODULE_TAGS := debug
LOCAL_MODULE := l2ping
@@ -417,11 +412,11 @@ LOCAL_SRC_FILES := \
bluez/lib/bluetooth.c \
bluez/lib/hci.c \
-LOCAL_C_INCLUDES := \
- $(LOCAL_PATH)/bluez/lib \
-
LOCAL_CFLAGS := $(BLUEZ_COMMON_CFLAGS)
+LOCAL_STATIC_LIBRARIES := \
+ bluetooth-headers \
+
LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
LOCAL_MODULE_TAGS := debug
LOCAL_MODULE := avtest
@@ -490,3 +485,22 @@ LOCAL_REQUIRED_MODULES := \
include $(BUILD_EXECUTABLE)
endif
+
+#
+# bluetooth-headers
+#
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := bluetooth-headers
+LOCAL_NODULE_TAGS := optional
+LOCAL_MODULE_CLASS := STATIC_LIBRARIES
+
+include_path := $(local-intermediates-dir)/include
+include_files := $(wildcard $(LOCAL_PATH)/bluez/lib/*.h)
+$(shell mkdir -p $(include_path)/bluetooth)
+$(foreach file,$(include_files),$(shell cp -u $(file) $(include_path)/bluetooth))
+
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(include_path)
+
+include $(BUILD_STATIC_LIBRARY)
\ No newline at end of file
--
1.9.1
This patch adds additional dependency to configure.ac file for all
executables to make sure they are rebuilt every time BlueZ version is
chaned. Otherwise, it's possible to have BlueZ built from most recent
commit but with old version number since this information is extracted
from configure.ac and then passed via -D preprocessor option which does
not trigger rebuild when value changes.
---
android/Android.mk | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/android/Android.mk b/android/Android.mk
index c31b57e..e5723cc 100644
--- a/android/Android.mk
+++ b/android/Android.mk
@@ -94,6 +94,8 @@ else
LOCAL_MODULE := bluetoothd
endif
+LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/bluez/configure.ac
+
include $(BUILD_EXECUTABLE)
#
@@ -212,6 +214,8 @@ LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
LOCAL_MODULE_TAGS := debug
LOCAL_MODULE := btmon
+LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/bluez/configure.ac
+
include $(BUILD_EXECUTABLE)
#
@@ -234,6 +238,8 @@ LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
LOCAL_MODULE_TAGS := debug
LOCAL_MODULE := btproxy
+LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/bluez/configure.ac
+
include $(BUILD_EXECUTABLE)
#
@@ -284,6 +290,8 @@ LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
LOCAL_MODULE_TAGS := debug
LOCAL_MODULE := l2test
+LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/bluez/configure.ac
+
include $(BUILD_EXECUTABLE)
#
@@ -306,6 +314,8 @@ LOCAL_CFLAGS := $(BLUEZ_COMMON_CFLAGS)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := bluetoothd-snoop
+LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/bluez/configure.ac
+
include $(BUILD_EXECUTABLE)
#
@@ -351,6 +361,8 @@ LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
LOCAL_MODULE_TAGS := debug
LOCAL_MODULE := btmgmt
+LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/bluez/configure.ac
+
include $(BUILD_EXECUTABLE)
#
@@ -377,6 +389,8 @@ LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
LOCAL_MODULE_TAGS := debug
LOCAL_MODULE := hcitool
+LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/bluez/configure.ac
+
include $(BUILD_EXECUTABLE)
#
@@ -399,6 +413,8 @@ LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
LOCAL_MODULE_TAGS := debug
LOCAL_MODULE := l2ping
+LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/bluez/configure.ac
+
include $(BUILD_EXECUTABLE)
#
@@ -421,6 +437,8 @@ LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
LOCAL_MODULE_TAGS := debug
LOCAL_MODULE := avtest
+LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/bluez/configure.ac
+
include $(BUILD_EXECUTABLE)
#
--
1.9.1