gecko-dev/build/cargo-linker
Mike Hommey 02cdab48f8 Bug 1418598 - Make cargo-linker properly handle quoted strings in MOZ_CARGO_WRAP_LD and MOZ_CARGO_WRAP_LDFLAGS. r=ted
--HG--
extra : rebase_source : 84bcb0718584adf7a082b657cd8ff7cc8579e346
2017-11-18 20:24:12 +09:00

23 lines
962 B
Bash
Executable File

#!/bin/sh
# If you want to use a custom linker with Cargo, Cargo requires that you
# specify it in Cargo.toml or via the matching environment variable.
# Passing extra options to the linker is possible with Cargo via
# RUSTFLAGS='-C link-args', but testing showed that doing this reliably
# was difficult.
#
# Our solution to these problems is to use this wrapper script. We pass
# in the LD and the LDFLAGS to use via environment variables. Note that
# we do *not* quote either MOZ_CARGO_WRAP variable:
#
# * MOZ_CARGO_WRAP_LD is equivalent to CC on Unix-y platforms, and CC
# frequently has additional arguments in addition to the compiler
# itself.
# * MOZ_CARGO_WRAP_LDFLAGS contains space-separated arguments to pass,
# and not quoting it ensures that either of those arguments is passed
# as a separate argument to the actual LD.
#
# $@ is doubly quoted for the eval. See bug 1418598.
eval ${MOZ_CARGO_WRAP_LD} ${MOZ_CARGO_WRAP_LDFLAGS} '"$@"'