my%targets = ( "android" => { inherit_from => [ "linux-generic32" ], template =>1, ################################################################ # Special note about -pie. The underlying reason is that # Lollipop refuses to run non-PIE. But what about older systems # and NDKs? -fPIC was never problem, so the only concern is -pie. # Older toolchains, e.g. r4, appear to handle it and binaries # turn out mostly functional. "Mostly" means that oldest # Androids, such as Froyo, fail to handle executable, but newer # systems are perfectly capable of executing binaries targeting # Froyo. Keep in mind that in the nutshell Android builds are # about JNI, i.e. shared libraries, not applications. cflags => add(sub{ android_ndk()->{cflags} }), cppflags => add(sub{ android_ndk()->{cppflags} }), cxxflags => add(sub{ android_ndk()->{cflags} }), bn_ops =>sub{ android_ndk()->{bn_ops} }, bin_cflags =>"-pie", enable => [ ], shared_extension =>".so", ### 这一行是新加的 },
functionbuildopenssl() { androidarch=$1 toolchain=$2 if [ ! -f openssl-1.1.1o.tar.gz ]; then wget https://www.openssl.org/source/openssl-1.1.1o.tar.gz fi if [ !-d openssl-1.1.1o ]; then tar -xf openssl-1.1.1o.tar.gz fi if [ -z $ANDROID_NDK_HOME ]; then echo"missing ANDROID_NDK_HOME" exit fi pushd openssl-1.1.1o PATH=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$ANDROID_NDK_HOME/toolchains/${toolchain}-linux-androideabi-4.9/prebuilt/linux-x86_64/bin:$PATH ./Configure android-$androidarch -D__ANDROID_API__=26 make clean make popd }
buildopenssl arm64 aarch64 #buildopenssl arm arm #buildopenssl x86 x86 #buildopenssl x86_64 x86_64