bootstrap: Read configuration from config.mk

During the transition period where we're still using ./configure and makefiles,
read some extra configuration from `config.mk` if it's present. This means that
the bootstrap build should be configured the same as the original ./configure
invocation.

Eventually this will all be removed in favor of only storing information in
`config.toml` (e.g. the configure script will generate config.toml), but for now
this should suffice.
This commit is contained in:
Alex Crichton
2015-11-19 16:55:21 -08:00
parent 046e6874c4
commit 0a54e4dd87
3 changed files with 123 additions and 0 deletions

View File

@@ -135,6 +135,12 @@ class RustBuild:
return self.get_string(line)
return None
def get_mk(self, key):
for line in iter(self.config_mk.splitlines()):
if line.startswith(key):
return line[line.find(':=') + 2:].strip()
return None
def cargo(self):
config = self.get_toml('cargo')
if config:
@@ -145,6 +151,9 @@ class RustBuild:
config = self.get_toml('rustc')
if config:
return config
config = self.get_mk('CFG_LOCAL_RUST')
if config:
return config + '/bin/rustc' + self.exe_suffix()
return os.path.join(self.bin_root(), "bin/rustc" + self.exe_suffix())
def get_string(self, line):
@@ -187,6 +196,9 @@ class RustBuild:
def build_triple(self):
config = self.get_toml('build')
if config:
return config
config = self.get_mk('CFG_BUILD')
if config:
return config
try:
@@ -279,6 +291,10 @@ try:
rb.config_toml = config.read()
except:
pass
try:
rb.config_mk = open('config.mk').read()
except:
pass
# Fetch/build the bootstrap
rb.build = rb.build_triple()