From 283cba3e8e118dd6aaacdd616b0b53ece2b1243f Mon Sep 17 00:00:00 2001 From: Alvaro Soliverez Date: Fri, 11 Nov 2011 14:57:00 -0300 Subject: [PATCH] Support building on Android Modified from an original patch by Derek Foremen --- autogen.sh | 44 +++++++++++++++++++++++++++++--------------- configure.ac | 14 ++++++++++++-- extensions/Makefile.am | 11 +++++++++++ lib/gibber/Makefile.am | 10 ++++++++++ lib/loudmouth/Makefile.am | 10 ++++++++++ src/Makefile.am | 12 ++++++++++++ src/main.c | 7 ++++++- 7 files changed, 90 insertions(+), 18 deletions(-) diff --git a/autogen.sh b/autogen.sh index 1de8195..ab95b92 100755 --- a/autogen.sh +++ b/autogen.sh @@ -16,23 +16,37 @@ 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/configure.ac b/configure.ac index 57d6f84..c111e8a 100644 --- a/configure.ac +++ b/configure.ac @@ -328,15 +328,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],[compile Android code]), + 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/extensions/Makefile.am b/extensions/Makefile.am index 9595750..d6c4338 100644 --- a/extensions/Makefile.am +++ b/extensions/Makefile.am @@ -91,3 +91,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/lib/gibber/Makefile.am b/lib/gibber/Makefile.am index d02cc5f..f50bfd0 100644 --- a/lib/gibber/Makefile.am +++ b/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/lib/loudmouth/Makefile.am b/lib/loudmouth/Makefile.am index 51c13aa..63aed69 100644 --- a/lib/loudmouth/Makefile.am +++ b/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/src/Makefile.am b/src/Makefile.am index 9fb8f5cd..31f0185 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -277,3 +277,15 @@ 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) -lgio-2.0 -ldbus-1 \ + -lsoup -lgabble_ext -lnice -lgcrypt -lgnutls -lxml2 -lsqlite3 \ + > $@ diff --git a/src/main.c b/src/main.c index e6fc228..462183c 100644 --- a/src/main.c +++ b/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 (); -- 1.7.7