Skip to content

Commit

Permalink
Fix 32 bit arm build & fix openssl api suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
robertying committed Dec 16, 2020
1 parent d320d9e commit 9ab10f0
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 12 deletions.
22 changes: 12 additions & 10 deletions build-curl.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#!/bin/bash

export TOOLCHAIN=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/$HOST_TAG
PATH=$TOOLCHAIN/bin:$PATH
export TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/$HOST_TAG

# curl common configuration arguments
ARGUMENTS=\
ARGUMENTS=" \
--disable-shared \
--disable-verbose \
--disable-manual \
Expand Down Expand Up @@ -33,11 +32,12 @@ ARGUMENTS=\
--disable-smtp \
--disable-smtps \
--disable-telnet \
--disable-tftp
--disable-tftp \
"

mkdir -p build/curl
cd curl
./buildconf
autoreconf -fi

# arm64
export TARGET_HOST=aarch64-linux-android
Expand Down Expand Up @@ -65,13 +65,15 @@ cp -R $PWD/build/$ANDROID_ARCH ../build/curl/
# arm
export TARGET_HOST=armv7a-linux-androideabi
export ANDROID_ARCH=armeabi-v7a
export AR=$TOOLCHAIN/bin/$TARGET_HOST-ar
export AS=$TOOLCHAIN/bin/$TARGET_HOST-as

# for 32-bit ARM, the compiler is prefixed with armv7a-linux-androideabi, but the binutils tools are prefixed with arm-linux-androideabi
export AR=$TOOLCHAIN/bin/arm-linux-androideabi-ar
export AS=$TOOLCHAIN/bin/arm-linux-androideabi-as
export CC=$TOOLCHAIN/bin/$TARGET_HOST$MIN_SDK_VERSION-clang
export CXX=$TOOLCHAIN/bin/$TARGET_HOST$MIN_SDK_VERSION-clang++
export LD=$TOOLCHAIN/bin/$TARGET_HOST-ld
export RANLIB=$TOOLCHAIN/bin/$TARGET_HOST-ranlib
export STRIP=$TOOLCHAIN/bin/$TARGET_HOST-strip
export LD=$TOOLCHAIN/bin/arm-linux-androideabi-ld
export RANLIB=$TOOLCHAIN/bin/arm-linux-androideabi-ranlib
export STRIP=$TOOLCHAIN/bin/arm-linux-androideabi-strip
export SSL_DIR=$PWD/../openssl/build/$ANDROID_ARCH

./configure --host=$TARGET_HOST \
Expand Down
17 changes: 15 additions & 2 deletions build-openssl.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/bin/bash

export TOOLCHAIN=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/$HOST_TAG
export TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/$HOST_TAG

# openssl refers to the host specific toolchain as "ANDROID_NDK_HOME"
export ANDROID_NDK_HOME=$TOOLCHAIN
PATH=$TOOLCHAIN/bin:$PATH

mkdir -p build/openssl
Expand All @@ -10,6 +13,9 @@ cd openssl
export TARGET_HOST=aarch64-linux-android
export ANDROID_ARCH=arm64-v8a

# openssl does not handle api suffix well
ln -sfn $TOOLCHAIN/bin/$TARGET_HOST$MIN_SDK_VERSION-clang $TOOLCHAIN/bin/$TARGET_HOST-clang

./Configure android-arm64 no-shared \
-D__ANDROID_API__=$MIN_SDK_VERSION \
--prefix=$PWD/build/$ANDROID_ARCH
Expand All @@ -21,9 +27,12 @@ mkdir -p ../build/openssl/$ANDROID_ARCH
cp -R $PWD/build/$ANDROID_ARCH ../build/openssl/

# arm
export TARGET_HOST=armv7a-linux-androideabi
export TARGET_HOST=arm-linux-androideabi
export ANDROID_ARCH=armeabi-v7a

# for 32-bit ARM, the compiler is prefixed with armv7a-linux-androideabi, but the binutils tools are prefixed with arm-linux-androideabi
ln -sfn $TOOLCHAIN/bin/armv7a-linux-androideabi$MIN_SDK_VERSION-clang $TOOLCHAIN/bin/$TARGET_HOST-clang

./Configure android-arm no-shared \
-D__ANDROID_API__=$MIN_SDK_VERSION \
--prefix=$PWD/build/$ANDROID_ARCH
Expand All @@ -38,6 +47,8 @@ cp -R $PWD/build/$ANDROID_ARCH ../build/openssl/
export TARGET_HOST=i686-linux-android
export ANDROID_ARCH=x86

ln -sfn $TOOLCHAIN/bin/$TARGET_HOST$MIN_SDK_VERSION-clang $TOOLCHAIN/bin/$TARGET_HOST-clang

./Configure android-x86 no-shared \
-D__ANDROID_API__=$MIN_SDK_VERSION \
--prefix=$PWD/build/$ANDROID_ARCH
Expand All @@ -52,6 +63,8 @@ cp -R $PWD/build/$ANDROID_ARCH ../build/openssl/
export TARGET_HOST=x86_64-linux-android
export ANDROID_ARCH=x86_64

ln -sfn $TOOLCHAIN/bin/$TARGET_HOST$MIN_SDK_VERSION-clang $TOOLCHAIN/bin/$TARGET_HOST-clang

./Configure android-x86_64 no-shared \
-D__ANDROID_API__=$MIN_SDK_VERSION \
--prefix=$PWD/build/$ANDROID_ARCH
Expand Down

0 comments on commit 9ab10f0

Please sign in to comment.