From 32dc46797cde8fde2f5a46df12cc9477fe183c17 Mon Sep 17 00:00:00 2001 From: Alvaro Soliverez Date: Fri, 11 Nov 2011 15:44:08 -0300 Subject: [PATCH 2/2] Support building for Android, modified from an original patch by Derek Foreman --- .gitignore | 1 + Android.mk | 40 +++++++++++++++++++++++++++++++++++ mission-control-plugins/Makefile.am | 11 +++++++++ mission-control-plugins/loader.c | 11 +++++++- server/Makefile.am | 13 +++++++++++ server/mc-server.c | 8 +++++++ src/Makefile.am | 11 +++++++++ util/Makefile.am | 13 +++++++++++ 8 files changed, 106 insertions(+), 2 deletions(-) create mode 100644 Android.mk diff --git a/.gitignore b/.gitignore index 7435c96..7f4497f 100644 --- a/.gitignore +++ b/.gitignore @@ -29,6 +29,7 @@ /doc/reference/mission-control-plugins/*.txt .libs .deps +Android.mk Makefile Makefile.in _gen/ diff --git a/Android.mk b/Android.mk new file mode 100644 index 0000000..e16fb6b --- /dev/null +++ b/Android.mk @@ -0,0 +1,40 @@ +LOCAL_PATH:= $(call my-dir) + +include $(CLEAR_VARS) + +TELEPATHY_MISSION_CONTROL_BUILT_SOURCES := \ + mission-control.pc \ + src/Android.mk \ + server/Android.mk \ + mission-control-plugins/Android.mk \ + util/Android.mk + +telepathy-mission-control-configure-real: + cd $(TELEPATHY_MISSION_CONTROL_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) \ + $(TELEPATHY_MISSION_CONTROL_TOP)/$(CONFIGURE) --host=arm-linux-androideabi \ + --disable-gtk-doc && \ + for file in $(TELEPATHY_MISSION_CONTROL_BUILT_SOURCES); do \ + rm -f $$file && \ + make -C $$(dirname $$file) $$(basename $$file) ; \ + done + +telepathy-mission-control-configure: telepathy-mission-control-configure-real + +.PHONY: telepathy-mission-control-configure + +CONFIGURE_TARGETS += telepathy-mission-control-configure + +#include all the subdirs... +-include $(TELEPATHY_MISSION_CONTROL_TOP)/src/Android.mk +-include $(TELEPATHY_MISSION_CONTROL_TOP)/util/Android.mk +-include $(TELEPATHY_MISSION_CONTROL_TOP)/server/Android.mk +-include $(TELEPATHY_MISSION_CONTROL_TOP)/mission-control-plugins/Android.mk +-include $(TELEPATHY_MISSION_CONTROL_TOP)/utils/Android.mk diff --git a/mission-control-plugins/Makefile.am b/mission-control-plugins/Makefile.am index dfbb2cb..0a0ba61 100644 --- a/mission-control-plugins/Makefile.am +++ b/mission-control-plugins/Makefile.am @@ -61,6 +61,17 @@ libmission_control_plugins_la_SOURCES = \ BUILT_SOURCES = $(nodist_libmission_control_plugins_la_SOURCES) +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer -:PROJECT telepathy-mission-control \ + -:SHARED libmission-control-plugins \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(BUILT_SOURCES) $(libmission_control_plugins_la_SOURCES) \ + -:CFLAGS $(DEFAULT_INCLUDES) $(DEFS) $(CFLAGS) $(AM_CFLAGS) \ + -:CPPFLAGS $(CPPFLAGS) $(AM_CPPFLAGS) $(INCLUDES) \ + -:LDFLAGS $(libmission_control_plugins_la_LIBADD) \ + > $@ + CLEANFILES = $(BUILT_SOURCES) %-signals-marshal.h: %-signals-marshal.list Makefile diff --git a/mission-control-plugins/loader.c b/mission-control-plugins/loader.c index f7de04c..7fa600a 100644 --- a/mission-control-plugins/loader.c +++ b/mission-control-plugins/loader.c @@ -52,6 +52,13 @@ static gboolean debugging = FALSE; G_STMT_START { if (debugging || mcp_is_debugging (MCP_DEBUG_LOADER)) \ g_debug ("%s " format, G_STRLOC, ##__VA_ARGS__); } G_STMT_END +/* Android's build system prefixes the plugins with lib */ +#ifndef __BIONIC__ +#define PLUGIN_PREFIX "mcp-" +#else +#define PLUGIN_PREFIX "libmcp-" +#endif + /** * mcp_set_debug: * @debug: whether to log debug output @@ -146,9 +153,9 @@ mcp_read_dir (const gchar *path) gchar *full_path; GModule *module; - if (!g_str_has_prefix (entry, "mcp-")) + if (!g_str_has_prefix (entry, PLUGIN_PREFIX)) { - DEBUG ("%s isn't a plugin (doesn't start with mcp-)", entry); + DEBUG ("%s isn't a plugin (doesn't start with " PLUGIN_PREFIX ")", entry); continue; } diff --git a/server/Makefile.am b/server/Makefile.am index c363853..1ad4d68 100644 --- a/server/Makefile.am +++ b/server/Makefile.am @@ -39,4 +39,17 @@ mission_control_5_LDADD = \ $(top_builddir)/src/libmissioncontrol-server.la \ $(top_builddir)/mission-control-plugins/libmission-control-plugins.la +Android.mk: Makefile.am + androgenizer -:PROJECT telepathy-mission-control \ + -:SHARED libmission-control-5 -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(mission_control_5_SOURCES) \ + -:CFLAGS $(DEFAULT_INCLUDES) $(DEFS) $(CFLAGS) $(AM_CFLAGS) \ + -:CPPFLAGS $(CPPFLAGS) $(AM_CPPFLAGS) $(INCLUDES) \ + -DBUILD_AS_ANDROID_SERVICE \ + -:LDFLAGS $(mission_control_5_LDADD) -ldbus-1 -ldbus-glib-1 \ + -:LIBFILTER_STATIC missioncontrol-server mission-control-plugins \ + mcclient \ + > $@ + endif diff --git a/server/mc-server.c b/server/mc-server.c index a711433..a830c81 100644 --- a/server/mc-server.c +++ b/server/mc-server.c @@ -33,6 +33,10 @@ static TpDebugSender *debug_sender; +#ifdef BUILD_AS_ANDROID_SERVICE +int telepathy_mission_control_main (int argc, char **argv); +#endif + static void on_abort (McdService * mcd) { @@ -46,7 +50,11 @@ on_abort (McdService * mcd) } int +#ifdef BUILD_AS_ANDROID_SERVICE +telepathy_mission_control_main (int argc, char **argv) +#else main (int argc, char **argv) +#endif { McdService *mcd; diff --git a/src/Makefile.am b/src/Makefile.am index 781bdef..9f9f06a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -279,6 +279,17 @@ EXTRA_DIST = \ mcd-signals-marshal.list \ stamp-mcd-enum-types.h +Android.mk: Makefile.am $(nodist_libmcd_convenience_la_SOURCES) + androgenizer -:PROJECT telepathy-mission-control \ + -:STATIC libmissioncontrol-server \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libmcd_convenience_la_SOURCES) $(nodist_libmcd_convenience_la_SOURCES) \ + -:CFLAGS $(DEFAULT_INCLUDES) $(INCLUDES) $(DEFS) $(CFLAGS) $(AM_CFLAGS) \ + -:CPPFLAGS $(CPPFLAGS) $(AM_CPPFLAGS) \ + -:LDFLAGS $(libmcd_convenience_la_LIBADD) \ + > $@ + # ---- telepathy-glib-style code generation ---- tools_dir = $(top_srcdir)/tools diff --git a/util/Makefile.am b/util/Makefile.am index ba595af..65df5cd 100644 --- a/util/Makefile.am +++ b/util/Makefile.am @@ -1,10 +1,12 @@ AM_CPPFLAGS = \ -I$(top_srcdir) \ $(DBUS_CFLAGS) \ + $(LIBFFI_CFLAGS) \ $(GLIB_CFLAGS) \ $(TELEPATHY_CFLAGS) LDADD = \ + $(LIBFFI_LIBS) \ $(GLIB_LIBS) \ $(DBUS_LIBS) \ $(TELEPATHY_LIBS) @@ -27,3 +29,14 @@ CLEANFILES = $(man1_MANS) mc-wait-for-name.1: mc-wait-for-name.1.in Makefile $(AM_V_GEN)sed -e 's![@]bindir[@]!@bindir@!g' < $< > $@ + +Android.mk: Makefile.am + androgenizer -:PROJECT telepathy_mission_controll \ + -:EXECUTABLE mc-tool -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(mc_tool_SOURCES) \ + -:CFLAGS $(DEFS) $(CFLAGS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CFLAGS) \ + -:CPPFLAGS $(CPPFLAGS) $(AM_CPPFLAGS) \ + -:LDFLAGS $(mc_tool_LDADD) -lgio-2.0 -lglib-2.0 -lffi \ + > $@ -- 1.7.7