diff options
author | Alvaro Soliverez <alvaro.soliverez@collabora.co.uk> | 2011-11-15 13:05:47 -0300 |
---|---|---|
committer | Will Thompson <will.thompson@collabora.co.uk> | 2011-11-21 16:17:41 +0000 |
commit | 792de10dae3550745cab0a77d1782292920f0545 (patch) | |
tree | cd1816727319cd121f2fa0bec5f73ae9a5f81f32 | |
parent | 18f9ec73803444748068880efc5ddda1a6340cd7 (diff) |
Support building on Android
This patch makes it possible to use installed versions of Wocky and
Yell, rather than submodules; adds a missing explicit dependency on gio;
and adds Androgenizer build targets.
Modified from an original patch by Derek Foreman.
https://bugs.freedesktop.org/show_bug.cgi?id=42446
-rw-r--r-- | gabble/.gitignore | 1 | ||||
-rw-r--r-- | gabble/Android.mk | 41 | ||||
-rwxr-xr-x | gabble/autogen.sh | 43 | ||||
-rw-r--r-- | gabble/configure.ac | 18 | ||||
-rw-r--r-- | gabble/extensions/Makefile.am | 11 | ||||
-rw-r--r-- | gabble/lib/gibber/Makefile.am | 10 | ||||
-rw-r--r-- | gabble/lib/loudmouth/Makefile.am | 10 | ||||
-rw-r--r-- | gabble/src/Makefile.am | 11 | ||||
-rw-r--r-- | gabble/src/main.c | 7 |
9 files changed, 133 insertions, 19 deletions
diff --git a/gabble/.gitignore b/gabble/.gitignore index c9ffc6f9d..2ede58eb3 100644 --- a/gabble/.gitignore +++ b/gabble/.gitignore @@ -16,6 +16,7 @@ .deps .libs .svn +Android.mk FIXME.out /INSTALL Makefile diff --git a/gabble/Android.mk b/gabble/Android.mk new file mode 100644 index 000000000..7e6533204 --- /dev/null +++ b/gabble/Android.mk @@ -0,0 +1,41 @@ +LOCAL_PATH:= $(call my-dir) + +include $(CLEAR_VARS) + +TELEPATHY_GABBLE_BUILT_SOURCES := \ + gabble/telepathy-gabble.pc \ + gabble/telepathy-gabble-uninstalled.pc \ + src/Android.mk \ + lib/gibber/Android.mk \ + lib/loudmouth/Android.mk \ + extensions/Android.mk + +telepathy-gabble-configure-real: + cd $(TELEPATHY_GABBLE_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_GABBLE_TOP)/$(CONFIGURE) --host=arm-linux-androideabi \ + --disable-submodules \ + --disable-Werror --without-ca-certificates && \ + for file in $(TELEPATHY_GABBLE_BUILT_SOURCES); do \ + rm -f $$file && \ + make -C $$(dirname $$file) $$(basename $$file) ; \ + done + +telepathy-gabble-configure: telepathy-gabble-configure-real + +.PHONY: telepathy-gabble-configure + +CONFIGURE_TARGETS += telepathy-gabble-configure + +#include all the subdirs... +-include $(TELEPATHY_GABBLE_TOP)/src/Android.mk +-include $(TELEPATHY_GABBLE_TOP)/lib/gibber/Android.mk +-include $(TELEPATHY_GABBLE_TOP)/lib/loudmouth/Android.mk +-include $(TELEPATHY_GABBLE_TOP)/extensions/Android.mk diff --git a/gabble/autogen.sh b/gabble/autogen.sh index 1de819581..27fa0501a 100755 --- a/gabble/autogen.sh +++ b/gabble/autogen.sh @@ -16,23 +16,36 @@ fi autoreconf -i -f -# Fetch submodules if needed -if test ! -f lib/ext/wocky/autogen.sh -o ! -f lib/ext/telepathy-yell/autogen.sh; -then - echo "+ Setting up submodules" - git submodule init -fi -git submodule update +#Check if submodules should be enabled +enable_submodules=true +for arg in $*; do + case $arg in + --disable-submodules) + enable_submodules=false + ;; + *) + ;; + esac +done + +if test $enable_submodules = true; then + # Fetch submodules if needed + if test ! -f lib/ext/wocky/autogen.sh -o ! -f lib/ext/telepathy-yell/autogen.sh; then + echo "+ Setting up submodules" + git submodule init + fi + git submodule update -# launch Wocky's autogen.sh -cd lib/ext/wocky -sh autogen.sh --no-configure -cd ../../.. + # launch Wocky's autogen.sh + cd lib/ext/wocky + sh autogen.sh --no-configure + cd ../../.. -# launch tp-yell's autogen.sh -cd lib/ext/telepathy-yell -sh autogen.sh --no-configure -cd ../../.. + # launch tp-yell's autogen.sh + cd lib/ext/telepathy-yell + sh autogen.sh --no-configure + cd ../../.. +fi # Honor NOCONFIGURE for compatibility with gnome-autogen.sh if test x"$NOCONFIGURE" = x; then diff --git a/gabble/configure.ac b/gabble/configure.ac index 7579d8c72..ebc4a0939 100644 --- a/gabble/configure.ac +++ b/gabble/configure.ac @@ -204,12 +204,14 @@ AC_ARG_ENABLE(gtk-doc, AM_CONDITIONAL([ENABLE_GTK_DOC], [test "x$enable_gtk_doc" = xyes]) dnl Check for Glib -PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.24, gobject-2.0 >= 2.24, gthread-2.0 >= 2.24]) +PKG_CHECK_MODULES(GLIB, + [glib-2.0 >= 2.24, gobject-2.0 >= 2.24, gthread-2.0 >= 2.24, gio-2.0]) PKG_CHECK_MODULES(GMODULE, [gmodule-2.0 >= 2.24]) AC_SUBST(GLIB_CFLAGS) AC_SUBST(GLIB_LIBS) + GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0` AC_SUBST(GLIB_GENMARSHAL) @@ -317,15 +319,25 @@ ac_top_build_prefix=$prev_top_build_prefix ac_configure_args=$prev_ac_configure_args +dnl Check if Android build +AC_ARG_ENABLE(submodules, + AS_HELP_STRING([--disable-submodules],[Use system versions of Wocky and Telepathy-Yell, rather than submodules]), + build_submodules=$enableval, build_submodules=yes ) + dnl Check for Wocky # re-enable once Wocky has been released as a lib -export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:"$ac_top_build_prefix"lib/ext/wocky/wocky +if test x$build_submodules = xyes; then + export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:"$ac_top_build_prefix"lib/ext/wocky/wocky +fi + PKG_CHECK_MODULES(WOCKY, wocky >= 0.0.0) AC_SUBST(WOCKY_CFLAGS) AC_SUBST(WOCKY_LIBS) dnl Check for tp-yell -export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:"$ac_top_build_prefix"lib/ext/telepathy-yell/telepathy-yell +if test x$build_submodules = xyes; then + export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:"$ac_top_build_prefix"lib/ext/telepathy-yell/telepathy-yell +fi PKG_CHECK_MODULES(TP_YELL, telepathy-yell) AC_SUBST(TP_YELL_CFLAGS) AC_SUBST(TP_YELL_LIBS) diff --git a/gabble/extensions/Makefile.am b/gabble/extensions/Makefile.am index 27d471fa0..96dabe2bd 100644 --- a/gabble/extensions/Makefile.am +++ b/gabble/extensions/Makefile.am @@ -97,3 +97,14 @@ _gen/gtypes.h _gen/gtypes-body.h: _gen/all.xml \ $(tools_dir)/glib-gtypes-generator.py Makefile.am $(AM_V_GEN)$(PYTHON) $(tools_dir)/glib-gtypes-generator.py \ $< _gen/gtypes Gabble + +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer -:PROJECT telepathy-gabble -:STATIC gabble-extensions -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgabble_extensions_la_SOURCES) \ + $(nodist_libgabble_extensions_la_SOURCES) \ + -:CFLAGS $(DEFS) $(CFLAGS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CFLAGS) \ + -:CPPFLAGS $(CPPFLAGS) $(AM_CPPFLAGS) \ + -:LDFLAGS $(libgabble_extensions_la_LIBADD) \ + > $@ diff --git a/gabble/lib/gibber/Makefile.am b/gabble/lib/gibber/Makefile.am index d02cc5f8c..f50bfd02e 100644 --- a/gabble/lib/gibber/Makefile.am +++ b/gabble/lib/gibber/Makefile.am @@ -64,3 +64,13 @@ gibber-signals-marshal.list: $(OUR_SOURCES) Makefile.am AM_CFLAGS = $(ERROR_CFLAGS) $(GCOV_CFLAGS) @GLIB_CFLAGS@ @GMODULE_CFLAGS@ -fno-strict-aliasing AM_LDFLAGS = $(GCOV_LIBS) @GLIB_LIBS@ + +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer -:PROJECT telepathy-gabble -:STATIC gibber -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgibber_la_SOURCES) \ + -:CFLAGS $(DEFS) $(CFLAGS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CFLAGS) \ + -:CPPFLAGS $(CPPFLAGS) $(AM_CPPFLAGS) \ + -:LDFLAGS $(AM_LDFLAGS) \ + > $@ diff --git a/gabble/lib/loudmouth/Makefile.am b/gabble/lib/loudmouth/Makefile.am index 51c13aab3..63aed69f6 100644 --- a/gabble/lib/loudmouth/Makefile.am +++ b/gabble/lib/loudmouth/Makefile.am @@ -63,3 +63,13 @@ loudmouth-signals-marshal.list: $(OUR_SOURCES) Makefile.am AM_CFLAGS = $(ERROR_CFLAGS) $(GCOV_CFLAGS) @GLIB_CFLAGS@ @WOCKY_CFLAGS@ AM_LDFLAGS = $(GCOV_LIBS) @GLIB_LIBS@ @WOCKY_LIBS@ + +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer -:PROJECT telepathy-gabble -:STATIC loudmouth -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libloudmouth_la_SOURCES) \ + -:CFLAGS $(DEFS) $(CFLAGS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CFLAGS) \ + -:CPPFLAGS $(CPPFLAGS) $(AM_CPPFLAGS) \ + -:LDFLAGS $(libloudmouth_la_LIBADD) \ + > $@ diff --git a/gabble/src/Makefile.am b/gabble/src/Makefile.am index 772e428cf..36477041e 100644 --- a/gabble/src/Makefile.am +++ b/gabble/src/Makefile.am @@ -277,3 +277,14 @@ gabble-enumtypes.c: $(enumtype_sources) Makefile.in --vprod " { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \ --vtail " { 0, NULL, NULL }\n };\n etype = g_@type@_register_static (\"@EnumName@\", values);\n }\n return etype;\n}\n" \ $(enumtype_sources) > $@ + +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer -:PROJECT telepathy-gabble -:SHARED telepathy-gabble -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgabble_convenience_la_SOURCES) \ + $(nodist_libgabble_convenience_la_SOURCES) main.c \ + -:CFLAGS $(DEFS) $(CFLAGS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CFLAGS) -DBUILD_AS_ANDROID_SERVICE \ + -:CPPFLAGS $(CPPFLAGS) $(AM_CPPFLAGS) $(telepathy_gabble_LDFLAGS) \ + -:LDFLAGS $(telepathy_gabble_LDADD) $(libgabble_convenience_la_LIBADD) \ + > $@ diff --git a/gabble/src/main.c b/gabble/src/main.c index e6fc2288f..462183c7d 100644 --- a/gabble/src/main.c +++ b/gabble/src/main.c @@ -21,7 +21,12 @@ #include "gabble.h" int -main (int argc, +#ifdef BUILD_AS_ANDROID_SERVICE +telepathy_gabble_main +#else +main +#endif + (int argc, char **argv) { gabble_init (); |