Switch android to glutin.

This commit is contained in:
Glenn Watson 2014-12-11 15:13:26 +10:00
parent 80756a11d2
commit 9d192de63d
8 changed files with 268 additions and 91 deletions

View file

@ -46,6 +46,8 @@ class MachCommands(CommandBase):
android = self.config["build"]["android"]
opts = []
features = []
if release:
opts += ["--release"]
if target:
@ -54,8 +56,17 @@ class MachCommands(CommandBase):
opts += ["-j", jobs]
if verbose:
opts += ["-v"]
if android:
# Ensure the APK builder submodule has been built first
apk_builder_dir = "support/android-rs-glue"
with cd(path.join(apk_builder_dir, "apk-builder")):
subprocess.call(["cargo", "build"], env=self.build_env())
# FIXME: This can be simplified when glutin becomes the default
# and glfw has been removed.
opts += ["--target", "arm-linux-androideabi", "--no-default-features"]
features += ["glutin"]
features = []
if debug_mozjs or self.config["build"]["debug-mozjs"]:
features += ["script/debugmozjs"]
@ -72,16 +83,9 @@ class MachCommands(CommandBase):
env=self.build_env())
env['OPENSSL_PATH'] = path.join(self.android_support_dir(), "openssl-1.0.1j")
make_opts = []
if opts:
make_opts += ["CARGO_OPTS=" + " ".join(opts)]
status = subprocess.call(
["make", "-C", "ports/android"] + make_opts,
env=env)
else:
status = subprocess.call(
["cargo", "build"] + opts,
env=env, cwd=self.servo_crate())
status = subprocess.call(
["cargo", "build"] + opts,
env=env, cwd=self.servo_crate())
elapsed = time() - build_start
print("Build completed in %0.2fs" % elapsed)

View file

@ -140,6 +140,18 @@ class CommandBase(object):
if self.config["android"]["toolchain"]:
env["ANDROID_TOOLCHAIN"] = self.config["android"]["toolchain"]
# FIXME: These are set because they are the variable names that
# android-rs-glue expects. However, other submodules have makefiles that
# reference the env var names above. Once glutin is enabled and set as
# the default, we could modify the subproject makefiles to use the names
# below and remove the vars above, to avoid duplication.
if "ANDROID_SDK" in env:
env["ANDROID_HOME"] = env["ANDROID_SDK"]
if "ANDROID_NDK" in env:
env["NDK_HOME"] = env["ANDROID_NDK"]
if "ANDROID_TOOLCHAIN" in env:
env["NDK_STANDALONE"] = env["ANDROID_TOOLCHAIN"]
return env
def servo_crate(self):