if not os.path.exists(rustc_cache):
os.makedirs(rustc_cache)
+ channel = self.stage0_rustc_channel()
+
if self.rustc().startswith(self.bin_root()) and \
(not os.path.exists(self.rustc()) or self.rustc_out_of_date()):
self.print_what_it_means_to_bootstrap()
if os.path.exists(self.bin_root()):
shutil.rmtree(self.bin_root())
- channel = self.stage0_rustc_channel()
filename = "rust-std-{}-{}.tar.gz".format(channel, self.build)
url = "https://static.rust-lang.org/dist/" + self.stage0_rustc_date()
tarball = os.path.join(rustc_cache, filename)
with open(self.rustc_stamp(), 'w') as f:
f.write(self.stage0_rustc_date())
+ if "pc-windows-gnu" in self.build:
+ filename = "rust-mingw-{}-{}.tar.gz".format(channel, self.build)
+ url = "https://static.rust-lang.org/dist/" + self.stage0_rustc_date()
+ tarball = os.path.join(rustc_cache, filename)
+ if not os.path.exists(tarball):
+ get("{}/{}".format(url, filename), tarball, verbose=self.verbose)
+ unpack(tarball, self.bin_root(), match="rust-mingw", verbose=self.verbose)
+
if self.cargo().startswith(self.bin_root()) and \
(not os.path.exists(self.cargo()) or self.cargo_out_of_date()):
self.print_what_it_means_to_bootstrap()
env["DYLD_LIBRARY_PATH"] = os.path.join(self.bin_root(), "lib") + \
(os.pathsep + env["DYLD_LIBRARY_PATH"]) \
if "DYLD_LIBRARY_PATH" in env else ""
+ env["LIBRARY_PATH"] = os.path.join(self.bin_root(), "lib") + \
+ (os.pathsep + env["LIBRARY_PATH"]) \
+ if "LIBRARY_PATH" in env else ""
env["PATH"] = os.path.join(self.bin_root(), "bin") + \
os.pathsep + env["PATH"]
if not os.path.isfile(self.cargo()):
raise Exception(err)
sys.exit(err)
- # Darwin's `uname -s` lies and always returns i386. We have to use
- # sysctl instead.
- if ostype == 'Darwin' and cputype == 'i686':
- args = ['sysctl', 'hw.optional.x86_64']
- sysctl = subprocess.check_output(args).decode(default_encoding)
- if ': 1' in sysctl:
- cputype = 'x86_64'
-
# The goal here is to come up with the same triple as LLVM would,
# at least for the subset of platforms we're willing to target.
if ostype == 'Linux':
- ostype = 'unknown-linux-gnu'
+ os = subprocess.check_output(['uname', '-o']).strip().decode(default_encoding)
+ if os == 'Android':
+ ostype = 'linux-android'
+ else:
+ ostype = 'unknown-linux-gnu'
elif ostype == 'FreeBSD':
ostype = 'unknown-freebsd'
elif ostype == 'DragonFly':
cputype = 'i686'
elif cputype in {'xscale', 'arm'}:
cputype = 'arm'
- elif cputype in {'armv6l', 'armv7l', 'armv8l'}:
+ if ostype == 'linux-android':
+ ostype = 'linux-androideabi'
+ elif cputype == 'armv6l':
cputype = 'arm'
- ostype += 'eabihf'
- elif cputype == 'armv7l':
+ if ostype == 'linux-android':
+ ostype = 'linux-androideabi'
+ else:
+ ostype += 'eabihf'
+ elif cputype in {'armv7l', 'armv8l'}:
cputype = 'armv7'
- ostype += 'eabihf'
- elif cputype == 'aarch64':
- cputype = 'aarch64'
- elif cputype == 'arm64':
+ if ostype == 'linux-android':
+ ostype = 'linux-androideabi'
+ else:
+ ostype += 'eabihf'
+ elif cputype in {'aarch64', 'arm64'}:
cputype = 'aarch64'
elif cputype == 'mips':
if sys.byteorder == 'big':
def main():
start_time = time()
+ help_triggered = ('-h' in sys.argv) or ('--help' in sys.argv) or (len(sys.argv) == 1)
try:
bootstrap()
- print("Build completed successfully in %s" % format_build_time(time() - start_time))
+ if not help_triggered:
+ print("Build completed successfully in %s" % format_build_time(time() - start_time))
except (SystemExit, KeyboardInterrupt) as e:
if hasattr(e, 'code') and isinstance(e.code, int):
exit_code = e.code
else:
exit_code = 1
print(e)
- print("Build completed unsuccessfully in %s" % format_build_time(time() - start_time))
+ if not help_triggered:
+ print("Build completed unsuccessfully in %s" % format_build_time(time() - start_time))
sys.exit(exit_code)
if __name__ == '__main__':