[zeromq-dev] [PATCH] Preliminary Android support for trunk ZeroMQ
Martin Sustrik
sustrik at 250bpm.com
Sat Nov 6 18:12:03 CET 2010
Hi Ghislain,
Great work!
Is there a reason why the build for Android isn't integrated with
existing autotools build system?
Martin
On 11/06/2010 03:39 PM, Ghislain PUTOIS wrote:
> Dear all,
>
> Here is a small patch to ease the cross-compilation of the trunk on
> the Android platform, which is mostly a LINUX platform, except form
> some missing POSIX functions.
> You can also find a compiled version and a copy of the sources I am
> currently using for cross-compiling to Android on
> http://ghislain.putois.free.fr/azmq.tar.bz2 .
> The tar.bz2 package contains a copy of uuid and zmq sources. It
> requires the unofficial NDK R4 by CrystaX.
>
>
> From 7c3e67e49f50d19891186fd264392df41bc79fea Mon Sep 17 00:00:00 2001
> From: Ghislain Putois <ghpu at ultraguile.(none)>
> Date: Sat, 6 Nov 2010 15:28:33 +0100
> Subject: [PATCH] Signed-off-by: Ghislain Putois <ghpu at infonie.fr
> <mailto:ghpu at infonie.fr>>
>
> Some small changes to prepare a cross-compilation for the Android
> platform.
> ---
> src/Android.mk | 10 ++++++++++
> src/ip.cpp | 2 +-
> src/swap.cpp | 2 ++
> src/thread.cpp | 2 ++
> 4 files changed, 15 insertions(+), 1 deletions(-)
> create mode 100644 src/Android.mk
>
> diff --git a/src/Android.mk b/src/Android.mk
> new file mode 100644
> index 0000000..dff161b
> --- /dev/null
> +++ b/src/Android.mk
> @@ -0,0 +1,10 @@
> +LOCAL_PATH := $(call my-dir)
> +include $(CLEAR_VARS)
> +
> +APP_PLATFORM = android-8
> +
> +LOCAL_MODULE := libzmq
> +LOCAL_SRC_FILES := clock.cpp options.cpp socket_base.cpp command.cpp
> own.cpp streamer.cpp connect_session.cpp pair.cpp sub.cpp ctx.cpp
> pgm_receiver.cpp swap.cpp decoder.cpp pgm_sender.cpp tcp_connecter.cpp
> devpoll.cpp pgm_socket.cpp tcp_listener.cpp encoder.cpp pipe.cpp
> tcp_socket.cpp epoll.cpp poll.cpp thread.cpp err.cpp poller_base.cpp
> transient_session.cpp forwarder.cpp pub.cpp trie.cpp fq.cpp pull.cpp
> uuid.cpp io_object.cpp push.cpp xrep.cpp io_thread.cpp queue.cpp
> xreq.cpp ip.cpp rep.cpp zmq_connecter.cpp kqueue.cpp req.cpp zmq.cpp
> lb.cpp select.cpp zmq_engine.cpp named_session.cpp session.cpp
> zmq_init.cpp object.cpp zmq_listener.cpp mailbox.cpp
> +
> +LOCAL_LDLIBS := -luuid -lc -lm -lstdc++
> +include $(BUILD_SHARED_LIBRARY)
> diff --git a/src/ip.cpp b/src/ip.cpp
> index eb05aec..736ea04 100644
> --- a/src/ip.cpp
> +++ b/src/ip.cpp
> @@ -89,7 +89,7 @@ static int resolve_nic_name (in_addr* addr_, char
> const *interface_)
> return 0;
> }
>
> -#elif defined ZMQ_HAVE_AIX || ZMQ_HAVE_HPUX
> +#elif defined ZMQ_HAVE_AIX || ZMQ_HAVE_HPUX || ANDROID
>
> #include <sys/types.h>
> #include <unistd.h>
> diff --git a/src/swap.cpp b/src/swap.cpp
> index e3cc63e..4d03b27 100644
> --- a/src/swap.cpp
> +++ b/src/swap.cpp
> @@ -111,9 +111,11 @@ int zmq::swap_t::init ()
> return -1;
>
> #ifdef ZMQ_HAVE_LINUX
> +#ifndef ANDROID
> // Enable more aggresive read-ahead optimization.
> posix_fadvise (fd, 0, filesize, POSIX_FADV_SEQUENTIAL);
> #endif
> +#endif
> return 0;
> }
>
> diff --git a/src/thread.cpp b/src/thread.cpp
> index 2edd85b..ac3312a 100644
> --- a/src/thread.cpp
> +++ b/src/thread.cpp
> @@ -71,9 +71,11 @@ void *zmq::thread_t::thread_routine (void *arg_)
> sigset_t signal_set;
> int rc = sigfillset (&signal_set);
> errno_assert (rc == 0);
> +#if !defined ANDROID
> rc = pthread_sigmask (SIG_BLOCK, &signal_set, NULL);
> errno_assert (rc == 0);
> #endif
> +#endif
>
> thread_t *self = (thread_t*) arg_;
> self->tfn (self->arg);
> --
> 1.7.1
>
>
> Yours,
>
> --
> Ghislain PUTOIS
> ghpu at infonie.fr <mailto:ghpu at infonie.fr>
>
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20101106/5f6effeb/attachment.htm>
More information about the zeromq-dev
mailing list