forked from yan12125/python3-android
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathandroid.patch
More file actions
230 lines (228 loc) · 9.11 KB
/
Copy pathandroid.patch
File metadata and controls
230 lines (228 loc) · 9.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
diff --git a/Configurations/15-android.conf b/Configurations/15-android.conf
index 10342ed5e3..9c9ceb64df 100644
--- a/Configurations/15-android.conf
+++ b/Configurations/15-android.conf
@@ -3,147 +3,6 @@
# See NOTES.ANDROID for details, and don't miss platform-specific
# comments below...
-{
- use File::Spec::Functions;
-
- my $android_ndk = {};
- my %triplet = (
- arm => "arm-linux-androideabi",
- arm64 => "aarch64-linux-android",
- mips => "mipsel-linux-android",
- mips64 => "mips64el-linux-android",
- x86 => "i686-linux-android",
- x86_64 => "x86_64-linux-android",
- );
-
- sub android_ndk {
- unless (%$android_ndk) {
- if ($now_printing =~ m|^android|) {
- return $android_ndk = { bn_ops => "BN_AUTO" };
- }
-
- my $ndk = $ENV{ANDROID_NDK};
- die "\$ANDROID_NDK 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";
- }
- $ndk = canonpath($ndk);
-
- my $ndkver = undef;
-
- if (open my $fh, "<$ndk/source.properties") {
- local $_;
- while(<$fh>) {
- if (m|Pkg\.Revision\s*=\s*([0-9]+)|) {
- $ndkver = $1;
- last;
- }
- }
- close $fh;
- }
-
- my ($sysroot, $api, $arch);
-
- $config{target} =~ m|[^-]+-([^-]+)$|; # split on dash
- $arch = $1;
-
- if ($sysroot = $ENV{CROSS_SYSROOT}) {
- $sysroot =~ m|/android-([0-9]+)/arch-(\w+)/?$|;
- ($api, $arch) = ($1, $2);
- } elsif (-f "$ndk/AndroidVersion.txt") {
- $sysroot = "$ndk/sysroot";
- } else {
- $api = "*";
-
- # see if user passed -D__ANDROID_API__=N
- foreach (@{$useradd{CPPDEFINES}}, @{$user{CPPFLAGS}}) {
- if (m|__ANDROID_API__=([0-9]+)|) {
- $api = $1;
- last;
- }
- }
-
- # 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;
- }
- die "no sysroot=$sysroot" if (!-d $sysroot);
-
- my $triarch = $triplet{$arch};
- my $cflags;
- my $cppflags;
-
- # see if there is NDK clang on $PATH, "universal" or "standalone"
- if (which("clang") =~ m|^$ndk/.*/prebuilt/([^/]+)/|) {
- my $host=$1;
- # harmonize with gcc default
- 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 \$(ANDROID_NDK)/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
- # probed, but support for "standalone toolchain" was added
- # *after* announcement that gcc is being phased out, so
- # favouring clang is considered adequate. Those who insist
- # have option to enforce test for gcc with CC=gcc.
- if (which("$triarch-$cc") !~ m|^$ndk|) {
- die "no NDK $triarch-$cc on \$PATH";
- }
- $user{CC} = $cc;
- $user{CROSS_COMPILE} = "$triarch-";
- } elsif ($user{CC} eq "clang") {
- die "no NDK clang on \$PATH";
- } else {
- if (which("$triarch-gcc") !~ m|^$ndk/.*/prebuilt/([^/]+)/|) {
- die "no NDK $triarch-gcc on \$PATH";
- }
- $cflags .= " -mandroid";
- $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 \$(ANDROID_NDK)/$incroot/$triarch";
- $cppflags .= " -isystem \$(ANDROID_NDK)/$incroot";
- }
-
- $sysroot =~ s|^$ndk/||;
- $android_ndk = {
- cflags => "$cflags --sysroot=\$(ANDROID_NDK)/$sysroot",
- cppflags => $cppflags,
- bn_ops => $arch =~ m/64$/ ? "SIXTY_FOUR_BIT_LONG"
- : "BN_LLONG",
- };
- }
-
- return $android_ndk;
- }
-}
-
my %targets = (
"android" => {
inherit_from => [ "linux-generic32" ],
@@ -158,10 +17,6 @@ my %targets = (
# 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 => [ ],
},
@@ -194,62 +49,23 @@ my %targets = (
# Newer NDK versions reportedly require additional -latomic.
#
inherit_from => [ "android", asm("armv4_asm") ],
- bn_ops => add("RC4_CHAR"),
+ bn_ops => "BN_LLONG RC4_CHAR",
},
"android-arm64" => {
inherit_from => [ "android", asm("aarch64_asm") ],
- bn_ops => add("RC4_CHAR"),
+ bn_ops => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
perlasm_scheme => "linux64",
},
- "android-mips" => {
- inherit_from => [ "android", asm("mips32_asm") ],
- bn_ops => add("RC4_CHAR"),
- perlasm_scheme => "o32",
- },
- "android-mips64" => {
- ################################################################
- # You are more than likely have to specify target processor
- # on ./Configure command line. Trouble is that toolchain's
- # default is MIPS64r6 (at least in r10d), but there are no
- # such processors around (or they are too rare to spot one).
- # Actual problem is that MIPS64r6 is binary incompatible
- # with previous MIPS ISA versions, in sense that unlike
- # prior versions original MIPS binary code will fail.
- #
- inherit_from => [ "android", asm("mips64_asm") ],
- bn_ops => add("RC4_CHAR"),
- perlasm_scheme => "64",
- },
-
"android-x86" => {
inherit_from => [ "android", asm("x86_asm") ],
CFLAGS => add(picker(release => "-fomit-frame-pointer")),
- bn_ops => add("RC4_INT"),
+ bn_ops => "BN_LLONG RC4_INT",
perlasm_scheme => "android",
},
"android-x86_64" => {
inherit_from => [ "android", asm("x86_64_asm") ],
- bn_ops => add("RC4_INT"),
+ bn_ops => "SIXTY_FOUR_BIT_LONG RC4_INT",
perlasm_scheme => "elf",
},
-
- ####################################################################
- # Backward compatible targets, (might) requre $CROSS_SYSROOT
- #
- "android-armeabi" => {
- inherit_from => [ "android-arm" ],
- },
- "android64" => {
- inherit_from => [ "android" ],
- },
- "android64-aarch64" => {
- inherit_from => [ "android-arm64" ],
- },
- "android64-x86_64" => {
- inherit_from => [ "android-x86_64" ],
- },
- "android64-mips64" => {
- inherit_from => [ "android-mips64" ],
- },
);