Skip to content

Commit

Permalink
Problem: ZYRE (Android) is out of sync with ZProject.
Browse files Browse the repository at this point in the history
Solution: Generate ZYRE with ZProject (Android modifications only).
  • Loading branch information
stephan57160 committed Nov 22, 2022
1 parent 59cacb7 commit 04d8e53
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 19 deletions.
21 changes: 9 additions & 12 deletions bindings/jni/ci_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export CI_TRACE="${CI_TRACE:-no}"
# If you have your own source tree for XXX, uncomment its
# XXX_ROOT configuration line below, and provide its absolute tree:
# export LIBZMQ_ROOT="<absolute_path_to_LIBZMQ_source_tree>"
# export LIBCZMQ_ROOT="<absolute_path_to_CZMQ_source_tree>"
# export CZMQ_ROOT="<absolute_path_to_CZMQ_source_tree>"

########################################################################
# Preparation
Expand All @@ -41,8 +41,13 @@ export CI_TRACE="${CI_TRACE:-no}"
# Perform some sanity checks and calculate some variables.
source "${PROJECT_ROOT}/builds/android/android_build_helper.sh"

# Initialize our dependency _ROOT variables:
android_init_dependency_root "libzmq" # Check or initialize LIBZMQ_ROOT
android_init_dependency_root "libczmq" # Check or initialize LIBCZMQ_ROOT
android_init_dependency_root "czmq" # Check or initialize CZMQ_ROOT

# Fetch required dependencies:
[ ! -d "${LIBZMQ_ROOT}" ] && android_clone_library "LIBZMQ" "${LIBZMQ_ROOT}" "https://github.com/zeromq/libzmq.git" ""
[ ! -d "${CZMQ_ROOT}" ] && android_clone_library "CZMQ" "${CZMQ_ROOT}" "https://github.com/zeromq/czmq.git" ""

android_download_ndk

Expand Down Expand Up @@ -84,27 +89,19 @@ mkdir -p /tmp/tmp-deps

######################
# Build native 'libzmq.so'
if [ ! -d "${LIBZMQ_ROOT}" ] ; then
android_clone_library "LIBZMQ" "${LIBZMQ_ROOT}" "https://github.com/zeromq/libzmq.git" ""
fi

(
android_build_library "LIBZMQ" "${LIBZMQ_ROOT}"
)


######################
# Build native 'libczmq.so'
if [ ! -d "${LIBCZMQ_ROOT}" ] ; then
android_clone_library "CZMQ" "${LIBCZMQ_ROOT}" "https://github.com/zeromq/czmq.git" ""
fi

(
android_build_library "CZMQ" "${LIBCZMQ_ROOT}"
android_build_library "CZMQ" "${CZMQ_ROOT}"
)

# Build jni dependency
( cd ${LIBCZMQ_ROOT}/bindings/jni && TERM=dumb $CI_TIME ./gradlew publishToMavenLocal ${GRADLEW_OPTS[@]} ${CZMQ_GRADLEW_OPTS} )
( cd ${CZMQ_ROOT}/bindings/jni && TERM=dumb $CI_TIME ./gradlew publishToMavenLocal ${GRADLEW_OPTS[@]} ${CZMQ_GRADLEW_OPTS} )

######################
# Build native 'libzyre.so'
Expand Down
4 changes: 2 additions & 2 deletions bindings/jni/zyre-jni/android/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ GRADLEW_OPTS+=("--info")

# Build any dependent libraries
# Use a default value assuming that dependent libraries sit alongside this one
( cd ${LIBCZMQ_ROOT:-../../../../../czmq}/bindings/jni/czmq-jni/android; ./build.sh $BUILD_ARCH )
( cd ${CZMQ_ROOT}/bindings/jni/czmq-jni/android; ./build.sh $BUILD_ARCH )

# Ensure we've built dependencies for Android
android_build_trace "Building Android native libraries"
Expand Down Expand Up @@ -112,7 +112,7 @@ make $MAKE_OPTIONS
android_build_trace "Building jar for $TOOLCHAIN_ABI"
# Copy class files into org/zeromq/etc.
find ../../build/libs/ -type f -name 'zyre-jni-*.jar' ! -name '*javadoc.jar' ! -name '*sources.jar' -exec unzip -q {} +
unzip -qo "${LIBCZMQ_ROOT:-../../../../../../czmq}/bindings/jni/czmq-jni/android/czmq-android*$TOOLCHAIN_ABI*.jar"
unzip -qo "${CZMQ_ROOT}/bindings/jni/czmq-jni/android/czmq-android*$TOOLCHAIN_ABI*.jar"

# Copy native libraries into lib/$TOOLCHAIN_ABI
mkdir -p lib/$TOOLCHAIN_ABI
Expand Down
11 changes: 6 additions & 5 deletions builds/android/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,13 @@ function usage {
BUILD_ARCH="$1"
[ -z "${BUILD_ARCH}" ] && usage

# Initialize our dependency _ROOT variables:
android_init_dependency_root "libzmq" # Check or initialize LIBZMQ_ROOT
android_init_dependency_root "libczmq" # Check or initialize LIBCZMQ_ROOT
android_init_dependency_root "czmq" # Check or initialize CZMQ_ROOT

# Fetch required dependencies:
[ ! -d "${LIBZMQ_ROOT}" ] && android_clone_library "LIBZMQ" "${LIBZMQ_ROOT}" "https://github.com/zeromq/libzmq.git" ""
[ ! -d "${CZMQ_ROOT}" ] && android_clone_library "CZMQ" "${CZMQ_ROOT}" "https://github.com/zeromq/czmq.git" ""

case "$CI_TIME" in
[Yy][Ee][Ss]|[Oo][Nn]|[Tt][Rr][Uu][Ee])
Expand Down Expand Up @@ -122,10 +127,6 @@ DEPENDENCIES=()

DEPENDENCIES+=("libczmq.so")
(android_build_verify_so "libczmq.so" &> /dev/null) || {
if [ ! -d "${CZMQ_ROOT}" ] ; then
android_clone_library "CZMQ" "${CZMQ_ROOT}" "https://github.com/zeromq/czmq.git" ""
fi

if [ -f "${CZMQ_ROOT}/builds/android/build.sh" ] ; then
(
bash "${CZMQ_ROOT}/builds/android/build.sh" "${BUILD_ARCH}"
Expand Down

0 comments on commit 04d8e53

Please sign in to comment.