From 65ee86c7d4828425b7e64097cbcbc3af71f844fb Mon Sep 17 00:00:00 2001 From: Andrey Pavlenko Date: Tue, 25 May 2021 22:27:20 +0300 Subject: [PATCH] Libraries update. --- build.gradle | 13 ++-- cmake/OpenSSL.cmake | 3 +- patches/openssl_ndk22.patch | 140 ++++++++++++++++++++++++++++++++++++ 3 files changed, 149 insertions(+), 7 deletions(-) create mode 100644 patches/openssl_ndk22.patch diff --git a/build.gradle b/build.gradle index 28a116c..95feb34 100644 --- a/build.gradle +++ b/build.gradle @@ -1,20 +1,20 @@ -def version = '1.3.6' -def versionNum = 9000010 +def version = '1.3.7' +def versionNum = 9000013 buildscript { repositories { google() - jcenter() + mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:4.1.3' + classpath 'com.android.tools.build:gradle:4.2.1' } } repositories { google() - jcenter() + mavenCentral() } apply plugin: 'com.android.application' @@ -37,6 +37,7 @@ android { } ndk { + debugSymbolLevel 'FULL' abiFilters 'arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64' } } @@ -97,7 +98,7 @@ android { dependencies { implementation 'com.android.support:appcompat-v7:28.0.0' implementation 'com.android.support:design:28.0.0' - testImplementation 'junit:junit:4.12' + testImplementation 'junit:junit:4.13.2' androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' } diff --git a/cmake/OpenSSL.cmake b/cmake/OpenSSL.cmake index 5b3804c..75510b6 100644 --- a/cmake/OpenSSL.cmake +++ b/cmake/OpenSSL.cmake @@ -37,9 +37,10 @@ set(OPENSSL_INCLUDE_DIR "${OPENSSL_ROOT_DIR}/include") message(STATUS "OpenSSL config: ${OPENSSL_CONFIGURE_OPTS}") ExternalProject_Add(openssl - URL "https://www.openssl.org/source/openssl-1.1.1k.tar.gz" + URL "https://www.openssl.org/source/openssl-1.1.1j.tar.gz" PREFIX openssl BUILD_IN_SOURCE 1 + PATCH_COMMAND patch -p1 -i ${CMAKE_SOURCE_DIR}/patches/openssl_ndk22.patch CONFIGURE_COMMAND ${OPENSSL_CONFIGURE_CMD} ${OPENSSL_CONFIGURE_OPTS} BUILD_COMMAND ${OPENSSL_BUILD_CMD} INSTALL_COMMAND ${MAKE_EXE} install_sw DESTDIR=${OPENSSL_INSTALL_DIR} diff --git a/patches/openssl_ndk22.patch b/patches/openssl_ndk22.patch new file mode 100644 index 0000000..ee558af --- /dev/null +++ b/patches/openssl_ndk22.patch @@ -0,0 +1,140 @@ +diff --git a/Configurations/15-android.conf b/Configurations/15-android.conf +index 4616394f8cfd..c09bf2917e56 100644 +--- a/Configurations/15-android.conf ++++ b/Configurations/15-android.conf +@@ -29,18 +29,18 @@ + $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_HOME=$ndk is invalid"; ++ die "\$ANDROID_NDK_ROOT is not defined" if (!$ndk); ++ my $is_standalone_toolchain = -f "$ndk/AndroidVersion.txt"; ++ my $ndk_src_props = "$ndk/source.properties"; ++ my $is_ndk = -f $ndk_src_props; ++ if ($is_ndk == $is_standalone_toolchain) { ++ die "\$ANDROID_NDK_ROOT=$ndk is invalid"; + } + $ndk = canonpath($ndk); + + my $ndkver = undef; + +- if (open my $fh, "<$ndk/source.properties") { ++ if (open my $fh, "<$ndk_src_props") { + local $_; + while(<$fh>) { + if (m|Pkg\.Revision\s*=\s*([0-9]+)|) { +@@ -59,7 +59,7 @@ + if ($sysroot = $ENV{CROSS_SYSROOT}) { + $sysroot =~ m|/android-([0-9]+)/arch-(\w+)/?$|; + ($api, $arch) = ($1, $2); +- } elsif (-f "$ndk/AndroidVersion.txt") { ++ } elsif ($is_standalone_toolchain) { + $sysroot = "$ndk/sysroot"; + } else { + $api = "*"; +@@ -72,17 +72,31 @@ + } + } + +- # list available platforms (numerically) +- my @platforms = sort { $a =~ m/-([0-9]+)$/; my $aa = $1; +- $b =~ m/-([0-9]+)$/; $aa <=> $1; +- } glob("$ndk/platforms/android-$api"); +- die "no $ndk/platforms/android-$api" if ($#platforms < 0); ++ if (-d "$ndk/platforms") { ++ # list available platforms (numerically) ++ my @platforms = sort { $a =~ m/-([0-9]+)$/; my $aa = $1; ++ $b =~ m/-([0-9]+)$/; $aa <=> $1; ++ } glob("$ndk/platforms/android-$api"); ++ die "no $ndk/platforms/android-$api" if ($#platforms < 0); + +- $sysroot = "@platforms[$#platforms]/arch-$arch"; +- $sysroot =~ m|/android-([0-9]+)/arch-$arch|; +- $api = $1; ++ $sysroot = "@platforms[$#platforms]/arch-$arch"; ++ $sysroot =~ m|/android-([0-9]+)/arch-$arch|; ++ $api = $1; ++ } elsif ($api eq "*") { ++ # r22 Removed platforms dir, use this JSON file ++ my $path = "$ndk/meta/platforms.json"; ++ open my $fh, $path or die "Could not open '$path' $!"; ++ while (<$fh>) { ++ if (/"max": (\d+),/) { ++ $api = $1; ++ last; ++ } ++ } ++ close $fh; ++ } ++ die "Could not get default API Level" if ($api eq "*"); + } +- die "no sysroot=$sysroot" if (!-d $sysroot); ++ die "no sysroot=$sysroot" if (length $sysroot && !-d $sysroot); + + my $triarch = $triplet{$arch}; + my $cflags; +@@ -95,17 +109,21 @@ + my $arm = $ndkver > 16 ? "armv7a" : "armv5te"; + (my $tridefault = $triarch) =~ s/^arm-/$arm-/; + (my $tritools = $triarch) =~ s/(?:x|i6)86(_64)?-.*/x86$1/; +- $cflags .= " -target $tridefault " +- . "-gcc-toolchain \$($ndk_var)/toolchains" +- . "/$tritools-4.9/prebuilt/$host"; +- $user{CC} = "clang" if ($user{CC} !~ m|clang|); ++ if (length $sysroot) { ++ $cflags .= " -target $tridefault " ++ . "-gcc-toolchain \$($ndk_var)/toolchains" ++ . "/$tritools-4.9/prebuilt/$host"; ++ $user{CC} = "clang" if ($user{CC} !~ m|clang|); ++ } else { ++ $user{CC} = "$tridefault$api-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" ++ } elsif ($is_standalone_toolchain) { + my $cc = $user{CC} // "clang"; + # One can probably argue that both clang and gcc should be + # probed, but support for "standalone toolchain" was added +@@ -127,19 +145,21 @@ + $user{CROSS_COMPILE} = "$triarch-"; + } + +- if (!-d "$sysroot/usr/include") { +- my $incroot = "$ndk/sysroot/usr/include"; +- die "no $incroot" if (!-d $incroot); +- die "no $incroot/$triarch" if (!-d "$incroot/$triarch"); +- $incroot =~ s|^$ndk/||; +- $cppflags = "-D__ANDROID_API__=$api"; +- $cppflags .= " -isystem \$($ndk_var)/$incroot/$triarch"; +- $cppflags .= " -isystem \$($ndk_var)/$incroot"; ++ if (length $sysroot) { ++ if (!-d "$sysroot/usr/include") { ++ my $incroot = "$ndk/sysroot/usr/include"; ++ die "no $incroot" if (!-d $incroot); ++ die "no $incroot/$triarch" if (!-d "$incroot/$triarch"); ++ $incroot =~ s|^$ndk/||; ++ $cppflags = "-D__ANDROID_API__=$api"; ++ $cppflags .= " -isystem \$($ndk_var)/$incroot/$triarch"; ++ $cppflags .= " -isystem \$($ndk_var)/$incroot"; ++ } ++ $sysroot =~ s|^$ndk/||; ++ $sysroot = " --sysroot=\$($ndk_var)/$sysroot"; + } +- +- $sysroot =~ s|^$ndk/||; + $android_ndk = { +- cflags => "$cflags --sysroot=\$($ndk_var)/$sysroot", ++ cflags => $cflags . $sysroot, + cppflags => $cppflags, + bn_ops => $arch =~ m/64$/ ? "SIXTY_FOUR_BIT_LONG" + : "BN_LLONG", \ No newline at end of file