From ad2cd63b02fbe828de9b0077c41152a6772590f8 Mon Sep 17 00:00:00 2001 From: Alvaro Soliverez Date: Mon, 7 Nov 2011 14:53:58 -0300 Subject: [PATCH 1/2] Support for building on Android Modified from a patch contributed by Derek Foreman --- .gitignore | 1 + Android.mk | 40 ++++++++++++++++++++++++++++++++++++++++ bus/Makefile.am | 9 +++++++++ dbus/Makefile.am | 14 ++++++++++++++ tools/Makefile.am | 17 +++++++++++++++++ 5 files changed, 81 insertions(+), 0 deletions(-) create mode 100644 Android.mk diff --git a/.gitignore b/.gitignore index db3db97..13dc88f 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,4 @@ tags /lcov.html/ /lcov.info /lcov.info.tmp +Android.mk diff --git a/Android.mk b/Android.mk new file mode 100644 index 0000000..0d03e8a --- /dev/null +++ b/Android.mk @@ -0,0 +1,40 @@ +LOCAL_PATH := $(call my-dir) +include $(CLEAR_VARS) + +DBUS_BUILT_SOURCES := \ + dbus/Android.mk \ + bus/Android.mk \ + tools/Android.mk + +DBUS_BUILT_SOURCES := $(patsubst %, $(abspath $(DBUS_TOP))/%, $(DBUS_BUILT_SOURCES)) + +.PHONY: dbus-configure + +dbus-configure-real: + cd $(DBUS_TOP) ; \ + CC="$(CONFIGURE_CC)" \ + CFLAGS="$(CONFIGURE_CFLAGS)" \ + LD=$(TARGET_LD) \ + LDFLAGS="$(CONFIGURE_LDFLAGS)" \ + CPP=$(CONFIGURE_CPP) \ + CPPFLAGS="$(CONFIGURE_CPPFLAGS)" \ + PKG_CONFIG_LIBDIR="$(CONFIGURE_PKG_CONFIG_LIBDIR)" \ + PKG_CONFIG_TOP_BUILD_DIR=$(PKG_CONFIG_TOP_BUILD_DIR) \ + ac_cv_func_posix_getpwnam_r=no \ + ac_cv_lib_expat_XML_ParserCreate_MM=yes \ + $(DBUS_TOP)/$(CONFIGURE) --host=arm-linux-androideabi && \ + for file in $(DBUS_BUILT_SOURCES); do \ + rm -f $$file && \ + make -C $$(dirname $$file) $$(basename $$file) ; \ + done + +$(BUILT_SOURCE): + make -C $$(dirname $(DBUS_TOP)/$@) $$(basename $@) + +dbus-configure: dbus-configure-real $(BUILT_SOURCES) + +CONFIGURE_TARGETS += dbus-configure + +-include $(DBUS_TOP)/dbus/Android.mk +-include $(DBUS_TOP)/bus/Android.mk +-include $(DBUS_TOP)/tools/Android.mk diff --git a/bus/Makefile.am b/bus/Makefile.am index 6cbc09a..37cdd82 100644 --- a/bus/Makefile.am +++ b/bus/Makefile.am @@ -168,6 +168,15 @@ if DBUS_UNIX libexec_PROGRAMS = dbus-daemon-launch-helper endif DBUS_UNIX +Android.mk: Makefile.am + androgenizer -:PROJECT dbus -:SHARED libdbus-daemon -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(dbus_daemon_SOURCES) \ + -:CFLAGS $(DEFS) $(CFLAGS) -DBUILD_AS_ANDROID_SERVICE \ + -:CPPFLAGS $(CPPFLAGS) $(AM_CPPFLAGS) $(INCLUDES) $(DEFAULT_INCLUDES) \ + -:LDFLAGS $(dbus_daemon_LDADD) -llog \ + > $@ + ## Note that TESTS has special meaning (stuff to use in make check). ## We don't actually want to run any of these tests until test/ has been ## compiled, so we don't put them in TESTS here; we run them in test/ diff --git a/dbus/Makefile.am b/dbus/Makefile.am index 3c44ae4..7114938 100644 --- a/dbus/Makefile.am +++ b/dbus/Makefile.am @@ -281,6 +281,20 @@ libdbus_internal_la_LIBADD=$(LIBDBUS_LIBS) noinst_PROGRAMS = +Android.mk: Makefile.am + androgenizer -:PROJECT dbus -:SHARED libdbus-1 -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libdbus_1_la_SOURCES) \ + -:CFLAGS $(DEFS) $(AM_CFLAGS) $(CFLAGS) \ + -:CPPFLAGS $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + -:LDFLAGS $(libdbus_1_la_LIBADD) -llog \ + -:STATIC libdbus-internal -:TAGS eng debug \ + -:SOURCES $(libdbus_internal_la_SOURCES) \ + -:CFLAGS $(DEFS) $(AM_CFLAGS) $(CFLAGS) \ + -:CPPFLAGS $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + -:LDFLAGS $(libdbus_internal_la_LIBADD) \ + > $@ + if DBUS_BUILD_TESTS # We can't actually run this til we've reached test/ noinst_PROGRAMS += dbus-test diff --git a/tools/Makefile.am b/tools/Makefile.am index 08b9023..60dfa14 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -74,3 +74,20 @@ CLEANFILES = \ #create the /var/lib/data directory for dbus-uuidgen localstatelibdir = $(localstatedir)/lib/dbus localstatelib_DATA = + +Android.mk: Makefile.am + androgenizer -:PROJECT dbus \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:EXECUTABLE dbus-send -:TAGS eng debug \ + -:SOURCES $(dbus_send_SOURCES) \ + -:CFLAGS $(DEFS) $(CFLAGS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CFLAGS) \ + -:CPPFLAGS $(CPPFLAGS) $(AM_CPPFLAGS) \ + -:LDFLAGS $(dbus_send_LDADD) -llog \ + -:EXECUTABLE dbus-monitor -:TAGS eng debug \ + -:SOURCES $(dbus_monitor_SOURCES) \ + -:CFLAGS $(DEFS) $(CFLAGS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CFLAGS) \ + -:CPPFLAGS $(CPPFLAGS) $(AM_CPPFLAGS) \ + -:LDFLAGS $(dbus_monitor_LDADD) -llog \ + > $@ -- 1.7.7