Bug 1363655 - part 7 - make stylo bindgen bits depend on a compile environment; r=rillian

People building without a compilation environment (artifact builds, l10n
builds) won't have a compiler available, let alone the bits to build
bindgen.  We should limit our checks for bindgen-y things accordingly.
This commit is contained in:
Nathan Froyd 2017-06-21 13:28:37 -04:00
Родитель 2382b9da09
Коммит 608a0616fe
1 изменённых файлов: 93 добавлений и 90 удалений

Просмотреть файл

@ -623,8 +623,8 @@ id_and_secret_keyfile('Leanplum SDK')
option('--enable-stylo', nargs='?', choices=('build',),
help='Include Stylo in the build and/or enable it at runtime')
@depends('--enable-stylo')
def stylo_config(value):
@depends('--enable-stylo', '--help')
def stylo_config(value, _):
build_stylo = None
enable_stylo = None
@ -645,8 +645,10 @@ def stylo_config(value):
option('--disable-stylo-build-bindgen',
help='Disable build-time bindgen for Stylo')
@depends(stylo_config, '--enable-stylo-build-bindgen')
def building_stylo_bindgen(stylo_config, bindgen_enabled):
@depends(stylo_config, '--enable-stylo-build-bindgen', '--enable-compile-environment')
def building_stylo_bindgen(stylo_config, bindgen_enabled, compile_environment):
if not compile_environment:
return False
if not bindgen_enabled:
return False
return stylo_config.build
@ -664,6 +666,7 @@ llvm_config = check_prog('LLVM_CONFIG', ('llvm-config-4.0',
when=building_stylo_bindgen,
what='llvm-config', allow_missing=True)
with only_when(building_stylo_bindgen):
option('--with-libclang-path', nargs=1,
help='Absolute path to a directory containing Clang/LLVM libraries for Stylo (version 3.9.x or above)')
option('--with-clang-path', nargs=1,
@ -691,7 +694,7 @@ def check_minimum_llvm_config_version(llvm_config):
'''.format(version, min_version)))
@depends(llvm_config, '--with-libclang-path', '--with-clang-path',
host, when=building_stylo_bindgen)
host)
@imports('os.path')
@imports(_from='textwrap', _import='dedent')
def bindgen_config_paths(llvm_config, libclang_path, clang_path,
@ -719,7 +722,7 @@ def bindgen_config_paths(llvm_config, libclang_path, clang_path,
# but not have other packages installed. Since the user is trying
# to use their system packages, we can't be more specific about what
# they need.
if not os.path.exists(libclang_path)
if not os.path.exists(libclang_path):
die(dedent('''\
The directory {} returned by `llvm-config {}` does not exist.
Please check your system configuration.
@ -759,15 +762,15 @@ def bindgen_config_paths(llvm_config, libclang_path, clang_path,
clang_path=clang_path[0],
)
set_config('MOZ_LIBCLANG_PATH', bindgen_config_paths.libclang_path)
set_config('MOZ_CLANG_PATH', bindgen_config_paths.clang_path)
set_config('MOZ_STYLO_BINDGEN', depends_if('--enable-stylo-build-bindgen')(lambda _: True))
set_config('MOZ_STYLO', stylo_config.build)
set_define('MOZ_STYLO', stylo_config.build)
set_config('MOZ_STYLO_ENABLE', stylo_config.enable)
set_define('MOZ_STYLO_ENABLE', stylo_config.enable)
set_config('MOZ_LIBCLANG_PATH', bindgen_config_paths.libclang_path)
set_config('MOZ_CLANG_PATH', bindgen_config_paths.clang_path)
set_config('MOZ_STYLO_BINDGEN', depends_if('--enable-stylo-build-bindgen')(lambda _: True))
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.')