@@ -83,6 +83,7 @@ export PATH=$(rsvm_append_path $PATH $RSVM_DIR/current/dist/bin)
83
83
export LD_LIBRARY_PATH=$( rsvm_append_path $LD_LIBRARY_PATH $RSVM_DIR /current/dist/lib)
84
84
export DYLD_LIBRARY_PATH=$( rsvm_append_path $DYLD_LIBRARY_PATH $RSVM_DIR /current/dist/lib)
85
85
export MANPATH=$( rsvm_append_path $MANPATH $RSVM_DIR /current/dist/share/man)
86
+ export RUST_SRC_PATH=$( rsvm_append_path $RUST_SRC_PATH $RSVM_DIR /current/src/rustc-source/src)
86
87
87
88
rsvm_use ()
88
89
{
@@ -153,6 +154,7 @@ rsvm_install()
153
154
{
154
155
local CURRENT_DIR=` pwd`
155
156
local target=$1
157
+ local with_rustc_source=$2
156
158
local dirname
157
159
local url_prefix
158
160
local LAST_VERSION
@@ -207,6 +209,23 @@ rsvm_install()
207
209
echo " done"
208
210
fi
209
211
212
+ if [ " $with_rustc_source " = true ]
213
+ then
214
+ echo " Downloading sources for rustc sourcecode $dirname ... "
215
+ rsvm_file_download \
216
+ " https://static.rust-lang.org/dist$url_prfix /rustc-$target -src.tar.gz" \
217
+ " rustc-$target -src.tar.gz" \
218
+ true
219
+ if [ -e " rustc-source" ]
220
+ then
221
+ echo " Sources for rustc $dirname already extracted ..."
222
+ else
223
+ echo -n " Extracting source ... "
224
+ tar -xzf " rustc-$target -src.tar.gz"
225
+ mv " rustc-$target " " rustc-source"
226
+ fi
227
+ fi
228
+
210
229
if [ ! -f $SRC /rust-$target /bin/cargo ] && [ ! -f $SRC /rust-$target /cargo/bin/cargo ]
211
230
then
212
231
echo " Downloading sources for cargo nightly ... "
@@ -366,13 +385,25 @@ rsvm()
366
385
echo " rsvm install 0.12.0"
367
386
elif ([[ " $2 " =~ ^$RSVM_VERSION_PATTERN $ ]])
368
387
then
369
- if [ " $3 " = " --dry" ]
370
- then
371
- echo " Would install rust $2 "
372
- RSVM_LAST_INSTALLED_VERSION=$2
373
- else
374
- rsvm_install " $2 "
375
- fi
388
+ local version=$2
389
+ local with_rustc_source=false
390
+ for i in ${@: 3: ${#@ } }
391
+ do
392
+ case $i in
393
+ --dry)
394
+ echo " Would install rust $version "
395
+ RSVM_LAST_INSTALLED_VERSION=$version
396
+ rsvm_use $RSVM_LAST_INSTALLED_VERSION
397
+ exit
398
+ ;;
399
+ --with-rustc-source)
400
+ with_rustc_source=true
401
+ ;;
402
+ * )
403
+ ;;
404
+ esac
405
+ done
406
+ rsvm_install " $version " " $with_rustc_source "
376
407
rsvm_use $RSVM_LAST_INSTALLED_VERSION
377
408
else
378
409
# the version was defined in a the wrong format.
0 commit comments