Make --local-rust-root configuration flag work correctly

configure will no longer try to find a local rust by default,
but if you pass --local-rust-root it will use it and not build rust
This commit is contained in:
Brian Anderson 2013-03-15 14:26:36 -07:00
parent ecb4a9981a
commit 5f672775b2
2 changed files with 20 additions and 10 deletions

View file

@ -48,6 +48,7 @@ endif
export CFG_RUSTC
export CFG_RUSTC_FLAGS
export CFG_LOCAL_RUSTC
export RUSTC=$(CFG_RUSTC)
export RUSTFLAGS=$(CFG_RUSTC_FLAGS)
@ -75,13 +76,20 @@ $(S)config.stamp : $(S)configure $(S)Makefile.in
$(Q)$(S)configure $(CFG_CONFIGURE_ARGS)
# Build the compiler
ifneq ($(CFG_LOCAL_RUSTC),1)
$(CFG_RUSTC):
$(MAKE) -C "$(CFG_BUILD_DIR)src/rust" CFG_RUSTC_FLAGS="" RUSTFLAGS=""
rust: $(CFG_RUSTC)
clean-rust:
$(MAKE) -C "$(CFG_BUILD_DIR)src/rust" CFG_RUSTC_FLAGS="" RUSTFLAGS="" clean
else
$(CFG_RUSTC):
clean-rust:
endif
rust: $(CFG_RUSTC)
define DEF_SUBMODULE_VARS
DEPS_$(1) =

18
configure vendored
View file

@ -285,7 +285,7 @@ opt optimize 1 "build optimized rust code"
opt optimize-cxx 1 "build optimized C++ code"
opt manage-submodules 1 "let the build manage the git submodules"
opt fast-make 0 "use .gitmodules as timestamp for submodule deps"
valopt local-rust-root "/usr/local" "set prefix for local rust binary"
valopt local-rust-root "" "set prefix for local rust binary"
if [ $HELP -eq 1 ]
then
@ -306,18 +306,19 @@ probe_need CFG_AUTOCONF213 autoconf213 \
if [ ! -z "$CFG_LOCAL_RUST_ROOT" ]
then
if [ ! -f ${CFG_LOCAL_RUST_ROOT}/bin/rustc ]
if [ -f ${CFG_LOCAL_RUST_ROOT}/bin/rustc ]
then
msg "using in-tree rust compiler"
# The Rust compiler we're going to build
CFG_RUSTC="${CFG_BUILD_DIR}src/rust/${DEFAULT_HOST_TRIPLE}/stage2/bin/rustc"
else
LRV=`${CFG_LOCAL_RUST_ROOT}/bin/rustc --version`
step_msg "using rustc at: ${CFG_LOCAL_RUST_ROOT} with version: " $LRV
CFG_RUSTC=${CFG_LOCAL_RUST_ROOT}/bin/rustc
CFG_RUSTC=${CFG_LOCAL_RUST_ROOT}/bin/rustc
CFG_LOCAL_RUSTC=1
else
err "No rustc found at ${CFG_LOCAL_RUST_ROOT}/bin/rustc"
fi
else
probe_need CFG_RUSTC rustc
step_msg "using in-tree rust compiler"
# The Rust compiler we're going to build
CFG_RUSTC="${CFG_BUILD_DIR}src/rust/${DEFAULT_HOST_TRIPLE}/stage2/bin/rustc"
fi
if [ ! -z "$CFG_ENABLE_CLANG" ]
@ -524,6 +525,7 @@ putvar CFG_C_COMPILER
putvar CFG_SUBMODULES
putvar CFG_DISABLE_MANAGE_SUBMODULES
putvar CFG_RUSTC
putvar CFG_LOCAL_RUSTC
msg
copy_if_changed ${CFG_SRC_DIR}Makefile.in ${CFG_BUILD_DIR}Makefile