Bug 1322803 - Allow setting additional rustflags via mozconfig. r=ted

--HG--
extra : rebase_source : 996d0e0f9ac85c10ad7b188585e823da74407384
This commit is contained in:
Marco Castelluccio 2017-06-06 01:05:10 +01:00
parent fc7b949c51
commit adc55303d4
2 changed files with 9 additions and 3 deletions

View File

@ -1027,3 +1027,8 @@ def security_hardening_cflags(value, c_compiler):
add_old_configure_assignment('HARDENING_CFLAGS', security_hardening_cflags)
imply_option('--enable-pie', depends_if('--enable-hardening')(lambda v: v))
option(env='RUSTFLAGS',
nargs=1,
help='Rust compiler flags')
set_config('RUSTFLAGS', depends('RUSTFLAGS')(lambda flags: flags))

View File

@ -936,15 +936,16 @@ endif
# optimization levels in our Cargo.toml files all the time, and override the
# optimization level here, if necessary. (The Cargo.toml files already
# specify debug-assertions appropriately for --{disable,enable}-debug.)
default_rustflags =
ifndef MOZ_OPTIMIZE
rustflags = -C opt-level=0
default_rustflags = -C opt-level=0
# Unfortunately, -C opt-level=0 implies -C debug-assertions, so we need
# to explicitly disable them when MOZ_DEBUG_RUST is not set.
ifndef MOZ_DEBUG_RUST
rustflags += -C debug-assertions=no
default_rustflags += -C debug-assertions=no
endif
rustflags_override = RUSTFLAGS='$(rustflags)'
endif
rustflags_override = RUSTFLAGS='$(default_rustflags) $(RUSTFLAGS)'
ifdef MOZ_MSVCBITS
# If we are building a MozillaBuild shell, we want to clear out the