mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 00:03:43 +00:00
add the option --enable-local-rust to pull rust from your environment
rather than the snapshots. make sure to get all of the files. update to add nmatsakis' requested feature of pointing to a different rustc install root. usage: --enable-local-rust to enable --local-rust-root="/path/to/rustc/" to change the path, which defaults to "/usr/local/" Tested on OS X and Linux, likely broken on windows.
This commit is contained in:
parent
fd26743bed
commit
2c93b1b2df
12
configure
vendored
12
configure
vendored
@ -294,7 +294,9 @@ opt fast-make 0 "use .gitmodules as timestamp for submodule deps"
|
||||
opt manage-submodules 1 "let the build manage the git submodules"
|
||||
opt mingw-cross 0 "cross-compile for win32 using mingw"
|
||||
opt clang 0 "prefer clang to gcc for building the runtime"
|
||||
opt local-rust 0 "use an installed rustc rather than downloading a snapshot"
|
||||
valopt prefix "/usr/local" "set installation prefix"
|
||||
valopt local-rust-root "/usr/local" "set prefix for local rust binary"
|
||||
valopt llvm-root "" "set LLVM root"
|
||||
valopt host-triple "${DEFAULT_HOST_TRIPLE}" "LLVM host triple"
|
||||
valopt target-triples "${CFG_HOST_TRIPLE}" "LLVM target triples"
|
||||
@ -337,7 +339,6 @@ probe CFG_XETEX xetex
|
||||
probe CFG_LUATEX luatex
|
||||
probe CFG_NODE nodejs node
|
||||
|
||||
|
||||
if [ ! -z "$CFG_PANDOC" ]
|
||||
then
|
||||
PV=$(pandoc --version | awk '/^pandoc/ {print $2}')
|
||||
@ -348,6 +349,14 @@ then
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -z "$CFG_ENABLE_LOCAL_RUST" -a ! -f ${CFG_LOCAL_RUST_ROOT}/bin/rustc ]
|
||||
then
|
||||
err "no local rust to use"
|
||||
else
|
||||
LRV=`${CFG_LOCAL_RUST_ROOT}/bin/rustc --version`
|
||||
step_msg "using rustc at: ${CFG_LOCAL_RUST_ROOT} with version: " $LRV
|
||||
fi
|
||||
|
||||
if [ -z "$CFG_ENABLE_CLANG" -a -z "$CFG_GCC" ]
|
||||
then
|
||||
err "either clang or gcc is required"
|
||||
@ -716,7 +725,6 @@ do
|
||||
putvar $CFG_LLVM_INST_DIR
|
||||
done
|
||||
|
||||
|
||||
# Munge any paths that appear in config.mk back to posix-y
|
||||
perl -i.bak -p -e 's@ ([a-zA-Z]):[/\\]@ /\1/@go;' \
|
||||
-e 's@\\@/@go;' config.tmp
|
||||
|
@ -1,12 +1,18 @@
|
||||
# Extract the snapshot host compiler
|
||||
|
||||
|
||||
|
||||
$(HBIN0_H_$(CFG_HOST_TRIPLE))/rustc$(X): \
|
||||
$(S)src/snapshots.txt \
|
||||
$(S)src/etc/get-snapshot.py $(MKFILE_DEPS)
|
||||
@$(call E, fetch: $@)
|
||||
# Note: the variable "SNAPSHOT_FILE" is generally not set, and so
|
||||
# we generally only pass one argument to this script.
|
||||
ifdef CFG_ENABLE_LOCAL_RUST
|
||||
$(Q)$(S)src/etc/local_stage0.sh $(CFG_HOST_TRIPLE) $(CFG_LOCAL_RUST_ROOT)
|
||||
else
|
||||
$(Q)$(S)src/etc/get-snapshot.py $(CFG_HOST_TRIPLE) $(SNAPSHOT_FILE)
|
||||
endif
|
||||
$(Q)touch $@
|
||||
|
||||
# Host libs will be extracted by the above rule
|
||||
|
48
src/etc/local_stage0.sh
Executable file
48
src/etc/local_stage0.sh
Executable file
@ -0,0 +1,48 @@
|
||||
#!/bin/sh
|
||||
|
||||
TARG_DIR=$1
|
||||
PREFIX=$2
|
||||
|
||||
BINDIR=bin
|
||||
LIBDIR=lib
|
||||
|
||||
OS=`uname -s`
|
||||
case $OS in
|
||||
("Linux"|"FreeBSD")
|
||||
BIN_SUF=
|
||||
LIB_SUF=.so
|
||||
break
|
||||
;;
|
||||
("Darwin")
|
||||
BIN_SUF=
|
||||
LIB_SUF=.dylib
|
||||
break
|
||||
;;
|
||||
(*)
|
||||
BIN_SUF=.exe
|
||||
LIB_SUF=.dll
|
||||
LIBDIR=bin
|
||||
break
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z $PREFIX ]; then
|
||||
echo "No local rust specified."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -e ${PREFIX}/bin/rustc ]; then
|
||||
echo "No local rust installed at ${PREFIX}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z $TARG_DIR ]; then
|
||||
echo "No target directory specified."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cp ${PREFIX}/bin/rustc ${TARG_DIR}/stage0/bin/
|
||||
cp ${PREFIX}/lib/rustc/${TARG_DIR}/${LIBDIR}/* ${TARG_DIR}/stage0/${LIBDIR}/
|
||||
cp ${PREFIX}/lib/librust*${LIB_SUF} ${TARG_DIR}/stage0/${LIBDIR}/
|
||||
cp ${PREFIX}/lib/libcore*${LIB_SUF} ${TARG_DIR}/stage0/${LIBDIR}/
|
||||
cp ${PREFIX}/lib/libstd*${LIB_SUF} ${TARG_DIR}/stage0/${LIBDIR}/
|
Loading…
Reference in New Issue
Block a user