Skip to content

Commit

Permalink
mk: If local-rust is the same as the current version, then force a lo…
Browse files Browse the repository at this point in the history
…cal-rebuild
  • Loading branch information
infinity0 committed Jul 15, 2016
1 parent 65fb7be commit c850470
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ opt debug-assertions 0 "build with debugging assertions"
opt fast-make 0 "use .gitmodules as timestamp for submodule deps"
opt ccache 0 "invoke gcc/clang via ccache to reuse object files between builds"
opt local-rust 0 "use an installed rustc rather than downloading a snapshot"
opt local-rebuild 0 "use an installed rustc matching the current version, for rebuilds"
opt local-rebuild 0 "assume local-rust matches the current version, for rebuilds; implies local-rust, and is implied if local-rust already matches the current version"
opt llvm-static-stdcpp 0 "statically link to libstdc++ for LLVM"
opt rpath 1 "build rpaths into rustc itself"
opt stage0-landing-pads 1 "enable landing pads during bootstrap with stage0"
Expand Down
11 changes: 10 additions & 1 deletion mk/main.mk
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,21 @@ CFG_FILENAME_EXTRA=$(shell printf '%s' $(CFG_RELEASE)$(CFG_EXTRA_FILENAME) | $(C
# from users enabling unstable features on the stable compiler.
CFG_BOOTSTRAP_KEY=$(CFG_FILENAME_EXTRA)

# If local-rust is the same as the current version, then force a local-rebuild
ifdef CFG_ENABLE_LOCAL_RUST
ifeq ($(CFG_RELEASE),\
$(shell $(S)src/etc/local_stage0.sh --print-rustc-release $(CFG_LOCAL_RUST_ROOT)))
CFG_INFO := $(info cfg: auto-detected local-rebuild $(CFG_RELEASE))
CFG_ENABLE_LOCAL_REBUILD = 1
endif
endif

# The stage0 compiler needs to use the previous key recorded in src/stage0.txt,
# except for local-rebuild when it just uses the same current key.
ifdef CFG_ENABLE_LOCAL_REBUILD
CFG_BOOTSTRAP_KEY_STAGE0=$(CFG_BOOTSTRAP_KEY)
else
CFG_BOOTSTRAP_KEY_STAGE0=$(shell grep 'rustc_key' $(S)src/stage0.txt | sed 's/rustc_key: '//)
CFG_BOOTSTRAP_KEY_STAGE0=$(shell sed -ne 's/^rustc_key: //p' $(S)src/stage0.txt)
endif

# The name of the package to use for creating tarballs, installers etc.
Expand Down
1 change: 1 addition & 0 deletions mk/stage0.mk
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ endif

$(SNAPSHOT_RUSTC_POST_CLEANUP): \
$(S)src/stage0.txt \
$(S)src/etc/local_stage0.sh \
$(S)src/etc/get-stage0.py $(MKFILE_DEPS) \
| $(HBIN0_H_$(CFG_BUILD))/
@$(call E, fetch: $@)
Expand Down
9 changes: 9 additions & 0 deletions src/etc/local_stage0.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ if [ -z $TARG_DIR ]; then
exit 1
fi

case "$TARG_DIR" in
--print-rustc-release)
# not actually copying to TARG_DIR, just print the local rustc version and exit
${PREFIX}/bin/rustc${BIN_SUF} --version --verbose | sed -ne 's/^release: //p'
;;
*)

cp ${PREFIX}/bin/rustc${BIN_SUF} ${TARG_DIR}/stage0/bin/
cp ${PREFIX}/${LIB_DIR}/${RUSTLIBDIR}/${TARG_DIR}/${LIB_DIR}/* ${TARG_DIR}/stage0/${LIB_DIR}/
cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}extra*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
Expand All @@ -66,3 +73,5 @@ cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}term*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DI

# do not fail if one of the above fails, as all we need is a working rustc!
exit 0

esac

0 comments on commit c850470

Please sign in to comment.