0
0
mirror of https://github.com/zeromq/libzmq.git synced 2024-12-26 23:01:04 +08:00

Merge pull request #4449 from stephan57160/master

Problem: Android helpers must provide build/clone functions.
This commit is contained in:
Luca Boccassi 2022-10-24 19:58:49 +02:00 committed by GitHub
commit bfd506094a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 45 additions and 25 deletions

View File

@ -445,6 +445,48 @@ function android_show_configure_opts {
echo ""
}
function android_clone_library {
local tag="$1" ; shift
local clone_root="$1" ; shift
local clone_url="$1" ; shift
local clone_branch="$1" ; shift
mkdir -p "$(dirname "${clone_root}")"
if [ -n "${clone_branch}" ] ; then
android_build_trace "Cloning '${clone_url}' (branch '${clone_branch}') under '${clone_root}'."
git clone --quiet --depth 1 -b "${clone_branch}" "${clone_url}" "${clone_root}"
else
android_build_trace "Cloning '${clone_url}' (default branch) under '${clone_root}'."
git clone --quiet --depth 1 "${clone_url}" "${clone_root}"
fi
( cd "${clone_root}" && git log --oneline -n 1) || exit 1
}
# Caller must set CONFIG_OPTS before call.
function android_build_library {
local tag=$1 ; shift
local clone_root=$1 ; shift
android_build_trace "Cleaning library '${tag}'."
(
cd "${clone_root}" \
&& ( make clean || : ) && \
rm -f config.status
) || exit 1
(
# Remove *.la files as they might cause errors with cross compiled libraries
find "${ANDROID_BUILD_PREFIX}" -name '*.la' -exec rm {} +
cd "${clone_root}" \
&& ./autogen.sh \
&& android_show_configure_opts "${tag}" "${CONFIG_OPTS[@]}" \
&& ./configure "${CONFIG_OPTS[@]}" \
&& make -j 4 \
&& make install
) || exit 1
}
########################################################################
# Initialization
########################################################################

View File

@ -126,13 +126,7 @@ elif [ "${CURVE}" == "libsodium" ]; then
(android_build_verify_so "libsodium.so" &> /dev/null) || {
if [ ! -d "${LIBSODIUM_ROOT}" ] ; then
android_build_trace "Cloning 'https://github.com/jedisct1/libsodium.git' (branch 'stable') under '${LIBSODIUM_ROOT}'."
mkdir -p "$(dirname "${LIBSODIUM_ROOT}")"
git clone --quiet -b stable --depth 1 https://github.com/jedisct1/libsodium.git "${LIBSODIUM_ROOT}"
( cd "${LIBSODIUM_ROOT}" && git log --oneline -n 1) || exit 1
else
android_build_trace "Cleaning LIBSODIUM folder '${LIBSODIUM_ROOT}'."
( cd "${LIBSODIUM_ROOT}" && (make clean || :) && rm -f config.status ) || exit 1
android_clone_library "LIBSODIUM" "${LIBSODIUM_ROOT}" "https://github.com/jedisct1/libsodium.git" "stable"
fi
(
@ -141,15 +135,7 @@ elif [ "${CURVE}" == "libsodium" ]; then
CONFIG_OPTS+=("${ANDROID_BUILD_OPTS[@]}")
CONFIG_OPTS+=("--disable-soname-versions")
# Remove *.la files as they might cause errors with cross compiled libraries
find "${ANDROID_BUILD_PREFIX}" -name '*.la' -exec rm {} +
cd "${LIBSODIUM_ROOT}" \
&& ./autogen.sh \
&& android_show_configure_opts "LIBSODIUM" "${CONFIG_OPTS[@]}" \
&& ./configure "${CONFIG_OPTS[@]}" \
&& make -j 4 \
&& make install
android_build_library "LIBSODIUM" "${LIBSODIUM_ROOT}"
) || exit 1
}
elif [ $CURVE == "tweetnacl" ]; then
@ -170,15 +156,7 @@ fi
CONFIG_OPTS+=("${CURVE}")
CONFIG_OPTS+=("--without-docs")
# Remove *.la files as they might cause errors with cross compiled libraries
find "${ANDROID_BUILD_PREFIX}" -name '*.la' -exec rm {} +
cd "${LIBZMQ_ROOT}" \
&& ./autogen.sh \
&& android_show_configure_opts "LIBZMQ" "${CONFIG_OPTS[@]}" \
&& ./configure "${CONFIG_OPTS[@]}" \
&& make -j 4 \
&& make install
android_build_library "LIBZMQ" "${LIBZMQ_ROOT}"
) || exit 1
}