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:
Evan McClanahan 2012-04-05 15:40:34 -07:00 committed by Evan McClanahan
parent fd26743bed
commit 2c93b1b2df
3 changed files with 64 additions and 2 deletions

48
src/etc/local_stage0.sh Executable file
View 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}/