X-Git-Url: https://git.openssl.org/?p=openssl.git;a=blobdiff_plain;f=Configurations%2F15-android.conf;h=7b496a4529bd3072663fa08515125711d8bf81a7;hp=f9ad0833fafd70cf8405632f983405b74fb544ca;hb=3405db97e5448c784729b56837f3f8c776a01067;hpb=71f2b3171e8b94b0fbdc7fab2d7ca4ea66edec2b diff --git a/Configurations/15-android.conf b/Configurations/15-android.conf index f9ad0833fa..7b496a4529 100644 --- a/Configurations/15-android.conf +++ b/Configurations/15-android.conf @@ -22,13 +22,19 @@ return $android_ndk = { bn_ops => "BN_AUTO" }; } - my $ndk = $ENV{ANDROID_NDK}; - die "\$ANDROID_NDK is not defined" if (!$ndk); + my $ndk_var; + my $ndk; + foreach (qw(ANDROID_NDK_HOME ANDROID_NDK)) { + $ndk_var = $_; + $ndk = $ENV{$ndk_var}; + last if defined $ndk; + } + die "\$ANDROID_NDK_HOME is not defined" if (!$ndk); if (!-d "$ndk/platforms" && !-f "$ndk/AndroidVersion.txt") { # $ndk/platforms is traditional "all-inclusive" NDK, while # $ndk/AndroidVersion.txt is so-called standalone toolchain # tailored for specific target down to API level. - die "\$ANDROID_NDK=$ndk is invalid"; + die "\$ANDROID_NDK_HOME=$ndk is invalid"; } $ndk = canonpath($ndk); @@ -90,10 +96,15 @@ (my $tridefault = $triarch) =~ s/^arm-/$arm-/; (my $tritools = $triarch) =~ s/(?:x|i6)86(_64)?-.*/x86$1/; $cflags .= " -target $tridefault " - . "-gcc-toolchain \$(ANDROID_NDK)/toolchains" + . "-gcc-toolchain \$($ndk_var)/toolchains" . "/$tritools-4.9/prebuilt/$host"; $user{CC} = "clang" if ($user{CC} !~ m|clang|); $user{CROSS_COMPILE} = undef; + if (which("llvm-ar") =~ m|^$ndk/.*/prebuilt/([^/]+)/|) { + $user{AR} = "llvm-ar"; + $user{ARFLAGS} = [ "rs" ]; + $user{RANLIB} = ":"; + } } elsif (-f "$ndk/AndroidVersion.txt") { #"standalone toolchain" my $cc = $user{CC} // "clang"; # One can probably argue that both clang and gcc should be @@ -122,13 +133,13 @@ die "no $incroot/$triarch" if (!-d "$incroot/$triarch"); $incroot =~ s|^$ndk/||; $cppflags = "-D__ANDROID_API__=$api"; - $cppflags .= " -isystem \$(ANDROID_NDK)/$incroot/$triarch"; - $cppflags .= " -isystem \$(ANDROID_NDK)/$incroot"; + $cppflags .= " -isystem \$($ndk_var)/$incroot/$triarch"; + $cppflags .= " -isystem \$($ndk_var)/$incroot"; } $sysroot =~ s|^$ndk/||; $android_ndk = { - cflags => "$cflags --sysroot=\$(ANDROID_NDK)/$sysroot", + cflags => "$cflags --sysroot=\$($ndk_var)/$sysroot", cppflags => $cppflags, bn_ops => $arch =~ m/64$/ ? "SIXTY_FOUR_BIT_LONG" : "BN_LLONG",