@@ -151,11 +151,22 @@ validate_opt () {
151
151
done
152
152
}
153
153
154
- valopt () {
155
- VAL_OPTIONS=" $VAL_OPTIONS $1 "
154
+ # `valopt OPTION_NAME DEFAULT DOC` extracts a string-valued option
155
+ # from command line, using provided default value for the option if
156
+ # not present, and saves it to the generated config.mk.
157
+ #
158
+ # `valopt_nosave` is much the same, except that it does not save the
159
+ # result to config.mk (instead the script should use `putvar` itself
160
+ # later on to save it). `valopt_core` is the core upon which the
161
+ # other two are built.
156
162
157
- local OP=$1
158
- local DEFAULT=$2
163
+ valopt_core () {
164
+ VAL_OPTIONS=" $VAL_OPTIONS $2 "
165
+
166
+ local SAVE=$1
167
+ local OP=$2
168
+ local DEFAULT=$3
169
+ shift
159
170
shift
160
171
shift
161
172
local DOC=" $* "
@@ -172,7 +183,10 @@ valopt() {
172
183
eval $V =$val
173
184
fi
174
185
done
175
- putvar $V
186
+ if [ " $SAVE " = " save" ]
187
+ then
188
+ putvar $V
189
+ fi
176
190
else
177
191
if [ -z " $DEFAULT " ]
178
192
then
@@ -183,11 +197,30 @@ valopt() {
183
197
fi
184
198
}
185
199
186
- opt () {
187
- BOOL_OPTIONS=" $BOOL_OPTIONS $1 "
200
+ valopt_nosave () {
201
+ valopt_core nosave " $@ "
202
+ }
203
+
204
+ valopt () {
205
+ valopt_core save " $@ "
206
+ }
207
+
208
+ # `opt OPTION_NAME DEFAULT DOC` extracts a boolean-valued option from
209
+ # command line, using the provided default value (0/1) for the option
210
+ # if not present, and saves it to the generated config.mk.
211
+ #
212
+ # `opt_nosave` is much the same, except that it does not save the
213
+ # result to config.mk (instead the script should use `putvar` itself
214
+ # later on to save it). `opt_core` is the core upon which the other
215
+ # two are built.
216
+
217
+ opt_core () {
218
+ BOOL_OPTIONS=" $BOOL_OPTIONS $2 "
188
219
189
- local OP=$1
190
- local DEFAULT=$2
220
+ local SAVE=$1
221
+ local OP=$2
222
+ local DEFAULT=$3
223
+ shift
191
224
shift
192
225
shift
193
226
local DOC=" $* "
@@ -211,7 +244,10 @@ opt() {
211
244
FLAG=$( echo $FLAG | tr ' a-z' ' A-Z' )
212
245
local V=" CFG_${FLAG} _${OP} "
213
246
eval $V =1
214
- putvar $V
247
+ if [ " $SAVE " = " save" ]
248
+ then
249
+ putvar $V
250
+ fi
215
251
fi
216
252
done
217
253
else
@@ -223,6 +259,14 @@ opt() {
223
259
fi
224
260
}
225
261
262
+ opt_nosave () {
263
+ opt_core nosave " $@ "
264
+ }
265
+
266
+ opt () {
267
+ opt_core save " $@ "
268
+ }
269
+
226
270
envopt () {
227
271
local NAME=$1
228
272
local V=" CFG_${NAME} "
@@ -411,6 +455,7 @@ VAL_OPTIONS=""
411
455
412
456
opt valgrind 0 " run tests with valgrind (memcheck by default)"
413
457
opt helgrind 0 " run tests with helgrind instead of memcheck"
458
+ opt valgrind-rpass 1 " run rpass-valgrind tests with valgrind"
414
459
opt docs 1 " build documentation"
415
460
opt optimize 1 " build optimized rust code"
416
461
opt optimize-cxx 1 " build optimized C++ code"
@@ -421,38 +466,40 @@ opt llvm-assertions 1 "build LLVM with assertions"
421
466
opt debug 1 " build with extra debug fun"
422
467
opt ratchet-bench 0 " ratchet benchmarks"
423
468
opt fast-make 0 " use .gitmodules as timestamp for submodule deps"
424
- opt manage-submodules 1 " let the build manage the git submodules"
425
469
opt mingw-cross 0 " cross-compile for win32 using mingw"
426
- opt clang 0 " prefer clang to gcc for building the runtime"
427
470
opt ccache 0 " invoke gcc/clang via ccache to reuse object files between builds"
428
471
opt local-rust 0 " use an installed rustc rather than downloading a snapshot"
429
- opt inject-std-version 1 " inject the current compiler version of libstd into programs"
430
472
opt llvm-static-stdcpp 0 " statically link to libstdc++ for LLVM"
431
473
opt rpath 0 " build rpaths into rustc itself"
432
474
opt nightly 0 " build nightly packages"
433
475
opt verify-install 1 " verify installed binaries work"
434
- opt jemalloc 1 " build liballoc with jemalloc"
435
476
# This is used by the automation to produce single-target nightlies
436
477
opt dist-host-only 0 " only install bins for the host architecture"
437
- valopt prefix " /usr/local" " set installation prefix"
438
- valopt local-rust-root " /usr/local" " set prefix for local rust binary"
439
- valopt llvm-root " " " set LLVM root"
440
- valopt jemalloc-root " " " set directory where libjemalloc_pic.a is located"
441
- valopt android-cross-path " /opt/ndk_standalone" " Android NDK standalone path"
442
- valopt mingw32-cross-path " " " MinGW32 cross compiler path"
443
-
444
- valopt build " ${DEFAULT_BUILD} " " GNUs ./configure syntax LLVM build triple"
445
- valopt host " ${CFG_BUILD} " " GNUs ./configure syntax LLVM host triples"
446
- valopt target " ${CFG_HOST} " " GNUs ./configure syntax LLVM target triples"
478
+ opt inject-std-version 1 " inject the current compiler version of libstd into programs"
479
+ opt jemalloc 1 " build liballoc with jemalloc"
447
480
448
481
valopt localstatedir " /var/lib" " local state directory"
449
482
valopt sysconfdir " /etc" " install system configuration files"
450
483
451
484
valopt datadir " ${CFG_PREFIX} /share" " install data"
452
485
valopt infodir " ${CFG_PREFIX} /share/info" " install additional info"
453
- valopt mandir " ${CFG_PREFIX} /share/man" " install man pages in PATH"
486
+ valopt llvm-root " " " set LLVM root"
487
+ valopt jemalloc-root " " " set directory where libjemalloc_pic.a is located"
488
+ valopt build " ${DEFAULT_BUILD} " " GNUs ./configure syntax LLVM build triple"
489
+ valopt android-cross-path " /opt/ndk_standalone" " Android NDK standalone path"
490
+ valopt mingw32-cross-path " " " MinGW32 cross compiler path"
454
491
455
- valopt release-channel " dev" " the name of the release channel to build"
492
+ # Many of these are saved below during the "writing configuration" step
493
+ # (others are conditionally saved).
494
+ opt_nosave manage-submodules 1 " let the build manage the git submodules"
495
+ opt_nosave clang 0 " prefer clang to gcc for building the runtime"
496
+
497
+ valopt_nosave prefix " /usr/local" " set installation prefix"
498
+ valopt_nosave local-rust-root " /usr/local" " set prefix for local rust binary"
499
+ valopt_nosave host " ${CFG_BUILD} " " GNUs ./configure syntax LLVM host triples"
500
+ valopt_nosave target " ${CFG_HOST} " " GNUs ./configure syntax LLVM target triples"
501
+ valopt_nosave mandir " ${CFG_PREFIX} /share/man" " install man pages in PATH"
502
+ valopt_nosave release-channel " dev" " the name of the release channel to build"
456
503
457
504
# On windows we just store the libraries in the bin directory because
458
505
# there's no rpath. This is where the build system itself puts libraries;
490
537
if [ ! -z " $CFG_ENABLE_NIGHTLY " ]
491
538
then
492
539
CFG_RELEASE_CHANNEL=nightly
493
- putvar CFG_RELEASE_CHANNEL
494
540
fi
541
+ putvar CFG_RELEASE_CHANNEL
495
542
496
543
step_msg " looking for build programs"
497
544
@@ -604,17 +651,27 @@ then
604
651
err " no local rust to use"
605
652
fi
606
653
607
- LRV=` ${CFG_LOCAL_RUST_ROOT} /bin/rustc${BIN_SUF} --version`
654
+ CMD=" ${CFG_LOCAL_RUST_ROOT} /bin/rustc${BIN_SUF} "
655
+ LRV=` $CMD --version`
656
+ if [ $? -ne 0 ]
657
+ then
658
+ step_msg " failure while running $CMD --version"
659
+ exit 1
660
+ fi
608
661
step_msg " using rustc at: ${CFG_LOCAL_RUST_ROOT} with version: $LRV "
609
662
putvar CFG_LOCAL_RUST_ROOT
663
+ else
664
+ if [ ! -z " $CFG_LOCAL_RUST_ROOT " ]
665
+ then
666
+ warn " Use of --local-rust-root without --enable-local-rust"
667
+ fi
610
668
fi
611
669
612
670
# Force freebsd to build with clang; gcc doesn't like us there
613
671
if [ $CFG_OSTYPE = unknown-freebsd ]
614
672
then
615
673
step_msg " on FreeBSD, forcing use of clang"
616
674
CFG_ENABLE_CLANG=1
617
- putvar CFG_ENABLE_CLANG
618
675
fi
619
676
620
677
if [ -z " $CFG_ENABLE_CLANG " -a -z " $CFG_GCC " ]
@@ -631,12 +688,10 @@ then
631
688
then
632
689
step_msg " on OS X 10.9, forcing use of clang"
633
690
CFG_ENABLE_CLANG=1
634
- putvar CFG_ENABLE_CLANG
635
691
else
636
692
if [ $( " $CFG_GCC " --version 2>&1 | grep -c ' 4\.[0-6]' ) -ne 0 ]; then
637
693
step_msg " older GCC found, using clang instead"
638
694
CFG_ENABLE_CLANG=1
639
- putvar CFG_ENABLE_CLANG
640
695
else
641
696
# on OS X, with xcode 5 and newer, certain developers may have
642
697
# cc, gcc and g++ point to a mixture of clang and gcc
@@ -662,6 +717,13 @@ then
662
717
fi
663
718
fi
664
719
720
+ # Okay, at this point, we have made up our minds about whether we are
721
+ # going to force CFG_ENABLE_CLANG or not; save the setting if so.
722
+ if [ ! -z " $CFG_ENABLE_CLANG " ]
723
+ then
724
+ putvar CFG_ENABLE_CLANG
725
+ fi
726
+
665
727
if [ ! -z " $CFG_LLVM_ROOT " -a -e " $CFG_LLVM_ROOT /bin/llvm-config" ]
666
728
then
667
729
step_msg " using custom LLVM at $CFG_LLVM_ROOT "
906
968
done
907
969
908
970
make_dir $h /test/run-pass
971
+ make_dir $h /test/run-pass-valgrind
909
972
make_dir $h /test/run-pass-fulldeps
910
973
make_dir $h /test/run-fail
911
974
make_dir $h /test/compile-fail
@@ -1201,18 +1264,11 @@ putvar CFG_OSTYPE
1201
1264
putvar CFG_CPUTYPE
1202
1265
putvar CFG_CONFIGURE_ARGS
1203
1266
putvar CFG_PREFIX
1204
- putvar CFG_BUILD
1205
1267
putvar CFG_HOST
1206
1268
putvar CFG_TARGET
1207
- putvar CFG_LIBDIR
1208
1269
putvar CFG_LIBDIR_RELATIVE
1209
1270
putvar CFG_DISABLE_MANAGE_SUBMODULES
1210
- putvar CFG_ANDROID_CROSS_PATH
1211
- putvar CFG_MINGW32_CROSS_PATH
1212
1271
putvar CFG_MANDIR
1213
- putvar CFG_DISABLE_INJECT_STD_VERSION
1214
- putvar CFG_JEMALLOC_ROOT
1215
- putvar CFG_DISABLE_JEMALLOC
1216
1272
1217
1273
# Avoid spurious warnings from clang by feeding it original source on
1218
1274
# ccache-miss rather than preprocessed input.
@@ -1235,16 +1291,6 @@ then
1235
1291
putvar CFG_PANDOC
1236
1292
fi
1237
1293
1238
- # Valgrind is only reliable on Linux. On Windows it doesn't work at all, and
1239
- # on the Mac the dynamic linker causes Valgrind to emit a huge stream of
1240
- # errors.
1241
- if [ $CFG_OSTYPE != unknown-linux-gnu ] && [ $CFG_OSTYPE != apple-darwin ]
1242
- then
1243
- CFG_BAD_VALGRIND=1
1244
- putvar CFG_BAD_VALGRIND
1245
- fi
1246
-
1247
- putvar CFG_LLVM_ROOT
1248
1294
putvar CFG_LLVM_SRC_DIR
1249
1295
1250
1296
for t in $CFG_HOST
0 commit comments