Bug 1364428 - make stylo enabling more flexible; r=rillian
authorNathan Froyd <froydnj@mozilla.com>
Thu, 18 May 2017 18:39:40 -0400
changeset 409695 bc1c078e357ffe439a4974225a86cbc2fdd5f43d
parent 409694 2dfe645a3845ac5a5c1aaf54d72a171f48958d07
child 409696 cdab12ab8c24f43beaec71a78f0a7a56683f717a
push id1490
push usermtabara@mozilla.com
push dateMon, 31 Jul 2017 14:08:16 +0000
treeherdermozilla-release@70e32e6bf15e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1364428 - make stylo enabling more flexible; r=rillian We currently have an --enable-stylo option, which when passed builds Stylo and enables Stylo at runtime. With an upcoming move to building Stylo everywhere by default, but only enabling it on specific platforms, we need something more sophisticated than a binary yes/no. The recent WebRender support offers a model worth emulating: we modify things so there are four possibilities: * nothing passed (the default); * --disable-stylo (explicitly not building); * --enable-stylo=build (build, but do not enable by default); * --enable-stylo (build and enable) The last option corresponds exactly to what we have today, so there's no change in functionality. This patch makes the default and --disable-stylo the same; splitting the default and --disable-stylo into separate cases enables us to change the default behavior at some point in the future.
--- a/toolkit/moz.configure
+++ b/toolkit/moz.configure
@@ -607,20 +607,37 @@ simple_keyfile('Mozilla API')
 simple_keyfile('Google API')
 id_and_secret_keyfile('Bing API')
 simple_keyfile('Adjust SDK')
 # Servo integration
 # ==============================================================
-option('--enable-stylo', env='STYLO_ENABLED', nargs=0,
-       help='Enables experimental integration with the servo style system. '
-            'This requires either building servo within Gecko\'s cargo phase '
-            'or passing --with-servo')
+option('--enable-stylo', nargs='?', choices=('build',),
+       help='Include Stylo in the build and/or enable it at runtime')
+def stylo_config(value):
+    build_stylo = None
+    enable_stylo = None
+    # The default is to not build Stylo at all.
+    if value.origin == 'default':
+        pass
+    elif value == 'build':
+        build_stylo = True
+    elif bool(value):
+        build_stylo = True
+        enable_stylo = True
+    return namespace(
+        build = build_stylo,
+        enable = enable_stylo,
+    )
 # We support setting up the appropriate options for Stylo's build-time
 # bindings generation via setting LLVM_CONFIG or by providing explicit
 # configure options.  The Windows installer of LLVM/Clang doesn't provide
 # llvm-config, so we need both methods to support all of our tier-1
 # platforms.
 llvm_config = check_prog('LLVM_CONFIG', ('llvm-config-4.0',
@@ -653,22 +670,22 @@ def check_minimum_llvm_config_version(ll
         To compile Stylo, please install version {} or greater of
         Clang + LLVM and ensure that the 'llvm-config' from that
         installation is first on your path.
         You can verify this by typing 'llvm-config --version'.
         '''.format(version, min_version)))
-@depends('--enable-stylo', '--enable-stylo-build-bindgen',
+@depends(stylo_config, '--enable-stylo-build-bindgen',
          llvm_config, '--with-libclang-path', '--with-clang-path')
 @imports(_from='textwrap', _import='dedent')
-def bindgen_config_paths(stylo_enabled, bindgen_enabled,
+def bindgen_config_paths(stylo_config, bindgen_enabled,
                          llvm_config, libclang_path, clang_path):
-    if not stylo_enabled:
+    if not stylo_config.build:
         return None
     if not bindgen_enabled:
         return None
     if not libclang_path and not clang_path:
         # We must have LLVM_CONFIG in this case.
         if not llvm_config:
@@ -687,43 +704,43 @@ def bindgen_config_paths(stylo_enabled, 
         You must provide both of --with-libclang-path and --with-clang-path
         or neither of them.'''))
     return namespace(
-@depends('--enable-stylo', bindgen_config_paths, '--enable-stylo-build-bindgen')
+@depends(stylo_config, bindgen_config_paths, '--enable-stylo-build-bindgen')
 @imports(_from='textwrap', _import='dedent')
-def stylo(stylo_enabled, bindgen_config_paths, bindgen_enabled):
-    if not stylo_enabled:
+def stylo(stylo_config, bindgen_config_paths, bindgen_enabled):
+    if not stylo_config.build:
         return None
     elif not bindgen_enabled:
         return namespace(
-            enabled=bool(stylo_enabled)
+            build=bool(stylo_config.build)
     elif not bindgen_config_paths:
         Could not find LLVM/Clang installation for compiling stylo build-time
         bindgen.  Please specify the 'LLVM_CONFIG' environment variable
         (recommended), pass the '--with-libclang-path' and '--with-clang-path'
         options to configure, or put 'llvm-config' in your PATH.  Altering your
         PATH may expose 'clang' as well, potentially altering your compiler,
         which may not be what you intended.'''))
     return namespace(
-        enabled=bool(stylo_enabled),
+        build=bool(stylo_config.build),
-set_config('MOZ_STYLO', delayed_getattr(stylo, 'enabled'))
-set_define('MOZ_STYLO', delayed_getattr(stylo, 'enabled'))
+set_config('MOZ_STYLO', delayed_getattr(stylo, 'build'))
+set_define('MOZ_STYLO', delayed_getattr(stylo, 'build'))
 set_config('MOZ_LIBCLANG_PATH', delayed_getattr(stylo, 'libclang_path'))
 set_config('MOZ_CLANG_PATH', delayed_getattr(stylo, 'clang_path'))
 set_config('MOZ_STYLO_BINDGEN', delayed_getattr(stylo, 'bindgen_enabled'))
 option('--with-servo', env='SERVO_TARGET_DIR', nargs=1,
        help='Absolute path of the target directory where libgeckoservo can '
             'be found. This is generally servo_src_dir/target/release.')