Skip to content

Commit bb2e921

Browse files
committed
configure: Add an option to use the cargo build system
This commit adds a `--enable-rustbuild` option to the configure script which will copy a different `Makefile.in` into place to intercept all `make` invocations. Currently this makefile only has one target, but it's expected to be filled out quite a bit over time!
1 parent 34f7364 commit bb2e921

File tree

2 files changed

+38
-3
lines changed

2 files changed

+38
-3
lines changed

configure

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,7 @@ opt stage0-landing-pads 1 "enable landing pads during bootstrap with stage0"
606606
opt dist-host-only 0 "only install bins for the host architecture"
607607
opt inject-std-version 1 "inject the current compiler version of libstd into programs"
608608
opt llvm-version-check 1 "check if the LLVM version is supported, build anyway"
609+
opt rustbuild 0 "use the rust and cargo based build system"
609610

610611
# Optimization and debugging options. These may be overridden by the release channel, etc.
611612
opt_nosave optimize 1 "build optimized rust code"
@@ -1422,7 +1423,7 @@ done
14221423
step_msg "configuring submodules"
14231424

14241425
# Have to be in the top of src directory for this
1425-
if [ -z $CFG_DISABLE_MANAGE_SUBMODULES ]
1426+
if [ -z $CFG_DISABLE_MANAGE_SUBMODULES ] && [ -z $CFG_ENABLE_RUSTBUILD ]
14261427
then
14271428
cd ${CFG_SRC_DIR}
14281429

@@ -1481,7 +1482,11 @@ do
14811482
;;
14821483
esac
14831484

1484-
if [ -z $CFG_LLVM_ROOT ]
1485+
if [ -n "$CFG_ENABLE_RUSTBUILD" ]
1486+
then
1487+
msg "not configuring LLVM, rustbuild in use"
1488+
do_reconfigure=0
1489+
elif [ -z $CFG_LLVM_ROOT ]
14851490
then
14861491
LLVM_BUILD_DIR=${CFG_BUILD_DIR}$t/llvm
14871492
if [ -n "$CFG_DISABLE_OPTIMIZE_LLVM" ]
@@ -1812,8 +1817,15 @@ do
18121817
putvar $CFG_LLVM_INST_DIR
18131818
done
18141819

1820+
if [ -n "$CFG_ENABLE_RUSTBUILD" ]
1821+
then
1822+
INPUT_MAKEFILE=src/bootstrap/mk/Makefile.in
1823+
else
1824+
INPUT_MAKEFILE=Makefile.in
1825+
fi
1826+
18151827
msg
1816-
copy_if_changed ${CFG_SRC_DIR}Makefile.in ./Makefile
1828+
copy_if_changed ${CFG_SRC_DIR}${INPUT_MAKEFILE} ./Makefile
18171829
move_if_changed config.tmp config.mk
18181830
rm -f config.tmp
18191831
touch config.stamp

src/bootstrap/mk/Makefile.in

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Copyright 20126 The Rust Project Developers. See the COPYRIGHT
2+
# file at the top-level directory of this distribution and at
3+
# http://rust-lang.org/COPYRIGHT.
4+
#
5+
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
# option. This file may not be copied, modified, or distributed
9+
# except according to those terms.
10+
11+
include config.mk
12+
include $(CFG_SRC_DIR)mk/util.mk
13+
14+
ifdef VERBOSE
15+
BOOTSTRAP_ARGS := -v
16+
else
17+
BOOTSTRAP_ARGS :=
18+
endif
19+
20+
BOOTSTRAP := $(CFG_PYTHON) $(CFG_SRC_DIR)src/bootstrap/bootstrap.py $(BOOTSTRAP_ARGS)
21+
22+
all:
23+
$(Q)$(BOOTSTRAP)

0 commit comments

Comments
 (0)