Do build-time bindgen

Majority of build_gecko.rs is just the straightforward conversion from
regen.py. There are two differences that:
1. Side in whitelist is changed to mozilla::Side
2. std::atomic__My_base is added to opaque types for Windows
This commit is contained in:
Xidorn Quan 2016-12-09 13:55:49 -10:00
parent 6dd4b4822f
commit 1cefd1bef0
8 changed files with 739 additions and 835 deletions

View file

@ -384,6 +384,9 @@ class MachCommands(CommandBase):
@Command('build-geckolib',
description='Build a static library of components used by Gecko',
category='build')
@CommandArgument('--with-gecko',
default=None,
help='Build with Gecko dist directory')
@CommandArgument('--jobs', '-j',
default=None,
help='Number of jobs to run in parallel')
@ -393,12 +396,18 @@ class MachCommands(CommandBase):
@CommandArgument('--release', '-r',
action='store_true',
help='Build in release mode')
def build_geckolib(self, jobs=None, verbose=False, release=False):
def build_geckolib(self, with_gecko=None, jobs=None, verbose=False, release=False):
self.set_use_stable_rust()
self.ensure_bootstrapped()
env = self.build_env(is_build=True)
env["CARGO_TARGET_DIR"] = path.join(self.context.topdir, "target", "geckolib").encode("UTF-8")
ret = None
opts = []
if with_gecko is not None:
opts += ["--features", "bindgen"]
env["MOZ_DIST"] = path.abspath(with_gecko)
if jobs is not None:
opts += ["-j", jobs]
if verbose:
@ -406,9 +415,6 @@ class MachCommands(CommandBase):
if release:
opts += ["--release"]
env = self.build_env(is_build=True)
env["CARGO_TARGET_DIR"] = path.join(self.context.topdir, "target", "geckolib").encode("UTF-8")
build_start = time()
with cd(path.join("ports", "geckolib")):
ret = call(["cargo", "build"] + opts, env=env, verbose=verbose)