├── configure_scripts ├── android_make_uuid.sh ├── android_make_zmq.sh └── android_make_jzmq.sh ├── Makefile └── README.md /configure_scripts/android_make_uuid.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | tools_prefix=$ARM_TOOLCHAIN/bin/arm-linux-androideabi 4 | 5 | if [ ! -f .is_configured ]; then \ 6 | CC=$tools_prefix-gcc \ 7 | LD=$tools_prefix-ld \ 8 | AR=$tools_prefix-ar \ 9 | AS=$tools_prefix-as \ 10 | RANLIB=$tools_prefix-ranlib \ 11 | ./configure --target=arm-linux-androideabi --host=arm-linux-androideabi --prefix=$INSTALL_PATH && \ 12 | touch .is_configured; fi 13 | -------------------------------------------------------------------------------- /configure_scripts/android_make_zmq.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | include_dir=$INSTALL_PATH/include 4 | lib_dir=$INSTALL_PATH/lib 5 | tools_prefix=$ARM_TOOLCHAIN/bin/arm-linux-androideabi 6 | 7 | if [ ! -f .is_configured ]; then \ 8 | LD_LIBRARY_PATH=$lib_dir \ 9 | CFLAGS="-fPIC -I$include_dir -I$ARM_TOOLCHAIN/arm-none-linux-gnueabi/include -Wl,-rpath=$ARM_TOOLCHAIN/arm-none-linux-gnueabi/lib" \ 10 | CPPFLAGS="-I$include_dir -fvisibility=default" \ 11 | LDFLAGS="-L$lib_dir -lgcc -Wl,-rpath=$lib_dir -Wl,-Bstatic -luuid -Wl,-Bdynamic" \ 12 | CC=$tools_prefix-gcc \ 13 | CXX=$tools_prefix-g++ \ 14 | LD=$tools_prefix-ld \ 15 | AR=$tools_prefix-ar \ 16 | AS=$tools_prefix-as \ 17 | RANLIB=$tools_prefix-ranlib \ 18 | ./configure --target=arm-linux-gnueabi --host=arm-linux-android --with-uuid=$INSTALL_PATH --enable-static --disable-shared --prefix=$INSTALL_PATH && \ 19 | touch .is_configured; fi 20 | -------------------------------------------------------------------------------- /configure_scripts/android_make_jzmq.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | include_dir=$INSTALL_PATH/include 5 | lib_dir=$INSTALL_PATH/lib 6 | tools_prefix=$ARM_TOOLCHAIN/bin/arm-linux-androideabi 7 | 8 | LD_LIBRARY_PATH=$lib_dir:$LD_LIBRARY_PATH 9 | 10 | 11 | # Avoid version numbering 12 | sed -i -e 's/^libjzmq_la_LDFLAGS = .*$/libjzmq_la_LDFLAGS = -avoid-version/' src/Makefile.am 13 | 14 | rm -f $INSTALL_PATH/lib/libzmq.la 15 | 16 | if [ ! -f .is_configured ]; then \ 17 | ./autogen.sh && \ 18 | PATH=$JAVA_HOME/bin:$PATH \ 19 | CFLAGS="-fPIC -I$include_dir -I$ARM_TOOLCHAIN/arm-linux-androideabi/include -Wl,-rpath=$ARM_TOOLCHAIN/arm-linux-androideabi/lib" \ 20 | CPPFLAGS="-I$include_dir" \ 21 | LDFLAGS="-L$lib_dir -Wl,-rpath=$lib_dir" \ 22 | LIBS="-luuid" \ 23 | CC=$tools_prefix-gcc \ 24 | CXX=$tools_prefix-g++ \ 25 | LD=$tools_prefix-ld \ 26 | AR=$tools_prefix-ar \ 27 | AS=$tools_prefix-as \ 28 | RANLIB=$tools_prefix-ranlib \ 29 | ./configure --target=arm-linux-gnueabi --host=arm-linux-gnueabi --prefix=$INSTALL_PATH --with-zeromq=$INSTALL_PATH && \ 30 | touch src/classdist_noinst.stamp && \ 31 | cd src && CLASSPATH=.:./.:$CLASSPATH javac -d . org/zeromq/ZMQ.java \ 32 | org/zeromq/ZMQException.java org/zeromq/ZMQQueue.java org/zeromq/ZMQForwarder.java \ 33 | org/zeromq/ZMQStreamer.java org/zeromq/ZContext.java org/zeromq/ZFrame.java org/zeromq/ZMsg.java && \ 34 | cd .. && \ 35 | touch .is_configured; fi 36 | 37 | 38 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | TOP_DIR := $(shell pwd) 2 | 3 | TARGET := $(INSTALL_PATH)/lib/libjzmq.so 4 | LIBZMQ := $(INSTALL_PATH)/lib/libzmq.a 5 | LIBUUID := $(INSTALL_PATH)/lib/libuuid.a 6 | 7 | zmq_dir := zeromq-2.2.0 8 | jzmq_dir := zeromq-jzmq-8522576 9 | uuid_dir := e2fsprogs-1.42.3 10 | 11 | zmq_url := http://download.zeromq.org/zeromq-2.2.0.tar.gz 12 | jzmq_url := https://github.com/zeromq/jzmq/tarball/v1.0.0 13 | uuid_url := http://downloads.sourceforge.net/project/e2fsprogs/e2fsprogs/v1.42.3/e2fsprogs-1.42.3.tar.gz 14 | 15 | 16 | .PHONY: all clean prereq cleanall 17 | 18 | define make_component 19 | cp $(TOP_DIR)/configure_scripts/$1 $2 && \ 20 | cd $(TOP_DIR)/$2 && \ 21 | ./$1 && \ 22 | cd $3 && \ 23 | $(MAKE) && \ 24 | $(MAKE) install 25 | endef 26 | 27 | all: | $(TARGET) 28 | 29 | prereq: $(zmq_dir) $(jzmq_dir) $(uuid_dir) 30 | 31 | 32 | # TODO: Replace those rules with implicits 33 | $(zmq_dir): $(notdir $(zmq_url)) 34 | tar xzf $< 35 | 36 | $(jzmq_dir): $(notdir $(jzmq_url)) 37 | tar xzf $< 38 | 39 | $(uuid_dir): $(notdir $(uuid_url)) 40 | tar xzf $< 41 | 42 | $(notdir $(zmq_url)): 43 | wget $(zmq_url) 44 | 45 | $(notdir $(jzmq_url)): 46 | wget $(jzmq_url) 47 | 48 | $(notdir $(uuid_url)): 49 | wget $(uuid_url) 50 | 51 | $(TARGET): | $(LIBZMQ) 52 | $(call make_component,android_make_jzmq.sh,$(jzmq_dir),.) 53 | 54 | $(LIBZMQ): | $(LIBUUID) 55 | $(call make_component,android_make_zmq.sh,$(zmq_dir),.) 56 | 57 | $(LIBUUID): | prereq 58 | $(call make_component,android_make_uuid.sh,$(uuid_dir),lib/uuid) 59 | 60 | clean: 61 | rm -rf $(jzmq_dir) 62 | rm -rf $(zmq_dir) 63 | rm -rf $(uuid_dir) 64 | 65 | cleanall: clean 66 | rm -rf $(INSTALL_PATH) 67 | rm -rf $(notdir $(zmq_url)) 68 | rm -rf $(notdir $(jzmq_url)) 69 | rm -rf $(notdir $(uuid_url)) 70 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | jzmq libraries for Android 2 | ========================== 3 | 4 | This package is intended to easily cross-compile the jzmq shared object and java 5 | sources for use within Android. 6 | 7 | You will end up with the genrated Java source files for jzmq and a shared library object, 8 | namely libjzmq.so whil will self-contain jzmq wrapper, zeromq library and libtool dependency. 9 | 10 | Hence, you can use it directly inside your APK for loading. 11 | 12 | 13 | Automatically downloaded packages 14 | --------------------------------- 15 | > e2fsprogs-1.43.1 16 | 17 | > zeromq-2.2.0 18 | 19 | > zeromq-jzmq-1.0.0 20 | 21 | All of them, stable version. 22 | 23 | 24 | 25 | Building steps 26 | -------------- 27 | 28 | ### Build the NDK ARM toolchain 29 | 30 | * Download the NDK from Google. 31 | * In the uncompressed folder, execute 32 | 33 | > sh build/tools/make-standalone-toolchain.sh 34 | 35 | * It builds a toolchain that you will have to uncompress somewhere 36 | 37 | > cd /opt 38 | 39 | > tar vjxf arm-linux-androideabi-4.4.3.tar.bz2 40 | 41 | * You now have the path /opt/arm-linux-androideabi-4.4.3 as toolchain path. 42 | 43 | ### Download the JDK from Oracle 44 | * Download and install a JDK from Oracle. 45 | * A 32-bit JDK-1.6.30 is recommended. 46 | 47 | ### Setup your environment 48 | 49 | > export JAVA_HOME=$HOME/work/bin/jdk1.6.0_30 50 | 51 | > export ARM_TOOLCHAIN=/opt/arm-linux-androideabi-4.4.3 52 | 53 | > export INSTALL_PATH=/opt/android-jzmq/output-arm 54 | 55 | Please select an INSTALL\_PATH that is writeable by you. 56 | 57 | ### Install the prerequisites 58 | 59 | > sudo apt-get install autoconf automake libtool 60 | 61 | ### Make 62 | 63 | > make all 64 | 65 | or, if your $INSTALL\_PATH is not directly writeable, 66 | 67 | > sudo make all 68 | 69 | 70 | Using it 71 | -------- 72 | 73 | You will find in your INSTALL\_PATH: 74 | 75 | * a *lib/libjzmq.so* file to copy to /libs/armeabi 76 | * a *share/java/zmq.jar* file to import into your project (In Eclipse, also tick _Order and Export_ accordingly) 77 | 78 | You can start using ZeroMQ in your project. 79 | 80 | License 81 | ------- 82 | LGPL 83 | --------------------------------------------------------------------------------