mirror of
https://github.com/zeromq/libzmq.git
synced 2025-03-17 08:34:00 +00:00
How to reproduce: ``` prompt> git clone libzmq prompt> cd libzmq/builds/android prompt> export CURVE=libsodium prompt> ./ci_build.sh Cloning into 'libsodium'... fatal: unable to connect to github.com: github.com[0: 140.82.121.4]: errno=Connection timed out Cloning into 'libsodium'... fatal: unable to connect to github.com: github.com[0: 140.82.121.3]: errno=Connection timed out Cloning into 'libsodium'... fatal: unable to connect to github.com: github.com[0: 140.82.121.3]: errno=Connection timed out Cloning into 'libsodium'... fatal: unable to connect to github.com: github.com[0: 140.82.121.4]: errno=Connection timed out prompt> ``` Reason: Invalid URL to download libsodium: ``` prompt> grep -s 'git clone' libzmq/builds/android/*.sh libzmq/builds/android/build.sh:70: (cd "${cache}" && git clone -b stable --depth 1 git://github.com/jedisct1/libsod ^^^^^^^^^^^^^^^^^ ``` URL should be either: - `git@github.com:` - `https://github.com/` same given in [zproject](https://github.com/zeromq/zproject/blob/master/zproject_known_projects.xml#L108-L111). Solution: Change URL to `https://`. Result: ``` prompt> export CURVE=libsodium prompt> ./ci_build.sh Cloning into 'libsodium'... remote: Enumerating objects: 659, done. remote: Counting objects: 100% (659/659), done. remote: Compressing objects: 100% (586/586), done. remote: Total 659 (delta 159), reused 220 (delta 34), pack-reused 0 Receiving objects: 100% (659/659), 1.97 MiB | 4.00 MiB/s, done. Resolving deltas: 100% (159/159), done. autoconf scripts already exist. ... libtool: install: /bin/install -c tools/.libs/curve_keygen /home/cbox_dev/git/ZEROMQ/libzmq/builds/android/prefix/x86_64/bin/curve_keygen /bin/mkdir -p '/home/cbox_dev/git/ZEROMQ/libzmq/builds/android/prefix/x86_64/include' /bin/install -c -m 644 include/zmq.h include/zmq_utils.h '/home/cbox_dev/git/ZEROMQ/libzmq/builds/android/prefix/x86_64/include' /bin/mkdir -p '/home/cbox_dev/git/ZEROMQ/libzmq/builds/android/prefix/x86_64/lib/pkgconfig' /bin/install -c -m 644 src/libzmq.pc '/home/cbox_dev/git/ZEROMQ/libzmq/builds/android/prefix/x86_64/lib/pkgconfig' make[2]: Leaving directory `/tmp/android_build/x86_64/libzmq' make[1]: Leaving directory `/tmp/android_build/x86_64/libzmq' libzmq android build succeeded prompt> ```
102 lines
2.8 KiB
Bash
Executable File
102 lines
2.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
function usage {
|
|
echo "Usage ./build.sh [ arm | arm64 | x86 | x86_64 ]"
|
|
}
|
|
|
|
# Use directory of current script as the build directory and working directory
|
|
cd "$( dirname "${BASH_SOURCE[0]}" )"
|
|
ANDROID_BUILD_DIR="${ANDROID_BUILD_DIR:-`pwd`}"
|
|
|
|
# Get access to android_build functions and variables
|
|
source ./android_build_helper.sh
|
|
|
|
# Choose a C++ standard library implementation from the ndk
|
|
ANDROID_BUILD_CXXSTL="gnustl_shared_49"
|
|
|
|
BUILD_ARCH=$1
|
|
if [ -z $BUILD_ARCH ]; then
|
|
usage
|
|
exit 1
|
|
fi
|
|
|
|
case $(uname | tr '[:upper:]' '[:lower:]') in
|
|
linux*)
|
|
export HOST_PLATFORM=linux-x86_64
|
|
;;
|
|
darwin*)
|
|
export HOST_PLATFORM=darwin-x86_64
|
|
;;
|
|
*)
|
|
echo "Unsupported platform"
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
# Set default values used in ci builds
|
|
export NDK_VERSION=${NDK_VERSION:-android-ndk-r24}
|
|
# With NDK r22b, the minimum SDK version range is [16, 31].
|
|
# Since NDK r24, the minimum SDK version range is [19, 31].
|
|
# SDK version 21 is the minimum version for 64-bit builds.
|
|
export MIN_SDK_VERSION=${MIN_SDK_VERSION:-21}
|
|
|
|
# Set up android build environment and set ANDROID_BUILD_OPTS array
|
|
android_build_set_env $BUILD_ARCH
|
|
android_build_env
|
|
android_build_opts
|
|
|
|
# Use a temporary build directory
|
|
cache="/tmp/android_build/${TOOLCHAIN_ARCH}"
|
|
rm -rf "${cache}"
|
|
mkdir -p "${cache}"
|
|
|
|
# Check for environment variable to clear the prefix and do a clean build
|
|
if [[ $ANDROID_BUILD_CLEAN ]]; then
|
|
echo "Doing a clean build (removing previous build and dependencies)..."
|
|
rm -rf "${ANDROID_BUILD_PREFIX}"/*
|
|
fi
|
|
|
|
if [ -z $CURVE ]; then
|
|
CURVE="--disable-curve"
|
|
VERIFY="libzmq.so"
|
|
elif [ $CURVE == "libsodium" ]; then
|
|
CURVE="--with-libsodium=yes"
|
|
VERIFY="libzmq.so libsodium.so"
|
|
##
|
|
# Build libsodium from latest master branch
|
|
|
|
(android_build_verify_so "libsodium.so" &> /dev/null) || {
|
|
rm -rf "${cache}/libsodium"
|
|
(cd "${cache}" && git clone -b stable --depth 1 https://github.com/jedisct1/libsodium.git) || exit 1
|
|
(cd "${cache}/libsodium" && ./autogen.sh \
|
|
&& ./configure --quiet "${ANDROID_BUILD_OPTS[@]}" --disable-soname-versions \
|
|
&& make -j 4 \
|
|
&& make install) || exit 1
|
|
}
|
|
elif [ $CURVE == "tweetnacl" ]; then
|
|
# Default
|
|
CURVE=""
|
|
VERIFY="libzmq.so"
|
|
fi
|
|
|
|
##
|
|
# Build libzmq from local source
|
|
|
|
LIBTOOL_EXTRA_LDFLAGS='-avoid-version'
|
|
|
|
(android_build_verify_so ${VERIFY} &> /dev/null) || {
|
|
rm -rf "${cache}/libzmq"
|
|
(cp -r ../.. "${cache}/libzmq" && cd "${cache}/libzmq" && make clean)
|
|
|
|
(cd "${cache}/libzmq" && ./autogen.sh \
|
|
&& ./configure --quiet "${ANDROID_BUILD_OPTS[@]}" ${CURVE} --without-docs \
|
|
&& make -j 4 \
|
|
&& make install) || exit 1
|
|
}
|
|
|
|
##
|
|
# Verify shared libraries in prefix
|
|
|
|
android_build_verify_so ${VERIFY}
|
|
echo "libzmq android build succeeded"
|