mirror of
https://github.com/python/cpython.git
synced 2026-04-14 07:41:00 +00:00
gh-146541: Allow building the Android testbed for 32-bit targets (#146542)
Allows building the Android testbed for 32-bit targets, adding the target triplets `arm-linux-androideabi` and `i686-linux-android`. Co-authored-by: Malcolm Smith <smith@chaquo.com>
This commit is contained in:
parent
dea4083aa9
commit
848bbe9ff2
5 changed files with 22 additions and 8 deletions
|
|
@ -34,7 +34,12 @@
|
|||
TESTBED_DIR = ANDROID_DIR / "testbed"
|
||||
CROSS_BUILD_DIR = PYTHON_DIR / "cross-build"
|
||||
|
||||
HOSTS = ["aarch64-linux-android", "x86_64-linux-android"]
|
||||
HOSTS = [
|
||||
"aarch64-linux-android",
|
||||
"arm-linux-androideabi",
|
||||
"i686-linux-android",
|
||||
"x86_64-linux-android",
|
||||
]
|
||||
APP_ID = "org.python.testbed"
|
||||
DECODE_ARGS = ("UTF-8", "backslashreplace")
|
||||
|
||||
|
|
@ -209,7 +214,7 @@ def unpack_deps(host, prefix_dir):
|
|||
os.chdir(prefix_dir)
|
||||
deps_url = "https://github.com/beeware/cpython-android-source-deps/releases/download"
|
||||
for name_ver in ["bzip2-1.0.8-3", "libffi-3.4.4-3", "openssl-3.5.5-0",
|
||||
"sqlite-3.50.4-0", "xz-5.4.6-1", "zstd-1.5.7-1"]:
|
||||
"sqlite-3.50.4-0", "xz-5.4.6-1", "zstd-1.5.7-2"]:
|
||||
filename = f"{name_ver}-{host}.tar.gz"
|
||||
download(f"{deps_url}/{name_ver}/{filename}")
|
||||
shutil.unpack_archive(filename)
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ val inSourceTree = (
|
|||
|
||||
val KNOWN_ABIS = mapOf(
|
||||
"aarch64-linux-android" to "arm64-v8a",
|
||||
"arm-linux-androideabi" to "armeabi-v7a",
|
||||
"i686-linux-android" to "x86",
|
||||
"x86_64-linux-android" to "x86_64",
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -697,12 +697,16 @@ def get_platform():
|
|||
# When Python is running on 32-bit ARM Android on a 64-bit ARM kernel,
|
||||
# 'os.uname().machine' is 'armv8l'. Such devices run the same userspace
|
||||
# code as 'armv7l' devices.
|
||||
# During the build process of the Android testbed when targeting 32-bit ARM,
|
||||
# '_PYTHON_HOST_PLATFORM' is 'arm-linux-androideabi', so 'machine' becomes
|
||||
# 'arm'.
|
||||
machine = {
|
||||
"x86_64": "x86_64",
|
||||
"i686": "x86",
|
||||
"aarch64": "arm64_v8a",
|
||||
"arm": "armeabi_v7a",
|
||||
"armv7l": "armeabi_v7a",
|
||||
"armv8l": "armeabi_v7a",
|
||||
"i686": "x86",
|
||||
"x86_64": "x86_64",
|
||||
}[machine]
|
||||
elif osname == "linux":
|
||||
# At least on Linux/Intel, 'machine' is the processor --
|
||||
|
|
|
|||
|
|
@ -371,11 +371,12 @@ def test_get_platform(self):
|
|||
sys.platform = 'android'
|
||||
get_config_vars()['ANDROID_API_LEVEL'] = 9
|
||||
for machine, abi in {
|
||||
'x86_64': 'x86_64',
|
||||
'i686': 'x86',
|
||||
'aarch64': 'arm64_v8a',
|
||||
'arm': 'armeabi_v7a',
|
||||
'armv7l': 'armeabi_v7a',
|
||||
'armv8l': 'armeabi_v7a',
|
||||
'i686': 'x86',
|
||||
'x86_64': 'x86_64',
|
||||
}.items():
|
||||
with self.subTest(machine):
|
||||
self._set_uname(('Linux', 'localhost', '3.18.91+',
|
||||
|
|
@ -580,11 +581,12 @@ def test_android_ext_suffix(self):
|
|||
machine = platform.machine()
|
||||
suffix = sysconfig.get_config_var('EXT_SUFFIX')
|
||||
expected_triplet = {
|
||||
"x86_64": "x86_64-linux-android",
|
||||
"i686": "i686-linux-android",
|
||||
"aarch64": "aarch64-linux-android",
|
||||
"arm": "arm-linux-androideabi",
|
||||
"armv7l": "arm-linux-androideabi",
|
||||
"armv8l": "arm-linux-androideabi",
|
||||
"i686": "i686-linux-android",
|
||||
"x86_64": "x86_64-linux-android",
|
||||
}[machine]
|
||||
self.assertEndsWith(suffix, f"-{expected_triplet}.so")
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
The Android testbed can now be built for 32-bit ARM and x86 targets.
|
||||
Loading…
Add table
Add a link
Reference in a new issue