Skip to content

Commit c92f8b8

Browse files
committed
---
yaml --- r: 275670 b: refs/heads/master c: c99b73a h: refs/heads/master
1 parent f55a9f4 commit c92f8b8

File tree

120 files changed

+8672
-7481
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+8672
-7481
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 887e9471783ff3f5edc920a85b6110486dc063c0
2+
refs/heads/master: c99b73a767a38d5b97214b7dbf6ee3c08ac782fd
33
refs/heads/snap-stage3: 235d77457d80b549dad3ac36d94f235208a1eafb
44
refs/heads/try: 49312a405e14a449b98fe0056b12a40ac128be4a
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

trunk/Makefile.in

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,13 @@ include $(CFG_SRC_DIR)mk/debuggers.mk
214214
# Secondary makefiles, conditionalized for speed
215215
######################################################################
216216

217+
# Binary snapshots
218+
ifneq ($(strip $(findstring snap,$(MAKECMDGOALS)) \
219+
$(findstring clean,$(MAKECMDGOALS))),)
220+
CFG_INFO := $(info cfg: including snap rules)
221+
include $(CFG_SRC_DIR)mk/snap.mk
222+
endif
223+
217224
# The test suite
218225
ifneq ($(strip $(findstring check,$(MAKECMDGOALS)) \
219226
$(findstring test,$(MAKECMDGOALS)) \

trunk/mk/crates.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ DEPS_rustc_const_eval := rustc_const_math rustc syntax log serialize \
9797
rustc_back graphviz
9898

9999
DEPS_rustc := syntax fmt_macros flate arena serialize getopts rbml \
100-
log graphviz rustc_llvm rustc_back rustc_data_structures\
100+
log graphviz rustc_back rustc_data_structures\
101101
rustc_const_math
102102
DEPS_rustc_back := std syntax flate log libc
103103
DEPS_rustc_borrowck := rustc rustc_mir log graphviz syntax

trunk/mk/dist.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ PKG_FILES := \
6161
rtstartup \
6262
rustllvm \
6363
rustc \
64-
stage0.txt \
64+
snapshots.txt \
6565
rust-installer \
6666
tools \
6767
test) \

trunk/mk/main.mk

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ CFG_FILENAME_EXTRA=$(shell printf '%s' $(CFG_RELEASE)$(CFG_EXTRA_FILENAME) | $(C
3434
# intentionally not "secure" by any definition, this is largely just a deterrent
3535
# from users enabling unstable features on the stable compiler.
3636
CFG_BOOTSTRAP_KEY=$(CFG_FILENAME_EXTRA)
37-
CFG_BOOTSTRAP_KEY_STAGE0=$(shell grep 'rustc_key' $(S)src/stage0.txt | sed 's/rustc_key: '//)
3837

3938
ifeq ($(CFG_RELEASE_CHANNEL),stable)
4039
# This is the normal semver version string, e.g. "0.12.0", "0.12.0-nightly"

trunk/mk/reconfig.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,6 @@ else
3838
SREL_ROOT := $(SREL)
3939
endif
4040

41-
config.stamp: $(S)configure $(S)Makefile.in $(S)src/stage0.txt
41+
config.stamp: $(S)configure $(S)Makefile.in $(S)src/snapshots.txt
4242
@$(call E, cfg: reconfiguring)
4343
$(SREL_ROOT)configure $(CFG_CONFIGURE_ARGS)

trunk/mk/rustllvm.mk

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ $$(RT_OUTPUT_DIR_$(1))/$$(call CFG_STATIC_LIB_NAME_$(1),rustllvm): \
4343
@$$(call E, link: $$@)
4444
$$(Q)$$(call CFG_CREATE_ARCHIVE_$(1),$$@) $$^
4545

46-
RUSTLLVM_COMPONENTS_$(1) = $$(shell echo $$(LLVM_ALL_COMPONENTS_$(1)) |\
47-
tr 'a-z-' 'A-Z_'| sed -e 's/^ //;s/\([^ ]*\)/\-DLLVM_COMPONENT_\1/g')
48-
4946
# On MSVC we need to double-escape arguments that llvm-config printed which
5047
# start with a '/'. The shell we're running in will auto-translate the argument
5148
# `/foo` to `C:/msys64/foo` but we really want it to be passed through as `/foo`
@@ -54,7 +51,6 @@ $(1)/rustllvm/%.o: $(S)src/rustllvm/%.cpp $$(MKFILE_DEPS) $$(LLVM_CONFIG_$(1))
5451
@$$(call E, compile: $$@)
5552
$$(Q)$$(call CFG_COMPILE_CXX_$(1), $$@,) \
5653
$$(subst /,//,$$(LLVM_CXXFLAGS_$(1))) \
57-
$$(RUSTLLVM_COMPONENTS_$(1)) \
5854
$$(EXTRA_RUSTLLVM_CXXFLAGS_$(1)) \
5955
$$(RUSTLLVM_INCS_$(1)) \
6056
$$<

trunk/mk/snap.mk

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Copyright 2012 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+
define DEF_SNAP_FOR_STAGE_H
12+
# $(1) stage
13+
# $(2) triple
14+
15+
snap-stage$(1)-H-$(2): $$(HSREQ$(1)_H_$(2))
16+
$(CFG_PYTHON) $(S)src/etc/make-snapshot.py stage$(1) $(2)
17+
18+
endef
19+
20+
$(foreach host,$(CFG_HOST), \
21+
$(foreach stage,1 2 3, \
22+
$(eval $(call DEF_SNAP_FOR_STAGE_H,$(stage),$(host)))))
23+
24+
snap-stage1: snap-stage1-H-$(CFG_BUILD)
25+
26+
snap-stage2: snap-stage2-H-$(CFG_BUILD)
27+
28+
snap-stage3: snap-stage3-H-$(CFG_BUILD)

trunk/mk/stage0.mk

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,17 @@ $(HLIB0_H_$(CFG_BUILD))/:
1010
endif
1111

1212
$(SNAPSHOT_RUSTC_POST_CLEANUP): \
13-
$(S)src/stage0.txt \
14-
$(S)src/etc/get-stage0.py $(MKFILE_DEPS) \
13+
$(S)src/snapshots.txt \
14+
$(S)src/etc/get-snapshot.py $(MKFILE_DEPS) \
1515
| $(HBIN0_H_$(CFG_BUILD))/
16+
1617
@$(call E, fetch: $@)
18+
# Note: the variable "SNAPSHOT_FILE" is generally not set, and so
19+
# we generally only pass one argument to this script.
1720
ifdef CFG_ENABLE_LOCAL_RUST
1821
$(Q)$(S)src/etc/local_stage0.sh $(CFG_BUILD) $(CFG_LOCAL_RUST_ROOT) rustlib
1922
else
20-
$(Q)$(CFG_PYTHON) $(S)src/etc/get-stage0.py $(CFG_BUILD)
23+
$(Q)$(CFG_PYTHON) $(S)src/etc/get-snapshot.py $(CFG_BUILD) $(SNAPSHOT_FILE)
2124
endif
2225
$(Q)if [ -e "$@" ]; then touch "$@"; else echo "ERROR: snapshot $@ not found"; exit 1; fi
2326

trunk/mk/target.mk

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,6 @@ $(foreach host,$(CFG_HOST), \
6565
# $(4) is the crate name
6666
define RUST_TARGET_STAGE_N
6767

68-
ifeq ($(1),0)
69-
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$(4): \
70-
export RUSTC_BOOTSTRAP_KEY := $$(CFG_BOOTSTRAP_KEY_STAGE0)
71-
endif
72-
7368
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$(4): CFG_COMPILER_HOST_TRIPLE = $(2)
7469
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$(4): \
7570
$$(CRATEFILE_$(4)) \
@@ -118,11 +113,6 @@ endef
118113
# $(4) - name of the tool being built
119114
define TARGET_TOOL
120115

121-
ifeq ($(1),0)
122-
$$(TBIN$(1)_T_$(2)_H_$(3))/$(4)$$(X_$(2)): \
123-
export RUSTC_BOOTSTRAP_KEY := $$(CFG_BOOTSTRAP_KEY_STAGE0)
124-
endif
125-
126116
$$(TBIN$(1)_T_$(2)_H_$(3))/$(4)$$(X_$(2)): \
127117
$$(TOOL_SOURCE_$(4)) \
128118
$$(TOOL_INPUTS_$(4)) \
@@ -177,15 +167,11 @@ SNAPSHOT_RUSTC_POST_CLEANUP=$(HBIN0_H_$(CFG_BUILD))/rustc$(X_$(CFG_BUILD))
177167

178168
define TARGET_HOST_RULES
179169

180-
$$(TLIB$(1)_T_$(2)_H_$(3))/: $$(SNAPSHOT_RUSTC_POST_CLEANUP)
181-
mkdir -p $$@
182-
183-
$$(TBIN$(1)_T_$(2)_H_$(3))/: $$(SNAPSHOT_RUSTC_POST_CLEANUP)
170+
$$(TLIB$(1)_T_$(2)_H_$(3))/:
184171
mkdir -p $$@
185172

186173
$$(TLIB$(1)_T_$(2)_H_$(3))/%: $$(RT_OUTPUT_DIR_$(2))/% \
187-
$$(SNAPSHOT_RUSTC_POST_CLEANUP) \
188-
| $$(TLIB$(1)_T_$(2)_H_$(3))/
174+
| $$(TLIB$(1)_T_$(2)_H_$(3))/ $$(SNAPSHOT_RUSTC_POST_CLEANUP)
189175
@$$(call E, cp: $$@)
190176
$$(Q)cp $$< $$@
191177
endef

trunk/mk/tests.mk

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -241,16 +241,13 @@ cleantestlibs:
241241
######################################################################
242242

243243
.PHONY: tidy
244-
tidy: $(HBIN0_H_$(CFG_BUILD))/tidy$(X_$(CFG_BUILD)) \
245-
$(SNAPSHOT_RUSTC_POST_CLEANUP)
244+
tidy: $(HBIN0_H_$(CFG_BUILD))/tidy$(X_$(CFG_BUILD))
246245
$(TARGET_RPATH_VAR0_T_$(CFG_BUILD)_H_$(CFG_BUILD)) $< $(S)src
247246

248247
$(HBIN0_H_$(CFG_BUILD))/tidy$(X_$(CFG_BUILD)): \
249248
$(TSREQ0_T_$(CFG_BUILD)_H_$(CFG_BUILD)) \
250249
$(TLIB0_T_$(CFG_BUILD)_H_$(CFG_BUILD))/stamp.std \
251-
$(call rwildcard,$(S)src/tools/tidy/src,*.rs) \
252-
$(SNAPSHOT_RUSTC_POST_CLEANUP) | \
253-
$(TLIB0_T_$(CFG_BUILD)_H_$(CFG_BUILD))
250+
$(call rwildcard,$(S)src/tools/tidy/src,*.rs)
254251
$(STAGE0_T_$(CFG_BUILD)_H_$(CFG_BUILD)) $(S)src/tools/tidy/src/main.rs \
255252
--out-dir $(@D) --crate-name tidy
256253

trunk/src/bootstrap/bootstrap.py

Lines changed: 67 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -79,22 +79,11 @@ def run(args, verbose=False):
7979
raise RuntimeError(err)
8080
sys.exit(err)
8181

82-
def stage0_data(rust_root):
83-
nightlies = os.path.join(rust_root, "src/stage0.txt")
84-
with open(nightlies, 'r') as nightlies:
85-
data = {}
86-
for line in nightlies.read().split("\n"):
87-
if line.startswith("#") or line == '':
88-
continue
89-
a, b = line.split(": ", 1)
90-
data[a] = b
91-
return data
92-
9382
class RustBuild:
94-
def download_stage0(self):
83+
def download_rust_nightly(self):
9584
cache_dst = os.path.join(self.build_dir, "cache")
96-
rustc_cache = os.path.join(cache_dst, self.stage0_rustc_date())
97-
cargo_cache = os.path.join(cache_dst, self.stage0_cargo_date())
85+
rustc_cache = os.path.join(cache_dst, self.snap_rustc_date())
86+
cargo_cache = os.path.join(cache_dst, self.snap_cargo_date())
9887
if not os.path.exists(rustc_cache):
9988
os.makedirs(rustc_cache)
10089
if not os.path.exists(cargo_cache):
@@ -104,49 +93,41 @@ def download_stage0(self):
10493
(not os.path.exists(self.rustc()) or self.rustc_out_of_date()):
10594
if os.path.exists(self.bin_root()):
10695
shutil.rmtree(self.bin_root())
107-
channel = self.stage0_rustc_channel()
108-
filename = "rust-std-" + channel + "-" + self.build + ".tar.gz"
109-
url = "https://static.rust-lang.org/dist/" + self.stage0_rustc_date()
96+
filename = "rust-std-nightly-" + self.build + ".tar.gz"
97+
url = "https://static.rust-lang.org/dist/" + self.snap_rustc_date()
11098
tarball = os.path.join(rustc_cache, filename)
11199
if not os.path.exists(tarball):
112100
get(url + "/" + filename, tarball, verbose=self.verbose)
113101
unpack(tarball, self.bin_root(),
114102
match="rust-std-" + self.build,
115103
verbose=self.verbose)
116104

117-
filename = "rustc-" + channel + "-" + self.build + ".tar.gz"
118-
url = "https://static.rust-lang.org/dist/" + self.stage0_rustc_date()
105+
filename = "rustc-nightly-" + self.build + ".tar.gz"
106+
url = "https://static.rust-lang.org/dist/" + self.snap_rustc_date()
119107
tarball = os.path.join(rustc_cache, filename)
120108
if not os.path.exists(tarball):
121109
get(url + "/" + filename, tarball, verbose=self.verbose)
122110
unpack(tarball, self.bin_root(), match="rustc", verbose=self.verbose)
123111
with open(self.rustc_stamp(), 'w') as f:
124-
f.write(self.stage0_rustc_date())
112+
f.write(self.snap_rustc_date())
125113

126114
if self.cargo().startswith(self.bin_root()) and \
127115
(not os.path.exists(self.cargo()) or self.cargo_out_of_date()):
128-
channel = self.stage0_cargo_channel()
129-
filename = "cargo-" + channel + "-" + self.build + ".tar.gz"
130-
url = "https://static.rust-lang.org/cargo-dist/" + self.stage0_cargo_date()
116+
filename = "cargo-nightly-" + self.build + ".tar.gz"
117+
url = "https://static.rust-lang.org/cargo-dist/" + self.snap_cargo_date()
131118
tarball = os.path.join(cargo_cache, filename)
132119
if not os.path.exists(tarball):
133120
get(url + "/" + filename, tarball, verbose=self.verbose)
134121
unpack(tarball, self.bin_root(), match="cargo", verbose=self.verbose)
135122
with open(self.cargo_stamp(), 'w') as f:
136-
f.write(self.stage0_cargo_date())
123+
f.write(self.snap_cargo_date())
137124

138-
def stage0_cargo_date(self):
125+
def snap_cargo_date(self):
139126
return self._cargo_date
140127

141-
def stage0_cargo_channel(self):
142-
return self._cargo_channel
143-
144-
def stage0_rustc_date(self):
128+
def snap_rustc_date(self):
145129
return self._rustc_date
146130

147-
def stage0_rustc_channel(self):
148-
return self._rustc_channel
149-
150131
def rustc_stamp(self):
151132
return os.path.join(self.bin_root(), '.rustc-stamp')
152133

@@ -157,13 +138,13 @@ def rustc_out_of_date(self):
157138
if not os.path.exists(self.rustc_stamp()):
158139
return True
159140
with open(self.rustc_stamp(), 'r') as f:
160-
return self.stage0_rustc_date() != f.read()
141+
return self.snap_rustc_date() != f.read()
161142

162143
def cargo_out_of_date(self):
163144
if not os.path.exists(self.cargo_stamp()):
164145
return True
165146
with open(self.cargo_stamp(), 'r') as f:
166-
return self.stage0_cargo_date() != f.read()
147+
return self.snap_cargo_date() != f.read()
167148

168149
def bin_root(self):
169150
return os.path.join(self.build_dir, self.build, "stage0")
@@ -206,6 +187,15 @@ def exe_suffix(self):
206187
else:
207188
return ''
208189

190+
def parse_nightly_dates(self):
191+
nightlies = os.path.join(self.rust_root, "src/nightlies.txt")
192+
with open(nightlies, 'r') as nightlies:
193+
rustc, cargo = nightlies.read().split("\n")[:2]
194+
assert rustc.startswith("rustc: ")
195+
assert cargo.startswith("cargo: ")
196+
self._rustc_date = rustc[len("rustc: "):]
197+
self._cargo_date = cargo[len("cargo: "):]
198+
209199
def build_bootstrap(self):
210200
env = os.environ.copy()
211201
env["CARGO_TARGET_DIR"] = os.path.join(self.build_dir, "bootstrap")
@@ -310,53 +300,46 @@ def build_triple(self):
310300

311301
return cputype + '-' + ostype
312302

313-
def main():
314-
parser = argparse.ArgumentParser(description='Build rust')
315-
parser.add_argument('--config')
316-
parser.add_argument('-v', '--verbose', action='store_true')
317-
318-
args = [a for a in sys.argv if a != '-h']
319-
args, _ = parser.parse_known_args(args)
320-
321-
# Configure initial bootstrap
322-
rb = RustBuild()
323-
rb.config_toml = ''
324-
rb.config_mk = ''
325-
rb.rust_root = os.path.abspath(os.path.join(__file__, '../../..'))
326-
rb.build_dir = os.path.join(os.getcwd(), "build")
327-
rb.verbose = args.verbose
328-
329-
try:
330-
with open(args.config or 'config.toml') as config:
331-
rb.config_toml = config.read()
332-
except:
333-
pass
334-
try:
335-
rb.config_mk = open('config.mk').read()
336-
except:
337-
pass
338-
339-
data = stage0_data(rb.rust_root)
340-
rb._rustc_channel, rb._rustc_date = data['rustc'].split('-', 1)
341-
rb._cargo_channel, rb._cargo_date = data['cargo'].split('-', 1)
342-
343-
# Fetch/build the bootstrap
344-
rb.build = rb.build_triple()
345-
rb.download_stage0()
346-
sys.stdout.flush()
347-
rb.build_bootstrap()
348-
sys.stdout.flush()
349-
350-
# Run the bootstrap
351-
args = [os.path.join(rb.build_dir, "bootstrap/debug/bootstrap")]
352-
args.append('--src')
353-
args.append(rb.rust_root)
354-
args.append('--build')
355-
args.append(rb.build)
356-
args.extend(sys.argv[1:])
357-
env = os.environ.copy()
358-
env["BOOTSTRAP_PARENT_ID"] = str(os.getpid())
359-
rb.run(args, env)
360-
361-
if __name__ == '__main__':
362-
main()
303+
parser = argparse.ArgumentParser(description='Build rust')
304+
parser.add_argument('--config')
305+
parser.add_argument('-v', '--verbose', action='store_true')
306+
307+
args = [a for a in sys.argv if a != '-h']
308+
args, _ = parser.parse_known_args(args)
309+
310+
# Configure initial bootstrap
311+
rb = RustBuild()
312+
rb.config_toml = ''
313+
rb.config_mk = ''
314+
rb.rust_root = os.path.abspath(os.path.join(__file__, '../../..'))
315+
rb.build_dir = os.path.join(os.getcwd(), "build")
316+
rb.verbose = args.verbose
317+
318+
try:
319+
with open(args.config or 'config.toml') as config:
320+
rb.config_toml = config.read()
321+
except:
322+
pass
323+
try:
324+
rb.config_mk = open('config.mk').read()
325+
except:
326+
pass
327+
328+
# Fetch/build the bootstrap
329+
rb.build = rb.build_triple()
330+
rb.parse_nightly_dates()
331+
rb.download_rust_nightly()
332+
sys.stdout.flush()
333+
rb.build_bootstrap()
334+
sys.stdout.flush()
335+
336+
# Run the bootstrap
337+
args = [os.path.join(rb.build_dir, "bootstrap/debug/bootstrap")]
338+
args.append('--src')
339+
args.append(rb.rust_root)
340+
args.append('--build')
341+
args.append(rb.build)
342+
args.extend(sys.argv[1:])
343+
env = os.environ.copy()
344+
env["BOOTSTRAP_PARENT_ID"] = str(os.getpid())
345+
rb.run(args, env)

0 commit comments

Comments
 (0)