mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
android: add support for x86_64 images (#31725)
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
This commit is contained in:
parent
b2f2ae61db
commit
4bca55e27a
7 changed files with 57 additions and 5 deletions
2
.github/workflows/android.yml
vendored
2
.github/workflows/android.yml
vendored
|
@ -27,7 +27,7 @@ jobs:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
arch: ['armv7-linux-androideabi', 'i686-linux-android']
|
arch: ['armv7-linux-androideabi', 'i686-linux-android', 'x86_64-linux-android']
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
if: github.event_name != 'issue_comment' && github.event_name != 'pull_request_target'
|
if: github.event_name != 'issue_comment' && github.event_name != 'pull_request_target'
|
||||||
|
|
|
@ -588,6 +588,19 @@ class CommandBase(object):
|
||||||
def to_ndk_bin(prog):
|
def to_ndk_bin(prog):
|
||||||
return path.join(llvm_toolchain, "bin", prog)
|
return path.join(llvm_toolchain, "bin", prog)
|
||||||
|
|
||||||
|
# This workaround is due to an issue in the x86_64 Android NDK that introduces
|
||||||
|
# an undefined reference to the symbol '__extendsftf2'.
|
||||||
|
# See https://github.com/termux/termux-packages/issues/8029#issuecomment-1369150244
|
||||||
|
if "x86_64" in self.cross_compile_target:
|
||||||
|
libclangrt_filename = subprocess.run(
|
||||||
|
[to_ndk_bin(f"x86_64-linux-android{android_api}-clang"), "--print-libgcc-file-name"],
|
||||||
|
check=True,
|
||||||
|
capture_output=True,
|
||||||
|
encoding="utf8"
|
||||||
|
).stdout
|
||||||
|
env['RUSTFLAGS'] = env.get('RUSTFLAGS', "")
|
||||||
|
env["RUSTFLAGS"] += f"-C link-arg={libclangrt_filename}"
|
||||||
|
|
||||||
env["RUST_TARGET"] = self.cross_compile_target
|
env["RUST_TARGET"] = self.cross_compile_target
|
||||||
env['HOST_CC'] = host_cc
|
env['HOST_CC'] = host_cc
|
||||||
env['HOST_CXX'] = host_cxx
|
env['HOST_CXX'] = host_cxx
|
||||||
|
@ -912,6 +925,14 @@ class CommandBase(object):
|
||||||
self.config["android"]["lib"] = "x86"
|
self.config["android"]["lib"] = "x86"
|
||||||
self.config["android"]["toolchain_name"] = "i686-linux-android30"
|
self.config["android"]["toolchain_name"] = "i686-linux-android30"
|
||||||
return True
|
return True
|
||||||
|
elif target == "x86_64-linux-android":
|
||||||
|
self.config["android"]["platform"] = "android-30"
|
||||||
|
self.config["android"]["target"] = target
|
||||||
|
self.config["android"]["toolchain_prefix"] = target
|
||||||
|
self.config["android"]["arch"] = "x86_64"
|
||||||
|
self.config["android"]["lib"] = "x86_64"
|
||||||
|
self.config["android"]["toolchain_name"] = "x86_64-linux-android30"
|
||||||
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def ensure_bootstrapped(self):
|
def ensure_bootstrapped(self):
|
||||||
|
|
|
@ -146,6 +146,8 @@ class PackageCommands(CommandBase):
|
||||||
arch_string = "Armv7"
|
arch_string = "Armv7"
|
||||||
elif "i686" in android_target:
|
elif "i686" in android_target:
|
||||||
arch_string = "x86"
|
arch_string = "x86"
|
||||||
|
elif "x86_64" in android_target:
|
||||||
|
arch_string = "x64"
|
||||||
else:
|
else:
|
||||||
arch_string = "Arm"
|
arch_string = "Arm"
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,8 @@ ext.getRustTarget = { String arch ->
|
||||||
switch (arch.toLowerCase()) {
|
switch (arch.toLowerCase()) {
|
||||||
case 'armv7' : return 'armv7-linux-androideabi'
|
case 'armv7' : return 'armv7-linux-androideabi'
|
||||||
case 'arm64' : return 'aarch64-linux-android'
|
case 'arm64' : return 'aarch64-linux-android'
|
||||||
case 'x86' : return 'i686-linux-android'
|
case 'x86': return 'i686-linux-android'
|
||||||
|
case 'x64': return 'x86_64-linux-android'
|
||||||
default: throw new GradleException("Invalid target architecture " + arch)
|
default: throw new GradleException("Invalid target architecture " + arch)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,7 +37,8 @@ ext.getNDKAbi = { String arch ->
|
||||||
switch (arch.toLowerCase()) {
|
switch (arch.toLowerCase()) {
|
||||||
case 'armv7' : return 'armeabi-v7a'
|
case 'armv7' : return 'armeabi-v7a'
|
||||||
case 'arm64' : return 'arm64-v8a'
|
case 'arm64' : return 'arm64-v8a'
|
||||||
case 'x86' : return 'x86'
|
case 'x86': return 'x86'
|
||||||
|
case 'x64': return 'x86_64'
|
||||||
default: throw new GradleException("Invalid target architecture " + arch)
|
default: throw new GradleException("Invalid target architecture " + arch)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,4 +2,7 @@ NDK_TOOLCHAIN_VERSION := clang
|
||||||
APP_MODULES := c++_shared servojni
|
APP_MODULES := c++_shared servojni
|
||||||
APP_PLATFORM := android-30
|
APP_PLATFORM := android-30
|
||||||
APP_STL := c++_shared
|
APP_STL := c++_shared
|
||||||
APP_ABI := armeabi-v7a x86
|
APP_ABI := armeabi-v7a x86 x86_64
|
||||||
|
ifeq ($(NDK_DEBUG),1)
|
||||||
|
APP_STRIP_MODE := none
|
||||||
|
endif
|
||||||
|
|
|
@ -97,6 +97,18 @@ android {
|
||||||
abiFilters getNDKAbi('x86')
|
abiFilters getNDKAbi('x86')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
x64Debug {
|
||||||
|
initWith(debug)
|
||||||
|
ndk {
|
||||||
|
abiFilters getNDKAbi('x64')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
x64Release {
|
||||||
|
initWith(release)
|
||||||
|
ndk {
|
||||||
|
abiFilters getNDKAbi('x64')
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ignore default 'debug' and 'release' build types
|
// Ignore default 'debug' and 'release' build types
|
||||||
|
|
|
@ -76,6 +76,12 @@ android {
|
||||||
x86Release {
|
x86Release {
|
||||||
initWith(release)
|
initWith(release)
|
||||||
}
|
}
|
||||||
|
x64Debug {
|
||||||
|
initWith(debug)
|
||||||
|
}
|
||||||
|
x64Release {
|
||||||
|
initWith(release)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
|
@ -99,6 +105,12 @@ android {
|
||||||
x86Release {
|
x86Release {
|
||||||
jniLibs.srcDirs = [getJniLibsPath(false, 'x86')]
|
jniLibs.srcDirs = [getJniLibsPath(false, 'x86')]
|
||||||
}
|
}
|
||||||
|
x64Debug {
|
||||||
|
jniLibs.srcDirs = [getJniLibsPath(true, 'x64')]
|
||||||
|
}
|
||||||
|
x64Release {
|
||||||
|
jniLibs.srcDirs = [getJniLibsPath(false, 'x64')]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ignore default 'debug' and 'release' build types
|
// Ignore default 'debug' and 'release' build types
|
||||||
|
@ -183,7 +195,7 @@ dependencies {
|
||||||
]
|
]
|
||||||
// Iterate all build types and dependencies
|
// Iterate all build types and dependencies
|
||||||
// For each dependency call the proper implementation command and set the correct dependency path
|
// For each dependency call the proper implementation command and set the correct dependency path
|
||||||
def list = ['armv7', 'arm64', 'x86']
|
def list = ['armv7', 'arm64', 'x86', 'x64']
|
||||||
for (arch in list) {
|
for (arch in list) {
|
||||||
for (debug in [true, false]) {
|
for (debug in [true, false]) {
|
||||||
String basePath = getTargetDir(debug, arch) + "/build"
|
String basePath = getTargetDir(debug, arch) + "/build"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue