aboutsummaryrefslogtreecommitdiffstats
path: root/python/servo/command_base.py
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2015-02-21 02:36:47 +0530
committerManish Goregaokar <manishsmail@gmail.com>2015-02-21 09:42:47 +0530
commit5b3868089eabc4f8042e8e0ac5d2de7edb772e9f (patch)
tree1bae47300e8960a8c05110d4c4f66013941c75e2 /python/servo/command_base.py
parent748e0c55d126c4b2eb2f8280e81ef191389fa392 (diff)
downloadservo-5b3868089eabc4f8042e8e0ac5d2de7edb772e9f.tar.gz
servo-5b3868089eabc4f8042e8e0ac5d2de7edb772e9f.zip
Add ./mach build-gonk command
Diffstat (limited to 'python/servo/command_base.py')
-rw-r--r--python/servo/command_base.py38
1 files changed, 37 insertions, 1 deletions
diff --git a/python/servo/command_base.py b/python/servo/command_base.py
index 0f86edcb541..c77e190986b 100644
--- a/python/servo/command_base.py
+++ b/python/servo/command_base.py
@@ -88,6 +88,10 @@ class CommandBase(object):
self.config["android"].setdefault("ndk", "")
self.config["android"].setdefault("toolchain", "")
+ self.config.setdefault("gonk", {})
+ self.config["gonk"].setdefault("b2g", "")
+ self.config["gonk"].setdefault("product", "flame")
+
_rust_snapshot_path = None
_cargo_build_id = None
@@ -104,7 +108,7 @@ class CommandBase(object):
self._cargo_build_id = open(filename).read().strip()
return self._cargo_build_id
- def build_env(self):
+ def build_env(self, gonk=False):
"""Return an extended environment dictionary."""
env = os.environ.copy()
extra_path = []
@@ -142,6 +146,38 @@ class CommandBase(object):
if self.config["android"]["toolchain"]:
env["ANDROID_TOOLCHAIN"] = self.config["android"]["toolchain"]
+ if gonk:
+ if self.config["gonk"]["b2g"]:
+ env["GONKDIR"] = self.config["gonk"]["b2g"]
+ if "GONKDIR" not in env:
+ # Things can get pretty opaque if this hasn't been set
+ print("Please set $GONKDIR in your environment or servobild file")
+ os.exit(1)
+ if self.config["gonk"]["product"]:
+ env["GONK_PRODUCT"] = self.config["gonk"]["product"]
+
+ env["CC"] = "arm-linux-androideabi-gcc"
+ env["ARCH_DIR"] = "arch-arm"
+ env["CPPFLAGS"] = ("-DANDROID -DTARGET_OS_GONK -DGR_GL_USE_NEW_SHADER_SOURCE_SIGNATURE=1 "
+ "-isystem %(gonkdir)s/bionic/libc/%(archdir)s/include -isystem %(gonkdir)s/bionic/libc/include/ "
+ "-isystem %(gonkdir)s/bionic/libc/kernel/common -isystem %(gonkdir)s/bionic/libc/kernel/%(archdir)s "
+ "-isystem %(gonkdir)s/bionic/libm/include -I%(gonkdir)s/system -I%(gonkdir)s/system/core/include "
+ "-isystem %(gonkdir)s/bionic -I%(gonkdir)s/frameworks/native/opengl/include -I%(gonkdir)s/external/zlib "
+ "-I%(gonkdir)s/hardware/libhardware/include/hardware/") % {"gonkdir": env["GONKDIR"], "archdir": env["ARCH_DIR"] }
+ env["CXXFLAGS"] = ("-O2 -mandroid -fPIC %(cppflags)s -I%(gonkdir)s/ndk/sources/cxx-stl/stlport/stlport "
+ "-I%(gonkdir)s/ndk/sources/cxx-stl/system/include") % {"gonkdir": env["GONKDIR"], "cppflags": env["CPPFLAGS"] }
+ env["CFLAGS"] = ("-O2 -mandroid -fPIC %(cppflags)s -I%(gonkdir)s/ndk/sources/cxx-stl/stlport/stlport "
+ "-I%(gonkdir)s/ndk/sources/cxx-stl/system/include") % {"gonkdir": env["GONKDIR"], "cppflags": env["CPPFLAGS"] }
+
+ another_extra_path = path.join(env["GONKDIR"], "prebuilts", "gcc", "linux-x86", "arm", "arm-linux-androideabi-4.7", "bin")
+ env["PATH"] = "%s%s%s" % (another_extra_path, os.pathsep, env["PATH"])
+ env["LDFLAGS"] = ("-mandroid -L%(gonkdir)s/out/target/product/%(gonkproduct)s/obj/lib "
+ "-Wl,-rpath-link=%(gonkdir)s/out/target/product/%(gonkproduct)s/obj/lib "
+ "--sysroot=%(gonkdir)s/out/target/product/%(gonkproduct)s/obj/") % {"gonkdir": env["GONKDIR"], "gonkproduct": env["GONK_PRODUCT"] }
+
+ # Not strictly necessary for a vanilla build, but might be when tweaking the openssl build
+ env["OPENSSL_PATH"] = "%(gonkdir)s/out/target/product/%(gonkproduct)s/obj/lib" % {"gonkdir": env["GONKDIR"], "gonkproduct": env["GONK_PRODUCT"] }
+
# 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