mirror of
https://github.com/rust-lang/rust
synced 2024-07-21 10:26:41 +00:00
Merge branch 'master' into ty-placeholder
This commit is contained in:
commit
8c31412c2f
2
.gitmodules
vendored
2
.gitmodules
vendored
|
@ -25,4 +25,4 @@
|
|||
url = https://github.com/rust-lang-nursery/reference.git
|
||||
[submodule "book"]
|
||||
path = src/doc/book
|
||||
url = https://github.com/rust-lang/book
|
||||
url = https://github.com/rust-lang/book.git
|
||||
|
|
22
.travis.yml
22
.travis.yml
|
@ -15,19 +15,27 @@ matrix:
|
|||
- env: IMAGE=arm-android
|
||||
- env: IMAGE=armhf-gnu
|
||||
- env: IMAGE=cross DEPLOY=1
|
||||
- env: IMAGE=dist-aarch64-linux DEPLOY=1
|
||||
- env: IMAGE=dist-android DEPLOY=1
|
||||
- env: IMAGE=dist-arm-linux DEPLOY=1
|
||||
- env: IMAGE=dist-armv7-aarch64-linux DEPLOY=1
|
||||
- env: IMAGE=dist-freebsd DEPLOY=1
|
||||
- env: IMAGE=dist-i586-gnu-i686-musl DEPLOY=1
|
||||
- env: IMAGE=dist-armhf-linux DEPLOY=1
|
||||
- env: IMAGE=dist-armv7-linux DEPLOY=1
|
||||
- env: IMAGE=dist-fuchsia DEPLOY=1
|
||||
- env: IMAGE=dist-i586-gnu-i686-musl DEPLOY=1
|
||||
- env: IMAGE=dist-i686-freebsd DEPLOY=1
|
||||
- env: IMAGE=dist-i686-linux DEPLOY=1
|
||||
- env: IMAGE=dist-mips-linux DEPLOY=1
|
||||
- env: IMAGE=dist-mips64-linux DEPLOY=1
|
||||
- env: IMAGE=dist-mips64el-linux DEPLOY=1
|
||||
- env: IMAGE=dist-mipsel-linux DEPLOY=1
|
||||
- env: IMAGE=dist-powerpc-linux DEPLOY=1
|
||||
- env: IMAGE=dist-powerpc64-linux DEPLOY=1
|
||||
- env: IMAGE=dist-s390x-linux-netbsd DEPLOY=1
|
||||
- env: IMAGE=dist-x86-linux DEPLOY=1
|
||||
- env: IMAGE=dist-powerpc64le-linux DEPLOY=1
|
||||
- env: IMAGE=dist-s390x-linux DEPLOY=1
|
||||
- env: IMAGE=dist-x86_64-freebsd DEPLOY=1
|
||||
- env: IMAGE=dist-x86_64-linux DEPLOY=1
|
||||
- env: IMAGE=dist-x86_64-musl DEPLOY=1
|
||||
- env: IMAGE=dist-x86_64-netbsd DEPLOY=1
|
||||
- env: IMAGE=emscripten
|
||||
- env: IMAGE=i686-gnu
|
||||
- env: IMAGE=i686-gnu-nopt
|
||||
|
@ -55,7 +63,7 @@ matrix:
|
|||
os: osx
|
||||
osx_image: xcode8.2
|
||||
install: &osx_install_sccache >
|
||||
travis_retry curl -o /usr/local/bin/sccache https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-24-sccache-x86_64-apple-darwin &&
|
||||
travis_retry curl -o /usr/local/bin/sccache https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-04-04-sccache-x86_64-apple-darwin &&
|
||||
chmod +x /usr/local/bin/sccache &&
|
||||
travis_retry curl -o /usr/local/bin/stamp https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-17-stamp-x86_64-apple-darwin &&
|
||||
chmod +x /usr/local/bin/stamp
|
||||
|
@ -104,7 +112,7 @@ matrix:
|
|||
# turned on, they're deployed to a different location primarily for projects
|
||||
# which are stuck on nightly and don't want llvm assertions in the artifacts
|
||||
# that they use.
|
||||
- env: IMAGE=dist-x86-linux DEPLOY_ALT=1
|
||||
- env: IMAGE=dist-x86_64-linux DEPLOY_ALT=1
|
||||
- env: >
|
||||
RUST_CHECK_TARGET=dist
|
||||
RUST_CONFIGURE_ARGS="--enable-extended"
|
||||
|
|
|
@ -115,8 +115,8 @@ install:
|
|||
- set PATH=C:\Python27;%PATH%
|
||||
|
||||
# Download and install sccache
|
||||
- appveyor-retry appveyor DownloadFile https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-24-sccache-x86_64-pc-windows-msvc
|
||||
- mv 2017-03-24-sccache-x86_64-pc-windows-msvc sccache.exe
|
||||
- appveyor-retry appveyor DownloadFile https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-04-04-sccache-x86_64-pc-windows-msvc
|
||||
- mv 2017-04-04-sccache-x86_64-pc-windows-msvc sccache.exe
|
||||
- set PATH=%PATH%;%CD%
|
||||
|
||||
# Download and install ninja
|
||||
|
|
2
cargo
2
cargo
|
@ -1 +1 @@
|
|||
Subproject commit 4e95c6b41eca3388f54dd5f7787366ad2df637b5
|
||||
Subproject commit 4729175045b41b688ab903120860866ce7a22ba9
|
|
@ -163,12 +163,13 @@ class RustBuild(object):
|
|||
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)
|
||||
|
@ -189,6 +190,14 @@ class RustBuild(object):
|
|||
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()
|
||||
|
@ -591,16 +600,19 @@ def bootstrap():
|
|||
|
||||
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__':
|
||||
|
|
|
@ -44,26 +44,25 @@ pub fn clean(build: &Build) {
|
|||
}
|
||||
|
||||
fn rm_rf(path: &Path) {
|
||||
if !path.exists() {
|
||||
return
|
||||
}
|
||||
if path.is_file() {
|
||||
return do_op(path, "remove file", |p| fs::remove_file(p));
|
||||
}
|
||||
match path.symlink_metadata() {
|
||||
Err(e) => {
|
||||
if e.kind() == ErrorKind::NotFound {
|
||||
return;
|
||||
}
|
||||
panic!("failed to get metadata for file {}: {}", path.display(), e);
|
||||
},
|
||||
Ok(metadata) => {
|
||||
if metadata.file_type().is_file() || metadata.file_type().is_symlink() {
|
||||
do_op(path, "remove file", |p| fs::remove_file(p));
|
||||
return;
|
||||
}
|
||||
|
||||
for file in t!(fs::read_dir(path)) {
|
||||
let file = t!(file).path();
|
||||
|
||||
if file.is_dir() {
|
||||
rm_rf(&file);
|
||||
} else {
|
||||
// On windows we can't remove a readonly file, and git will
|
||||
// often clone files as readonly. As a result, we have some
|
||||
// special logic to remove readonly files on windows.
|
||||
do_op(&file, "remove file", |p| fs::remove_file(p));
|
||||
}
|
||||
}
|
||||
do_op(path, "remove dir", |p| fs::remove_dir(p));
|
||||
for file in t!(fs::read_dir(path)) {
|
||||
rm_rf(&t!(file).path());
|
||||
}
|
||||
do_op(path, "remove dir", |p| fs::remove_dir(p));
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
fn do_op<F>(path: &Path, desc: &str, mut f: F)
|
||||
|
@ -71,9 +70,12 @@ fn do_op<F>(path: &Path, desc: &str, mut f: F)
|
|||
{
|
||||
match f(path) {
|
||||
Ok(()) => {}
|
||||
// On windows we can't remove a readonly file, and git will often clone files as readonly.
|
||||
// As a result, we have some special logic to remove readonly files on windows.
|
||||
// This is also the reason that we can't use things like fs::remove_dir_all().
|
||||
Err(ref e) if cfg!(windows) &&
|
||||
e.kind() == ErrorKind::PermissionDenied => {
|
||||
let mut p = t!(path.metadata()).permissions();
|
||||
let mut p = t!(path.symlink_metadata()).permissions();
|
||||
p.set_readonly(false);
|
||||
t!(fs::set_permissions(path, p));
|
||||
f(path).unwrap_or_else(|e| {
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
use std::path::PathBuf;
|
||||
use std::process;
|
||||
|
||||
use getopts::{Matches, Options};
|
||||
use getopts::Options;
|
||||
|
||||
use Build;
|
||||
use config::Config;
|
||||
|
@ -75,7 +75,22 @@ pub enum Subcommand {
|
|||
|
||||
impl Flags {
|
||||
pub fn parse(args: &[String]) -> Flags {
|
||||
let mut extra_help = String::new();
|
||||
let mut subcommand_help = format!("\
|
||||
Usage: x.py <subcommand> [options] [<paths>...]
|
||||
|
||||
Subcommands:
|
||||
build Compile either the compiler or libraries
|
||||
test Build and run some test suites
|
||||
bench Build and run some benchmarks
|
||||
doc Build documentation
|
||||
clean Clean out build directories
|
||||
dist Build and/or install distribution artifacts
|
||||
|
||||
To learn more about a subcommand, run `./x.py <subcommand> -h`");
|
||||
|
||||
let mut opts = Options::new();
|
||||
// Options common to all subcommands
|
||||
opts.optflagmulti("v", "verbose", "use verbose output (-vv for very verbose)");
|
||||
opts.optflag("i", "incremental", "use incremental compilation");
|
||||
opts.optopt("", "config", "TOML configuration file for build", "FILE");
|
||||
|
@ -89,21 +104,83 @@ pub fn parse(args: &[String]) -> Flags {
|
|||
opts.optopt("j", "jobs", "number of jobs to run in parallel", "JOBS");
|
||||
opts.optflag("h", "help", "print this help message");
|
||||
|
||||
let usage = |n, opts: &Options| -> ! {
|
||||
let command = args.get(0).map(|s| &**s);
|
||||
let brief = format!("Usage: x.py {} [options] [<args>...]",
|
||||
command.unwrap_or("<command>"));
|
||||
// fn usage()
|
||||
let usage = |exit_code: i32, opts: &Options, subcommand_help: &str, extra_help: &str| -> ! {
|
||||
println!("{}", opts.usage(subcommand_help));
|
||||
if !extra_help.is_empty() {
|
||||
println!("{}", extra_help);
|
||||
}
|
||||
process::exit(exit_code);
|
||||
};
|
||||
|
||||
println!("{}", opts.usage(&brief));
|
||||
match command {
|
||||
Some("build") => {
|
||||
println!("\
|
||||
// We can't use getopt to parse the options until we have completed specifying which
|
||||
// options are valid, but under the current implementation, some options are conditional on
|
||||
// the subcommand. Therefore we must manually identify the subcommand first, so that we can
|
||||
// complete the definition of the options. Then we can use the getopt::Matches object from
|
||||
// there on out.
|
||||
let mut possible_subcommands = args.iter().collect::<Vec<_>>();
|
||||
possible_subcommands.retain(|&s|
|
||||
(s == "build")
|
||||
|| (s == "test")
|
||||
|| (s == "bench")
|
||||
|| (s == "doc")
|
||||
|| (s == "clean")
|
||||
|| (s == "dist"));
|
||||
let subcommand = match possible_subcommands.first() {
|
||||
Some(s) => s,
|
||||
None => {
|
||||
// No subcommand -- show the general usage and subcommand help
|
||||
println!("{}\n", subcommand_help);
|
||||
process::exit(0);
|
||||
}
|
||||
};
|
||||
|
||||
// Some subcommands get extra options
|
||||
match subcommand.as_str() {
|
||||
"test" => { opts.optmulti("", "test-args", "extra arguments", "ARGS"); },
|
||||
"bench" => { opts.optmulti("", "test-args", "extra arguments", "ARGS"); },
|
||||
"dist" => { opts.optflag("", "install", "run installer as well"); },
|
||||
_ => { },
|
||||
};
|
||||
|
||||
// Done specifying what options are possible, so do the getopts parsing
|
||||
let matches = opts.parse(&args[..]).unwrap_or_else(|e| {
|
||||
// Invalid argument/option format
|
||||
println!("\n{}\n", e);
|
||||
usage(1, &opts, &subcommand_help, &extra_help);
|
||||
});
|
||||
// Extra sanity check to make sure we didn't hit this crazy corner case:
|
||||
//
|
||||
// ./x.py --frobulate clean build
|
||||
// ^-- option ^ ^- actual subcommand
|
||||
// \_ arg to option could be mistaken as subcommand
|
||||
let mut pass_sanity_check = true;
|
||||
match matches.free.get(0) {
|
||||
Some(check_subcommand) => {
|
||||
if &check_subcommand != subcommand {
|
||||
pass_sanity_check = false;
|
||||
}
|
||||
},
|
||||
None => {
|
||||
pass_sanity_check = false;
|
||||
}
|
||||
}
|
||||
if !pass_sanity_check {
|
||||
println!("{}\n", subcommand_help);
|
||||
println!("Sorry, I couldn't figure out which subcommand you were trying to specify.\n\
|
||||
You may need to move some options to after the subcommand.\n");
|
||||
process::exit(1);
|
||||
}
|
||||
// Extra help text for some commands
|
||||
match subcommand.as_str() {
|
||||
"build" => {
|
||||
subcommand_help.push_str("\n
|
||||
Arguments:
|
||||
This subcommand accepts a number of positional arguments of directories to
|
||||
the crates and/or artifacts to compile. For example:
|
||||
This subcommand accepts a number of paths to directories to the crates
|
||||
and/or artifacts to compile. For example:
|
||||
|
||||
./x.py build src/libcore
|
||||
./x.py build src/libproc_macro
|
||||
./x.py build src/libcore src/libproc_macro
|
||||
./x.py build src/libstd --stage 1
|
||||
|
||||
If no arguments are passed then the complete artifacts for that stage are
|
||||
|
@ -114,15 +191,13 @@ pub fn parse(args: &[String]) -> Flags {
|
|||
|
||||
For a quick build with a usable compile, you can pass:
|
||||
|
||||
./x.py build --stage 1 src/libtest
|
||||
");
|
||||
}
|
||||
|
||||
Some("test") => {
|
||||
println!("\
|
||||
./x.py build --stage 1 src/libtest");
|
||||
}
|
||||
"test" => {
|
||||
subcommand_help.push_str("\n
|
||||
Arguments:
|
||||
This subcommand accepts a number of positional arguments of directories to
|
||||
tests that should be compiled and run. For example:
|
||||
This subcommand accepts a number of paths to directories to tests that
|
||||
should be compiled and run. For example:
|
||||
|
||||
./x.py test src/test/run-pass
|
||||
./x.py test src/libstd --test-args hash_map
|
||||
|
@ -132,139 +207,90 @@ pub fn parse(args: &[String]) -> Flags {
|
|||
compiled and tested.
|
||||
|
||||
./x.py test
|
||||
./x.py test --stage 1
|
||||
");
|
||||
}
|
||||
|
||||
Some("doc") => {
|
||||
println!("\
|
||||
./x.py test --stage 1");
|
||||
}
|
||||
"doc" => {
|
||||
subcommand_help.push_str("\n
|
||||
Arguments:
|
||||
This subcommand accepts a number of positional arguments of directories of
|
||||
documentation to build. For example:
|
||||
This subcommand accepts a number of paths to directories of documentation
|
||||
to build. For example:
|
||||
|
||||
./x.py doc src/doc/book
|
||||
./x.py doc src/doc/nomicon
|
||||
./x.py doc src/libstd
|
||||
./x.py doc src/doc/book src/libstd
|
||||
|
||||
If no arguments are passed then everything is documented:
|
||||
|
||||
./x.py doc
|
||||
./x.py doc --stage 1
|
||||
");
|
||||
}
|
||||
|
||||
_ => {}
|
||||
./x.py doc --stage 1");
|
||||
}
|
||||
|
||||
if let Some(command) = command {
|
||||
if command == "build" ||
|
||||
command == "dist" ||
|
||||
command == "doc" ||
|
||||
command == "test" ||
|
||||
command == "bench" ||
|
||||
command == "clean" {
|
||||
println!("Available invocations:");
|
||||
if args.iter().any(|a| a == "-v") {
|
||||
let flags = Flags::parse(&["build".to_string()]);
|
||||
let mut config = Config::default();
|
||||
config.build = flags.build.clone();
|
||||
let mut build = Build::new(flags, config);
|
||||
metadata::build(&mut build);
|
||||
step::build_rules(&build).print_help(command);
|
||||
} else {
|
||||
println!(" ... elided, run `./x.py {} -h -v` to see",
|
||||
command);
|
||||
}
|
||||
|
||||
println!("");
|
||||
}
|
||||
}
|
||||
|
||||
println!("\
|
||||
Subcommands:
|
||||
build Compile either the compiler or libraries
|
||||
test Build and run some test suites
|
||||
bench Build and run some benchmarks
|
||||
doc Build documentation
|
||||
clean Clean out build directories
|
||||
dist Build and/or install distribution artifacts
|
||||
|
||||
To learn more about a subcommand, run `./x.py <command> -h`
|
||||
");
|
||||
|
||||
process::exit(n);
|
||||
_ => { }
|
||||
};
|
||||
if args.len() == 0 {
|
||||
println!("a command must be passed");
|
||||
usage(1, &opts);
|
||||
}
|
||||
let parse = |opts: &Options| {
|
||||
let m = opts.parse(&args[1..]).unwrap_or_else(|e| {
|
||||
println!("failed to parse options: {}", e);
|
||||
usage(1, opts);
|
||||
});
|
||||
if m.opt_present("h") {
|
||||
usage(0, opts);
|
||||
}
|
||||
return m
|
||||
};
|
||||
|
||||
// Get any optional paths which occur after the subcommand
|
||||
let cwd = t!(env::current_dir());
|
||||
let remaining_as_path = |m: &Matches| {
|
||||
m.free.iter().map(|p| cwd.join(p)).collect::<Vec<_>>()
|
||||
};
|
||||
let paths = matches.free[1..].iter().map(|p| cwd.join(p)).collect::<Vec<_>>();
|
||||
|
||||
let m: Matches;
|
||||
let cmd = match &args[0][..] {
|
||||
"build" => {
|
||||
m = parse(&opts);
|
||||
Subcommand::Build { paths: remaining_as_path(&m) }
|
||||
|
||||
// All subcommands can have an optional "Available paths" section
|
||||
if matches.opt_present("verbose") {
|
||||
let flags = Flags::parse(&["build".to_string()]);
|
||||
let mut config = Config::default();
|
||||
config.build = flags.build.clone();
|
||||
let mut build = Build::new(flags, config);
|
||||
metadata::build(&mut build);
|
||||
let maybe_rules_help = step::build_rules(&build).get_help(subcommand);
|
||||
if maybe_rules_help.is_some() {
|
||||
extra_help.push_str(maybe_rules_help.unwrap().as_str());
|
||||
}
|
||||
"doc" => {
|
||||
m = parse(&opts);
|
||||
Subcommand::Doc { paths: remaining_as_path(&m) }
|
||||
} else {
|
||||
extra_help.push_str(format!("Run `./x.py {} -h -v` to see a list of available paths.",
|
||||
subcommand).as_str());
|
||||
}
|
||||
|
||||
// User passed in -h/--help?
|
||||
if matches.opt_present("help") {
|
||||
usage(0, &opts, &subcommand_help, &extra_help);
|
||||
}
|
||||
|
||||
let cmd = match subcommand.as_str() {
|
||||
"build" => {
|
||||
Subcommand::Build { paths: paths }
|
||||
}
|
||||
"test" => {
|
||||
opts.optmulti("", "test-args", "extra arguments", "ARGS");
|
||||
m = parse(&opts);
|
||||
Subcommand::Test {
|
||||
paths: remaining_as_path(&m),
|
||||
test_args: m.opt_strs("test-args"),
|
||||
paths: paths,
|
||||
test_args: matches.opt_strs("test-args"),
|
||||
}
|
||||
}
|
||||
"bench" => {
|
||||
opts.optmulti("", "test-args", "extra arguments", "ARGS");
|
||||
m = parse(&opts);
|
||||
Subcommand::Bench {
|
||||
paths: remaining_as_path(&m),
|
||||
test_args: m.opt_strs("test-args"),
|
||||
paths: paths,
|
||||
test_args: matches.opt_strs("test-args"),
|
||||
}
|
||||
}
|
||||
"doc" => {
|
||||
Subcommand::Doc { paths: paths }
|
||||
}
|
||||
"clean" => {
|
||||
m = parse(&opts);
|
||||
if m.free.len() > 0 {
|
||||
println!("clean takes no arguments");
|
||||
usage(1, &opts);
|
||||
if paths.len() > 0 {
|
||||
println!("\nclean takes no arguments\n");
|
||||
usage(1, &opts, &subcommand_help, &extra_help);
|
||||
}
|
||||
Subcommand::Clean
|
||||
}
|
||||
"dist" => {
|
||||
opts.optflag("", "install", "run installer as well");
|
||||
m = parse(&opts);
|
||||
Subcommand::Dist {
|
||||
paths: remaining_as_path(&m),
|
||||
install: m.opt_present("install"),
|
||||
paths: paths,
|
||||
install: matches.opt_present("install"),
|
||||
}
|
||||
}
|
||||
"--help" => usage(0, &opts),
|
||||
cmd => {
|
||||
println!("unknown command: {}", cmd);
|
||||
usage(1, &opts);
|
||||
_ => {
|
||||
usage(1, &opts, &subcommand_help, &extra_help);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
let cfg_file = m.opt_str("config").map(PathBuf::from).or_else(|| {
|
||||
let cfg_file = matches.opt_str("config").map(PathBuf::from).or_else(|| {
|
||||
if fs::metadata("config.toml").is_ok() {
|
||||
Some(PathBuf::from("config.toml"))
|
||||
} else {
|
||||
|
@ -272,31 +298,29 @@ pub fn parse(args: &[String]) -> Flags {
|
|||
}
|
||||
});
|
||||
|
||||
let mut stage = m.opt_str("stage").map(|j| j.parse().unwrap());
|
||||
let mut stage = matches.opt_str("stage").map(|j| j.parse().unwrap());
|
||||
|
||||
let incremental = m.opt_present("i");
|
||||
|
||||
if incremental {
|
||||
if matches.opt_present("incremental") {
|
||||
if stage.is_none() {
|
||||
stage = Some(1);
|
||||
}
|
||||
}
|
||||
|
||||
Flags {
|
||||
verbose: m.opt_count("v"),
|
||||
verbose: matches.opt_count("verbose"),
|
||||
stage: stage,
|
||||
on_fail: m.opt_str("on-fail"),
|
||||
keep_stage: m.opt_str("keep-stage").map(|j| j.parse().unwrap()),
|
||||
build: m.opt_str("build").unwrap_or_else(|| {
|
||||
on_fail: matches.opt_str("on-fail"),
|
||||
keep_stage: matches.opt_str("keep-stage").map(|j| j.parse().unwrap()),
|
||||
build: matches.opt_str("build").unwrap_or_else(|| {
|
||||
env::var("BUILD").unwrap()
|
||||
}),
|
||||
host: split(m.opt_strs("host")),
|
||||
target: split(m.opt_strs("target")),
|
||||
host: split(matches.opt_strs("host")),
|
||||
target: split(matches.opt_strs("target")),
|
||||
config: cfg_file,
|
||||
src: m.opt_str("src").map(PathBuf::from),
|
||||
jobs: m.opt_str("jobs").map(|j| j.parse().unwrap()),
|
||||
src: matches.opt_str("src").map(PathBuf::from),
|
||||
jobs: matches.opt_str("jobs").map(|j| j.parse().unwrap()),
|
||||
cmd: cmd,
|
||||
incremental: incremental,
|
||||
incremental: matches.opt_present("incremental"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,12 +49,17 @@ pub fn install(build: &Build, stage: u32, host: &str) {
|
|||
install_sh(&build, "docs", "rust-docs", stage, host, &prefix,
|
||||
&docdir, &libdir, &mandir, &empty_dir);
|
||||
}
|
||||
|
||||
for target in build.config.target.iter() {
|
||||
install_sh(&build, "std", "rust-std", stage, target, &prefix,
|
||||
&docdir, &libdir, &mandir, &empty_dir);
|
||||
}
|
||||
|
||||
if build.config.rust_save_analysis {
|
||||
install_sh(&build, "analysis", "rust-analysis", stage, host, &prefix,
|
||||
&docdir, &libdir, &mandir, &empty_dir);
|
||||
}
|
||||
install_sh(&build, "std", "rust-std", stage, host, &prefix,
|
||||
&docdir, &libdir, &mandir, &empty_dir);
|
||||
|
||||
install_sh(&build, "rustc", "rustc", stage, host, &prefix,
|
||||
&docdir, &libdir, &mandir, &empty_dir);
|
||||
t!(fs::remove_dir_all(&empty_dir));
|
||||
|
|
|
@ -978,26 +978,25 @@ fn verify(&self) {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn print_help(&self, command: &str) {
|
||||
pub fn get_help(&self, command: &str) -> Option<String> {
|
||||
let kind = match command {
|
||||
"build" => Kind::Build,
|
||||
"doc" => Kind::Doc,
|
||||
"test" => Kind::Test,
|
||||
"bench" => Kind::Bench,
|
||||
"dist" => Kind::Dist,
|
||||
_ => return,
|
||||
_ => return None,
|
||||
};
|
||||
let rules = self.rules.values().filter(|r| r.kind == kind);
|
||||
let rules = rules.filter(|r| !r.path.contains("nowhere"));
|
||||
let mut rules = rules.collect::<Vec<_>>();
|
||||
rules.sort_by_key(|r| r.path);
|
||||
|
||||
println!("Available paths:\n");
|
||||
let mut help_string = String::from("Available paths:\n");
|
||||
for rule in rules {
|
||||
print!(" ./x.py {} {}", command, rule.path);
|
||||
|
||||
println!("");
|
||||
help_string.push_str(format!(" ./x.py {} {}\n", command, rule.path).as_str());
|
||||
}
|
||||
Some(help_string)
|
||||
}
|
||||
|
||||
/// Construct the top-level build steps that we're going to be executing,
|
||||
|
|
|
@ -74,7 +74,7 @@ RUN arm-linux-gnueabihf-gcc addentropy.c -o rootfs/addentropy -static
|
|||
RUN curl -O http://ftp.nl.debian.org/debian/dists/jessie/main/installer-armhf/current/images/device-tree/vexpress-v2p-ca15-tc1.dtb
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-24-sccache-x86_64-unknown-linux-musl && \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-04-04-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
|
||||
|
|
|
@ -22,7 +22,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||
pkg-config
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-24-sccache-x86_64-unknown-linux-musl && \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-04-04-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
|
||||
|
|
|
@ -56,28 +56,22 @@ RUN mkdir /x-tools && chown rustbuild:rustbuild /x-tools
|
|||
USER rustbuild
|
||||
WORKDIR /tmp
|
||||
|
||||
COPY armv7-linux-gnueabihf.config /tmp/
|
||||
COPY armv7-linux-gnueabihf.config aarch64-linux-gnu.config build-toolchains.sh /tmp/
|
||||
COPY aarch64-linux-gnu.config build-toolchains.sh /tmp/
|
||||
RUN ./build-toolchains.sh
|
||||
|
||||
USER root
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-24-sccache-x86_64-unknown-linux-musl && \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-04-04-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
ENV PATH=$PATH:/x-tools/aarch64-unknown-linux-gnueabi/bin
|
||||
ENV PATH=$PATH:/x-tools/armv7-unknown-linux-gnueabihf/bin
|
||||
|
||||
ENV CC_aarch64_unknown_linux_gnu=aarch64-unknown-linux-gnueabi-gcc \
|
||||
AR_aarch64_unknown_linux_gnu=aarch64-unknown-linux-gnueabi-ar \
|
||||
CXX_aarch64_unknown_linux_gnu=aarch64-unknown-linux-gnueabi-g++ \
|
||||
CC_armv7_unknown_linux_gnueabihf=armv7-unknown-linux-gnueabihf-gcc \
|
||||
AR_armv7_unknown_linux_gnueabihf=armv7-unknown-linux-gnueabihf-ar \
|
||||
CXX_armv7_unknown_linux_gnueabihf=armv7-unknown-linux-gnueabihf-g++
|
||||
CXX_aarch64_unknown_linux_gnu=aarch64-unknown-linux-gnueabi-g++
|
||||
|
||||
ENV HOSTS=armv7-unknown-linux-gnueabihf
|
||||
ENV HOSTS=$HOSTS,aarch64-unknown-linux-gnu
|
||||
ENV HOSTS=aarch64-unknown-linux-gnu
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --host=$HOSTS --enable-extended
|
||||
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
|
37
src/ci/docker/dist-aarch64-linux/build-toolchains.sh
Executable file
37
src/ci/docker/dist-aarch64-linux/build-toolchains.sh
Executable file
|
@ -0,0 +1,37 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
# option. This file may not be copied, modified, or distributed
|
||||
# except according to those terms.
|
||||
|
||||
set -ex
|
||||
|
||||
hide_output() {
|
||||
set +x
|
||||
on_err="
|
||||
echo ERROR: An error was encountered with the build.
|
||||
cat /tmp/build.log
|
||||
exit 1
|
||||
"
|
||||
trap "$on_err" ERR
|
||||
bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
|
||||
PING_LOOP_PID=$!
|
||||
$@ &> /tmp/build.log
|
||||
rm /tmp/build.log
|
||||
trap - ERR
|
||||
kill $PING_LOOP_PID
|
||||
set -x
|
||||
}
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
cp ../aarch64-linux-gnu.config .config
|
||||
ct-ng oldconfig
|
||||
hide_output ct-ng build
|
||||
cd ..
|
||||
rm -rf build
|
|
@ -32,7 +32,7 @@ RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-ini
|
|||
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-24-sccache-x86_64-unknown-linux-musl && \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-04-04-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
ENV TARGETS=arm-linux-androideabi
|
||||
|
|
|
@ -56,27 +56,22 @@ RUN mkdir /x-tools && chown rustbuild:rustbuild /x-tools
|
|||
USER rustbuild
|
||||
WORKDIR /tmp
|
||||
|
||||
COPY arm-linux-gnueabihf.config arm-linux-gnueabi.config build-toolchains.sh /tmp/
|
||||
COPY arm-linux-gnueabi.config build-toolchains.sh /tmp/
|
||||
RUN ./build-toolchains.sh
|
||||
|
||||
USER root
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-24-sccache-x86_64-unknown-linux-musl && \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-04-04-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
ENV PATH=$PATH:/x-tools/arm-unknown-linux-gnueabi/bin
|
||||
ENV PATH=$PATH:/x-tools/arm-unknown-linux-gnueabihf/bin
|
||||
|
||||
ENV CC_arm_unknown_linux_gnueabi=arm-unknown-linux-gnueabi-gcc \
|
||||
AR_arm_unknown_linux_gnueabi=arm-unknown-linux-gnueabi-ar \
|
||||
CXX_arm_unknown_linux_gnueabi=arm-unknown-linux-gnueabi-g++ \
|
||||
CC_arm_unknown_linux_gnueabihf=arm-unknown-linux-gnueabihf-gcc \
|
||||
AR_arm_unknown_linux_gnueabihf=arm-unknown-linux-gnueabihf-ar \
|
||||
CXX_arm_unknown_linux_gnueabihf=arm-unknown-linux-gnueabihf-g++
|
||||
CXX_arm_unknown_linux_gnueabi=arm-unknown-linux-gnueabi-g++
|
||||
|
||||
ENV HOSTS=arm-unknown-linux-gnueabi
|
||||
ENV HOSTS=$HOSTS,arm-unknown-linux-gnueabihf
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --host=$HOSTS --enable-extended
|
||||
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
|
||||
|
|
|
@ -35,11 +35,3 @@ ct-ng oldconfig
|
|||
hide_output ct-ng build
|
||||
cd ..
|
||||
rm -rf build
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
cp ../arm-linux-gnueabihf.config .config
|
||||
ct-ng oldconfig
|
||||
hide_output ct-ng build
|
||||
cd ..
|
||||
rm -rf build
|
||||
|
|
77
src/ci/docker/dist-armhf-linux/Dockerfile
Normal file
77
src/ci/docker/dist-armhf-linux/Dockerfile
Normal file
|
@ -0,0 +1,77 @@
|
|||
FROM ubuntu:16.04
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
automake \
|
||||
bison \
|
||||
bzip2 \
|
||||
ca-certificates \
|
||||
cmake \
|
||||
curl \
|
||||
file \
|
||||
flex \
|
||||
g++ \
|
||||
gawk \
|
||||
gdb \
|
||||
git \
|
||||
gperf \
|
||||
help2man \
|
||||
libncurses-dev \
|
||||
libtool-bin \
|
||||
make \
|
||||
patch \
|
||||
python2.7 \
|
||||
sudo \
|
||||
texinfo \
|
||||
wget \
|
||||
xz-utils \
|
||||
libssl-dev \
|
||||
pkg-config
|
||||
|
||||
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
|
||||
dpkg -i dumb-init_*.deb && \
|
||||
rm dumb-init_*.deb
|
||||
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
||||
|
||||
# Ubuntu 16.04 (this contianer) ships with make 4, but something in the
|
||||
# toolchains we build below chokes on that, so go back to make 3
|
||||
RUN curl https://ftp.gnu.org/gnu/make/make-3.81.tar.gz | tar xzf - && \
|
||||
cd make-3.81 && \
|
||||
./configure --prefix=/usr && \
|
||||
make && \
|
||||
make install && \
|
||||
cd .. && \
|
||||
rm -rf make-3.81
|
||||
|
||||
RUN curl http://crosstool-ng.org/download/crosstool-ng/crosstool-ng-1.22.0.tar.bz2 | \
|
||||
tar xjf - && \
|
||||
cd crosstool-ng && \
|
||||
./configure --prefix=/usr/local && \
|
||||
make -j$(nproc) && \
|
||||
make install && \
|
||||
cd .. && \
|
||||
rm -rf crosstool-ng
|
||||
|
||||
RUN groupadd -r rustbuild && useradd -m -r -g rustbuild rustbuild
|
||||
RUN mkdir /x-tools && chown rustbuild:rustbuild /x-tools
|
||||
USER rustbuild
|
||||
WORKDIR /tmp
|
||||
|
||||
COPY arm-linux-gnueabihf.config build-toolchains.sh /tmp/
|
||||
RUN ./build-toolchains.sh
|
||||
|
||||
USER root
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-04-04-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
ENV PATH=$PATH:/x-tools/arm-unknown-linux-gnueabihf/bin
|
||||
|
||||
ENV CC_arm_unknown_linux_gnueabihf=arm-unknown-linux-gnueabihf-gcc \
|
||||
AR_arm_unknown_linux_gnueabihf=arm-unknown-linux-gnueabihf-ar \
|
||||
CXX_arm_unknown_linux_gnueabihf=arm-unknown-linux-gnueabihf-g++
|
||||
|
||||
ENV HOSTS=arm-unknown-linux-gnueabihf
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --host=$HOSTS --enable-extended
|
||||
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
|
37
src/ci/docker/dist-armhf-linux/build-toolchains.sh
Executable file
37
src/ci/docker/dist-armhf-linux/build-toolchains.sh
Executable file
|
@ -0,0 +1,37 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
# option. This file may not be copied, modified, or distributed
|
||||
# except according to those terms.
|
||||
|
||||
set -ex
|
||||
|
||||
hide_output() {
|
||||
set +x
|
||||
on_err="
|
||||
echo ERROR: An error was encountered with the build.
|
||||
cat /tmp/build.log
|
||||
exit 1
|
||||
"
|
||||
trap "$on_err" ERR
|
||||
bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
|
||||
PING_LOOP_PID=$!
|
||||
$@ &> /tmp/build.log
|
||||
rm /tmp/build.log
|
||||
trap - ERR
|
||||
kill $PING_LOOP_PID
|
||||
set -x
|
||||
}
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
cp ../arm-linux-gnueabihf.config .config
|
||||
ct-ng oldconfig
|
||||
hide_output ct-ng build
|
||||
cd ..
|
||||
rm -rf build
|
77
src/ci/docker/dist-armv7-linux/Dockerfile
Normal file
77
src/ci/docker/dist-armv7-linux/Dockerfile
Normal file
|
@ -0,0 +1,77 @@
|
|||
FROM ubuntu:16.04
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
automake \
|
||||
bison \
|
||||
bzip2 \
|
||||
ca-certificates \
|
||||
cmake \
|
||||
curl \
|
||||
file \
|
||||
flex \
|
||||
g++ \
|
||||
gawk \
|
||||
gdb \
|
||||
git \
|
||||
gperf \
|
||||
help2man \
|
||||
libncurses-dev \
|
||||
libtool-bin \
|
||||
make \
|
||||
patch \
|
||||
python2.7 \
|
||||
sudo \
|
||||
texinfo \
|
||||
wget \
|
||||
xz-utils \
|
||||
libssl-dev \
|
||||
pkg-config
|
||||
|
||||
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
|
||||
dpkg -i dumb-init_*.deb && \
|
||||
rm dumb-init_*.deb
|
||||
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
||||
|
||||
# Ubuntu 16.04 (this contianer) ships with make 4, but something in the
|
||||
# toolchains we build below chokes on that, so go back to make 3
|
||||
RUN curl https://ftp.gnu.org/gnu/make/make-3.81.tar.gz | tar xzf - && \
|
||||
cd make-3.81 && \
|
||||
./configure --prefix=/usr && \
|
||||
make && \
|
||||
make install && \
|
||||
cd .. && \
|
||||
rm -rf make-3.81
|
||||
|
||||
RUN curl http://crosstool-ng.org/download/crosstool-ng/crosstool-ng-1.22.0.tar.bz2 | \
|
||||
tar xjf - && \
|
||||
cd crosstool-ng && \
|
||||
./configure --prefix=/usr/local && \
|
||||
make -j$(nproc) && \
|
||||
make install && \
|
||||
cd .. && \
|
||||
rm -rf crosstool-ng
|
||||
|
||||
RUN groupadd -r rustbuild && useradd -m -r -g rustbuild rustbuild
|
||||
RUN mkdir /x-tools && chown rustbuild:rustbuild /x-tools
|
||||
USER rustbuild
|
||||
WORKDIR /tmp
|
||||
|
||||
COPY build-toolchains.sh armv7-linux-gnueabihf.config /tmp/
|
||||
RUN ./build-toolchains.sh
|
||||
|
||||
USER root
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-04-04-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
ENV PATH=$PATH:/x-tools/armv7-unknown-linux-gnueabihf/bin
|
||||
|
||||
ENV CC_armv7_unknown_linux_gnueabihf=armv7-unknown-linux-gnueabihf-gcc \
|
||||
AR_armv7_unknown_linux_gnueabihf=armv7-unknown-linux-gnueabihf-ar \
|
||||
CXX_armv7_unknown_linux_gnueabihf=armv7-unknown-linux-gnueabihf-g++
|
||||
|
||||
ENV HOSTS=armv7-unknown-linux-gnueabihf
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --host=$HOSTS --enable-extended
|
||||
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
|
|
@ -35,11 +35,3 @@ ct-ng oldconfig
|
|||
hide_output ct-ng build
|
||||
cd ..
|
||||
rm -rf build
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
cp ../aarch64-linux-gnu.config .config
|
||||
ct-ng oldconfig
|
||||
hide_output ct-ng build
|
||||
cd ..
|
||||
rm -rf build
|
|
@ -29,7 +29,7 @@ RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-ini
|
|||
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-24-sccache-x86_64-unknown-linux-musl && \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-04-04-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
ENV \
|
||||
|
|
|
@ -26,7 +26,7 @@ RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-ini
|
|||
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-24-sccache-x86_64-unknown-linux-musl && \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-04-04-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS \
|
||||
|
|
|
@ -15,11 +15,14 @@ set -ex
|
|||
export CFLAGS="-fPIC -Wa,-mrelax-relocations=no"
|
||||
export CXXFLAGS="-Wa,-mrelax-relocations=no"
|
||||
|
||||
MUSL=musl-1.1.14
|
||||
MUSL=musl-1.1.16
|
||||
curl https://www.musl-libc.org/releases/$MUSL.tar.gz | tar xzf -
|
||||
cd $MUSL
|
||||
CFLAGS="$CFLAGS -m32" ./configure --prefix=/musl-i686 --disable-shared --target=i686
|
||||
make -j10
|
||||
CC=gcc \
|
||||
CFLAGS="$CFLAGS -m32" \
|
||||
./configure --prefix=/musl-i686 --disable-shared \
|
||||
--target=i686
|
||||
make AR=ar RANLIB=ranlib -j10
|
||||
make install
|
||||
cd ..
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||
pkg-config
|
||||
|
||||
COPY build-toolchain.sh /tmp/
|
||||
RUN /tmp/build-toolchain.sh x86_64
|
||||
RUN /tmp/build-toolchain.sh i686
|
||||
|
||||
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
|
||||
|
@ -26,19 +25,15 @@ RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-ini
|
|||
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-24-sccache-x86_64-unknown-linux-musl && \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-04-04-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
ENV \
|
||||
AR_x86_64_unknown_freebsd=x86_64-unknown-freebsd10-ar \
|
||||
CC_x86_64_unknown_freebsd=x86_64-unknown-freebsd10-gcc \
|
||||
CXX_x86_64_unknown_freebsd=x86_64-unknown-freebsd10-g++ \
|
||||
AR_i686_unknown_freebsd=i686-unknown-freebsd10-ar \
|
||||
CC_i686_unknown_freebsd=i686-unknown-freebsd10-gcc \
|
||||
CXX_i686_unknown_freebsd=i686-unknown-freebsd10-g++
|
||||
|
||||
ENV HOSTS=x86_64-unknown-freebsd
|
||||
ENV HOSTS=$HOSTS,i686-unknown-freebsd
|
||||
ENV HOSTS=i686-unknown-freebsd
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --host=$HOSTS --enable-extended
|
||||
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
|
|
@ -2,6 +2,12 @@ FROM centos:5
|
|||
|
||||
WORKDIR /build
|
||||
|
||||
# Centos 5 is EOL and is no longer available from the usual mirrors, so switch
|
||||
# to http://vault.centos.org/
|
||||
RUN sed -i 's/enabled=1/enabled=0/' /etc/yum/pluginconf.d/fastestmirror.conf
|
||||
RUN sed -i 's/mirrorlist/#mirrorlist/' /etc/yum.repos.d/*.repo
|
||||
RUN sed -i 's/#\(baseurl.*\)mirror.centos.org/\1107.158.252.35/' /etc/yum.repos.d/*.repo
|
||||
|
||||
RUN yum upgrade -y && yum install -y \
|
||||
curl \
|
||||
bzip2 \
|
||||
|
@ -76,11 +82,10 @@ RUN curl -Lo /rustroot/dumb-init \
|
|||
ENTRYPOINT ["/rustroot/dumb-init", "--"]
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-24-sccache-x86_64-unknown-linux-musl && \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-04-04-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
ENV HOSTS=i686-unknown-linux-gnu
|
||||
ENV HOSTS=$HOSTS,x86_64-unknown-linux-gnu
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS \
|
||||
--host=$HOSTS \
|
|
@ -13,12 +13,11 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||
gdb \
|
||||
xz-utils \
|
||||
g++-mips-linux-gnu \
|
||||
g++-mipsel-linux-gnu \
|
||||
libssl-dev \
|
||||
pkg-config
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-24-sccache-x86_64-unknown-linux-musl && \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-04-04-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
|
||||
|
@ -27,7 +26,6 @@ RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-ini
|
|||
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
||||
|
||||
ENV HOSTS=mips-unknown-linux-gnu
|
||||
ENV HOSTS=$HOSTS,mipsel-unknown-linux-gnu
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --host=$HOSTS --enable-extended
|
||||
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
|
||||
|
|
|
@ -13,12 +13,11 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||
gdb \
|
||||
xz-utils \
|
||||
g++-mips64-linux-gnuabi64 \
|
||||
g++-mips64el-linux-gnuabi64 \
|
||||
libssl-dev \
|
||||
pkg-config
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-24-sccache-x86_64-unknown-linux-musl && \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-04-04-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
|
||||
|
@ -27,7 +26,6 @@ RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-ini
|
|||
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
||||
|
||||
ENV HOSTS=mips64-unknown-linux-gnuabi64
|
||||
ENV HOSTS=$HOSTS,mips64el-unknown-linux-gnuabi64
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --host=$HOSTS --enable-extended
|
||||
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
|
||||
|
|
31
src/ci/docker/dist-mips64el-linux/Dockerfile
Normal file
31
src/ci/docker/dist-mips64el-linux/Dockerfile
Normal file
|
@ -0,0 +1,31 @@
|
|||
FROM ubuntu:16.04
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
g++ \
|
||||
make \
|
||||
file \
|
||||
curl \
|
||||
ca-certificates \
|
||||
python2.7 \
|
||||
git \
|
||||
cmake \
|
||||
sudo \
|
||||
gdb \
|
||||
xz-utils \
|
||||
g++-mips64el-linux-gnuabi64 \
|
||||
libssl-dev \
|
||||
pkg-config
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-04-04-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
|
||||
dpkg -i dumb-init_*.deb && \
|
||||
rm dumb-init_*.deb
|
||||
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
||||
|
||||
ENV HOSTS=mips64el-unknown-linux-gnuabi64
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --host=$HOSTS --enable-extended
|
||||
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
|
31
src/ci/docker/dist-mipsel-linux/Dockerfile
Normal file
31
src/ci/docker/dist-mipsel-linux/Dockerfile
Normal file
|
@ -0,0 +1,31 @@
|
|||
FROM ubuntu:16.04
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
g++ \
|
||||
make \
|
||||
file \
|
||||
curl \
|
||||
ca-certificates \
|
||||
python2.7 \
|
||||
git \
|
||||
cmake \
|
||||
sudo \
|
||||
gdb \
|
||||
xz-utils \
|
||||
g++-mipsel-linux-gnu \
|
||||
libssl-dev \
|
||||
pkg-config
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-04-04-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
|
||||
dpkg -i dumb-init_*.deb && \
|
||||
rm dumb-init_*.deb
|
||||
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
||||
|
||||
ENV HOSTS=mipsel-unknown-linux-gnu
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --host=$HOSTS --enable-extended
|
||||
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
|
|
@ -63,7 +63,7 @@ RUN ./build-powerpc-toolchain.sh
|
|||
USER root
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-24-sccache-x86_64-unknown-linux-musl && \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-04-04-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
ENV PATH=$PATH:/x-tools/powerpc-unknown-linux-gnu/bin
|
||||
|
|
|
@ -62,12 +62,8 @@ RUN ./build-powerpc64-toolchain.sh
|
|||
|
||||
USER root
|
||||
|
||||
RUN apt-get install -y --no-install-recommends rpm2cpio cpio
|
||||
COPY build-powerpc64le-toolchain.sh /tmp/
|
||||
RUN ./build-powerpc64le-toolchain.sh
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-24-sccache-x86_64-unknown-linux-musl && \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-04-04-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
ENV PATH=$PATH:/x-tools/powerpc64-unknown-linux-gnu/bin
|
||||
|
@ -75,13 +71,9 @@ ENV PATH=$PATH:/x-tools/powerpc64-unknown-linux-gnu/bin
|
|||
ENV \
|
||||
AR_powerpc64_unknown_linux_gnu=powerpc64-unknown-linux-gnu-ar \
|
||||
CC_powerpc64_unknown_linux_gnu=powerpc64-unknown-linux-gnu-gcc \
|
||||
CXX_powerpc64_unknown_linux_gnu=powerpc64-unknown-linux-gnu-g++ \
|
||||
AR_powerpc64le_unknown_linux_gnu=powerpc64le-linux-gnu-ar \
|
||||
CC_powerpc64le_unknown_linux_gnu=powerpc64le-linux-gnu-gcc \
|
||||
CXX_powerpc64le_unknown_linux_gnu=powerpc64le-linux-gnu-g++
|
||||
CXX_powerpc64_unknown_linux_gnu=powerpc64-unknown-linux-gnu-g++
|
||||
|
||||
ENV HOSTS=powerpc64-unknown-linux-gnu
|
||||
ENV HOSTS=$HOSTS,powerpc64le-unknown-linux-gnu
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --host=$HOSTS --enable-extended
|
||||
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
|
||||
|
|
77
src/ci/docker/dist-powerpc64le-linux/Dockerfile
Normal file
77
src/ci/docker/dist-powerpc64le-linux/Dockerfile
Normal file
|
@ -0,0 +1,77 @@
|
|||
FROM ubuntu:16.04
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
automake \
|
||||
bison \
|
||||
bzip2 \
|
||||
ca-certificates \
|
||||
cmake \
|
||||
curl \
|
||||
file \
|
||||
flex \
|
||||
g++ \
|
||||
gawk \
|
||||
gdb \
|
||||
git \
|
||||
gperf \
|
||||
help2man \
|
||||
libncurses-dev \
|
||||
libtool-bin \
|
||||
make \
|
||||
patch \
|
||||
python2.7 \
|
||||
sudo \
|
||||
texinfo \
|
||||
wget \
|
||||
xz-utils \
|
||||
libssl-dev \
|
||||
pkg-config
|
||||
|
||||
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
|
||||
dpkg -i dumb-init_*.deb && \
|
||||
rm dumb-init_*.deb
|
||||
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
||||
|
||||
# Ubuntu 16.04 (this contianer) ships with make 4, but something in the
|
||||
# toolchains we build below chokes on that, so go back to make 3
|
||||
RUN curl https://ftp.gnu.org/gnu/make/make-3.81.tar.gz | tar xzf - && \
|
||||
cd make-3.81 && \
|
||||
./configure --prefix=/usr && \
|
||||
make && \
|
||||
make install && \
|
||||
cd .. && \
|
||||
rm -rf make-3.81
|
||||
|
||||
RUN curl http://crosstool-ng.org/download/crosstool-ng/crosstool-ng-1.22.0.tar.bz2 | \
|
||||
tar xjf - && \
|
||||
cd crosstool-ng && \
|
||||
./configure --prefix=/usr/local && \
|
||||
make -j$(nproc) && \
|
||||
make install && \
|
||||
cd .. && \
|
||||
rm -rf crosstool-ng
|
||||
|
||||
RUN groupadd -r rustbuild && useradd -m -r -g rustbuild rustbuild
|
||||
RUN mkdir /x-tools && chown rustbuild:rustbuild /x-tools
|
||||
USER rustbuild
|
||||
WORKDIR /tmp
|
||||
|
||||
USER root
|
||||
|
||||
RUN apt-get install -y --no-install-recommends rpm2cpio cpio
|
||||
COPY shared.sh build-powerpc64le-toolchain.sh /tmp/
|
||||
RUN ./build-powerpc64le-toolchain.sh
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-04-04-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
ENV \
|
||||
AR_powerpc64le_unknown_linux_gnu=powerpc64le-linux-gnu-ar \
|
||||
CC_powerpc64le_unknown_linux_gnu=powerpc64le-linux-gnu-gcc \
|
||||
CXX_powerpc64le_unknown_linux_gnu=powerpc64le-linux-gnu-g++
|
||||
|
||||
ENV HOSTS=powerpc64le-unknown-linux-gnu
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --host=$HOSTS --enable-extended
|
||||
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
|
25
src/ci/docker/dist-powerpc64le-linux/shared.sh
Normal file
25
src/ci/docker/dist-powerpc64le-linux/shared.sh
Normal file
|
@ -0,0 +1,25 @@
|
|||
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
# option. This file may not be copied, modified, or distributed
|
||||
# except according to those terms.
|
||||
|
||||
hide_output() {
|
||||
set +x
|
||||
on_err="
|
||||
echo ERROR: An error was encountered with the build.
|
||||
cat /tmp/build.log
|
||||
exit 1
|
||||
"
|
||||
trap "$on_err" ERR
|
||||
bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
|
||||
PING_LOOP_PID=$!
|
||||
$@ &> /tmp/build.log
|
||||
trap - ERR
|
||||
kill $PING_LOOP_PID
|
||||
set -x
|
||||
}
|
|
@ -60,27 +60,20 @@ COPY patches/ /tmp/patches/
|
|||
COPY s390x-linux-gnu.config build-s390x-toolchain.sh /tmp/
|
||||
RUN ./build-s390x-toolchain.sh
|
||||
|
||||
COPY build-netbsd-toolchain.sh /tmp/
|
||||
RUN ./build-netbsd-toolchain.sh
|
||||
|
||||
USER root
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-24-sccache-x86_64-unknown-linux-musl && \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-04-04-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
ENV PATH=$PATH:/x-tools/s390x-ibm-linux-gnu/bin:/x-tools/x86_64-unknown-netbsd/bin
|
||||
ENV PATH=$PATH:/x-tools/s390x-ibm-linux-gnu/bin
|
||||
|
||||
ENV \
|
||||
AR_x86_64_unknown_netbsd=x86_64--netbsd-ar \
|
||||
CC_x86_64_unknown_netbsd=x86_64--netbsd-gcc-sysroot \
|
||||
CXX_x86_64_unknown_netbsd=x86_64--netbsd-g++-sysroot \
|
||||
CC_s390x_unknown_linux_gnu=s390x-ibm-linux-gnu-gcc \
|
||||
AR_s390x_unknown_linux_gnu=s390x-ibm-linux-gnu-ar \
|
||||
CXX_s390x_unknown_linux_gnu=s390x-ibm-linux-gnu-g++
|
||||
|
||||
ENV HOSTS=x86_64-unknown-netbsd
|
||||
ENV HOSTS=$HOSTS,s390x-unknown-linux-gnu
|
||||
ENV HOSTS=s390x-unknown-linux-gnu
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --host=$HOSTS --enable-extended
|
||||
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
|
39
src/ci/docker/dist-x86_64-freebsd/Dockerfile
Normal file
39
src/ci/docker/dist-x86_64-freebsd/Dockerfile
Normal file
|
@ -0,0 +1,39 @@
|
|||
FROM ubuntu:16.04
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
g++ \
|
||||
make \
|
||||
file \
|
||||
curl \
|
||||
ca-certificates \
|
||||
python2.7 \
|
||||
git \
|
||||
cmake \
|
||||
sudo \
|
||||
bzip2 \
|
||||
xz-utils \
|
||||
wget \
|
||||
libssl-dev \
|
||||
pkg-config
|
||||
|
||||
COPY build-toolchain.sh /tmp/
|
||||
RUN /tmp/build-toolchain.sh x86_64
|
||||
|
||||
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
|
||||
dpkg -i dumb-init_*.deb && \
|
||||
rm dumb-init_*.deb
|
||||
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-04-04-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
ENV \
|
||||
AR_x86_64_unknown_freebsd=x86_64-unknown-freebsd10-ar \
|
||||
CC_x86_64_unknown_freebsd=x86_64-unknown-freebsd10-gcc \
|
||||
CXX_x86_64_unknown_freebsd=x86_64-unknown-freebsd10-g++
|
||||
|
||||
ENV HOSTS=x86_64-unknown-freebsd
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --host=$HOSTS --enable-extended
|
||||
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
|
112
src/ci/docker/dist-x86_64-freebsd/build-toolchain.sh
Executable file
112
src/ci/docker/dist-x86_64-freebsd/build-toolchain.sh
Executable file
|
@ -0,0 +1,112 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2016 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
# option. This file may not be copied, modified, or distributed
|
||||
# except according to those terms.
|
||||
|
||||
set -ex
|
||||
|
||||
ARCH=$1
|
||||
BINUTILS=2.25.1
|
||||
GCC=5.3.0
|
||||
|
||||
hide_output() {
|
||||
set +x
|
||||
on_err="
|
||||
echo ERROR: An error was encountered with the build.
|
||||
cat /tmp/build.log
|
||||
exit 1
|
||||
"
|
||||
trap "$on_err" ERR
|
||||
bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
|
||||
PING_LOOP_PID=$!
|
||||
$@ &> /tmp/build.log
|
||||
trap - ERR
|
||||
kill $PING_LOOP_PID
|
||||
set -x
|
||||
}
|
||||
|
||||
mkdir binutils
|
||||
cd binutils
|
||||
|
||||
# First up, build binutils
|
||||
curl https://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS.tar.bz2 | tar xjf -
|
||||
mkdir binutils-build
|
||||
cd binutils-build
|
||||
hide_output ../binutils-$BINUTILS/configure \
|
||||
--target=$ARCH-unknown-freebsd10
|
||||
hide_output make -j10
|
||||
hide_output make install
|
||||
cd ../..
|
||||
rm -rf binutils
|
||||
|
||||
# Next, download the FreeBSD libc and relevant header files
|
||||
|
||||
mkdir freebsd
|
||||
case "$ARCH" in
|
||||
x86_64)
|
||||
URL=ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/10.2-RELEASE/base.txz
|
||||
;;
|
||||
i686)
|
||||
URL=ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/10.2-RELEASE/base.txz
|
||||
;;
|
||||
esac
|
||||
curl $URL | tar xJf - -C freebsd ./usr/include ./usr/lib ./lib
|
||||
|
||||
dst=/usr/local/$ARCH-unknown-freebsd10
|
||||
|
||||
cp -r freebsd/usr/include $dst/
|
||||
cp freebsd/usr/lib/crt1.o $dst/lib
|
||||
cp freebsd/usr/lib/Scrt1.o $dst/lib
|
||||
cp freebsd/usr/lib/crti.o $dst/lib
|
||||
cp freebsd/usr/lib/crtn.o $dst/lib
|
||||
cp freebsd/usr/lib/libc.a $dst/lib
|
||||
cp freebsd/usr/lib/libutil.a $dst/lib
|
||||
cp freebsd/usr/lib/libutil_p.a $dst/lib
|
||||
cp freebsd/usr/lib/libm.a $dst/lib
|
||||
cp freebsd/usr/lib/librt.so.1 $dst/lib
|
||||
cp freebsd/usr/lib/libexecinfo.so.1 $dst/lib
|
||||
cp freebsd/lib/libc.so.7 $dst/lib
|
||||
cp freebsd/lib/libm.so.5 $dst/lib
|
||||
cp freebsd/lib/libutil.so.9 $dst/lib
|
||||
cp freebsd/lib/libthr.so.3 $dst/lib/libpthread.so
|
||||
|
||||
ln -s libc.so.7 $dst/lib/libc.so
|
||||
ln -s libm.so.5 $dst/lib/libm.so
|
||||
ln -s librt.so.1 $dst/lib/librt.so
|
||||
ln -s libutil.so.9 $dst/lib/libutil.so
|
||||
ln -s libexecinfo.so.1 $dst/lib/libexecinfo.so
|
||||
rm -rf freebsd
|
||||
|
||||
# Finally, download and build gcc to target FreeBSD
|
||||
mkdir gcc
|
||||
cd gcc
|
||||
curl https://ftp.gnu.org/gnu/gcc/gcc-$GCC/gcc-$GCC.tar.bz2 | tar xjf -
|
||||
cd gcc-$GCC
|
||||
./contrib/download_prerequisites
|
||||
|
||||
mkdir ../gcc-build
|
||||
cd ../gcc-build
|
||||
hide_output ../gcc-$GCC/configure \
|
||||
--enable-languages=c,c++ \
|
||||
--target=$ARCH-unknown-freebsd10 \
|
||||
--disable-multilib \
|
||||
--disable-nls \
|
||||
--disable-libgomp \
|
||||
--disable-libquadmath \
|
||||
--disable-libssp \
|
||||
--disable-libvtv \
|
||||
--disable-libcilkrts \
|
||||
--disable-libada \
|
||||
--disable-libsanitizer \
|
||||
--disable-libquadmath-support \
|
||||
--disable-lto
|
||||
hide_output make -j10
|
||||
hide_output make install
|
||||
cd ../..
|
||||
rm -rf gcc
|
101
src/ci/docker/dist-x86_64-linux/Dockerfile
Normal file
101
src/ci/docker/dist-x86_64-linux/Dockerfile
Normal file
|
@ -0,0 +1,101 @@
|
|||
FROM centos:5
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
# Centos 5 is EOL and is no longer available from the usual mirrors, so switch
|
||||
# to http://vault.centos.org/
|
||||
RUN sed -i 's/enabled=1/enabled=0/' /etc/yum/pluginconf.d/fastestmirror.conf
|
||||
RUN sed -i 's/mirrorlist/#mirrorlist/' /etc/yum.repos.d/*.repo
|
||||
RUN sed -i 's/#\(baseurl.*\)mirror.centos.org/\1107.158.252.35/' /etc/yum.repos.d/*.repo
|
||||
|
||||
RUN yum upgrade -y && yum install -y \
|
||||
curl \
|
||||
bzip2 \
|
||||
gcc \
|
||||
gcc-c++ \
|
||||
make \
|
||||
glibc-devel \
|
||||
perl \
|
||||
zlib-devel \
|
||||
file \
|
||||
xz \
|
||||
which \
|
||||
pkgconfig \
|
||||
wget \
|
||||
autoconf \
|
||||
gettext
|
||||
|
||||
ENV PATH=/rustroot/bin:$PATH
|
||||
ENV LD_LIBRARY_PATH=/rustroot/lib64:/rustroot/lib
|
||||
ENV PKG_CONFIG_PATH=/rustroot/lib/pkgconfig
|
||||
WORKDIR /tmp
|
||||
COPY shared.sh build-binutils.sh /tmp/
|
||||
|
||||
# We need a build of openssl which supports SNI to download artifacts from
|
||||
# static.rust-lang.org. This'll be used to link into libcurl below (and used
|
||||
# later as well), so build a copy of OpenSSL with dynamic libraries into our
|
||||
# generic root.
|
||||
COPY build-openssl.sh /tmp/
|
||||
RUN ./build-openssl.sh
|
||||
|
||||
# The `curl` binary on CentOS doesn't support SNI which is needed for fetching
|
||||
# some https urls we have, so install a new version of libcurl + curl which is
|
||||
# using the openssl we just built previously.
|
||||
#
|
||||
# Note that we also disable a bunch of optional features of curl that we don't
|
||||
# really need.
|
||||
COPY build-curl.sh /tmp/
|
||||
RUN ./build-curl.sh
|
||||
|
||||
# binutils < 2.22 has a bug where the 32-bit executables it generates
|
||||
# immediately segfault in Rust, so we need to install our own binutils.
|
||||
#
|
||||
# See https://github.com/rust-lang/rust/issues/20440 for more info
|
||||
RUN ./build-binutils.sh
|
||||
|
||||
# Need a newer version of gcc than centos has to compile LLVM nowadays
|
||||
COPY build-gcc.sh /tmp/
|
||||
RUN ./build-gcc.sh
|
||||
|
||||
# CentOS 5.5 has Python 2.4 by default, but LLVM needs 2.7+
|
||||
COPY build-python.sh /tmp/
|
||||
RUN ./build-python.sh
|
||||
|
||||
# Apparently CentOS 5.5 desn't have `git` in yum, but we're gonna need it for
|
||||
# cloning, so download and build it here.
|
||||
COPY build-git.sh /tmp/
|
||||
RUN ./build-git.sh
|
||||
|
||||
# libssh2 (a dependency of Cargo) requires cmake 2.8.11 or higher but CentOS
|
||||
# only has 2.6.4, so build our own
|
||||
COPY build-cmake.sh /tmp/
|
||||
RUN ./build-cmake.sh
|
||||
|
||||
# for sanitizers, we need kernel headers files newer than the ones CentOS ships
|
||||
# with so we install newer ones here
|
||||
COPY build-headers.sh /tmp/
|
||||
RUN ./build-headers.sh
|
||||
|
||||
RUN curl -Lo /rustroot/dumb-init \
|
||||
https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64 && \
|
||||
chmod +x /rustroot/dumb-init
|
||||
ENTRYPOINT ["/rustroot/dumb-init", "--"]
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-04-04-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
ENV HOSTS=x86_64-unknown-linux-gnu
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS \
|
||||
--host=$HOSTS \
|
||||
--enable-extended \
|
||||
--enable-sanitizers
|
||||
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
|
||||
|
||||
# This is the only builder which will create source tarballs
|
||||
ENV DIST_SRC 1
|
||||
|
||||
# When we build cargo in this container, we don't want it to use the system
|
||||
# libcurl, instead it should compile its own.
|
||||
ENV LIBCURL_NO_PKG_CONFIG 1
|
26
src/ci/docker/dist-x86_64-linux/build-binutils.sh
Executable file
26
src/ci/docker/dist-x86_64-linux/build-binutils.sh
Executable file
|
@ -0,0 +1,26 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
# option. This file may not be copied, modified, or distributed
|
||||
# except according to those terms.
|
||||
|
||||
set -ex
|
||||
|
||||
source shared.sh
|
||||
|
||||
curl https://ftp.gnu.org/gnu/binutils/binutils-2.25.1.tar.bz2 | tar xfj -
|
||||
|
||||
mkdir binutils-build
|
||||
cd binutils-build
|
||||
hide_output ../binutils-2.25.1/configure --prefix=/rustroot
|
||||
hide_output make -j10
|
||||
hide_output make install
|
||||
|
||||
cd ..
|
||||
rm -rf binutils-build
|
||||
rm -rf binutils-2.25.1
|
25
src/ci/docker/dist-x86_64-linux/build-cmake.sh
Executable file
25
src/ci/docker/dist-x86_64-linux/build-cmake.sh
Executable file
|
@ -0,0 +1,25 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
# option. This file may not be copied, modified, or distributed
|
||||
# except according to those terms.
|
||||
|
||||
set -ex
|
||||
source shared.sh
|
||||
|
||||
curl https://cmake.org/files/v3.6/cmake-3.6.3.tar.gz | tar xzf -
|
||||
|
||||
mkdir cmake-build
|
||||
cd cmake-build
|
||||
hide_output ../cmake-3.6.3/configure --prefix=/rustroot
|
||||
hide_output make -j10
|
||||
hide_output make install
|
||||
|
||||
cd ..
|
||||
rm -rf cmake-build
|
||||
rm -rf cmake-3.6.3
|
43
src/ci/docker/dist-x86_64-linux/build-curl.sh
Executable file
43
src/ci/docker/dist-x86_64-linux/build-curl.sh
Executable file
|
@ -0,0 +1,43 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
# option. This file may not be copied, modified, or distributed
|
||||
# except according to those terms.
|
||||
|
||||
set -ex
|
||||
source shared.sh
|
||||
|
||||
VERSION=7.51.0
|
||||
|
||||
curl http://cool.haxx.se/download/curl-$VERSION.tar.bz2 | tar xjf -
|
||||
|
||||
mkdir curl-build
|
||||
cd curl-build
|
||||
hide_output ../curl-$VERSION/configure \
|
||||
--prefix=/rustroot \
|
||||
--with-ssl=/rustroot \
|
||||
--disable-sspi \
|
||||
--disable-gopher \
|
||||
--disable-smtp \
|
||||
--disable-smb \
|
||||
--disable-imap \
|
||||
--disable-pop3 \
|
||||
--disable-tftp \
|
||||
--disable-telnet \
|
||||
--disable-manual \
|
||||
--disable-dict \
|
||||
--disable-rtsp \
|
||||
--disable-ldaps \
|
||||
--disable-ldap
|
||||
hide_output make -j10
|
||||
hide_output make install
|
||||
|
||||
cd ..
|
||||
rm -rf curl-build
|
||||
rm -rf curl-$VERSION
|
||||
yum erase -y curl
|
33
src/ci/docker/dist-x86_64-linux/build-gcc.sh
Executable file
33
src/ci/docker/dist-x86_64-linux/build-gcc.sh
Executable file
|
@ -0,0 +1,33 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
# option. This file may not be copied, modified, or distributed
|
||||
# except according to those terms.
|
||||
|
||||
set -ex
|
||||
|
||||
source shared.sh
|
||||
|
||||
GCC=4.8.5
|
||||
|
||||
curl https://ftp.gnu.org/gnu/gcc/gcc-$GCC/gcc-$GCC.tar.bz2 | tar xjf -
|
||||
cd gcc-$GCC
|
||||
./contrib/download_prerequisites
|
||||
mkdir ../gcc-build
|
||||
cd ../gcc-build
|
||||
hide_output ../gcc-$GCC/configure \
|
||||
--prefix=/rustroot \
|
||||
--enable-languages=c,c++
|
||||
hide_output make -j10
|
||||
hide_output make install
|
||||
ln -nsf gcc /rustroot/bin/cc
|
||||
|
||||
cd ..
|
||||
rm -rf gcc-build
|
||||
rm -rf gcc-$GCC
|
||||
yum erase -y gcc gcc-c++ binutils
|
24
src/ci/docker/dist-x86_64-linux/build-git.sh
Executable file
24
src/ci/docker/dist-x86_64-linux/build-git.sh
Executable file
|
@ -0,0 +1,24 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
# option. This file may not be copied, modified, or distributed
|
||||
# except according to those terms.
|
||||
|
||||
set -ex
|
||||
source shared.sh
|
||||
|
||||
curl https://www.kernel.org/pub/software/scm/git/git-2.10.0.tar.gz | tar xzf -
|
||||
|
||||
cd git-2.10.0
|
||||
make configure
|
||||
hide_output ./configure --prefix=/rustroot
|
||||
hide_output make -j10
|
||||
hide_output make install
|
||||
|
||||
cd ..
|
||||
rm -rf git-2.10.0
|
25
src/ci/docker/dist-x86_64-linux/build-headers.sh
Executable file
25
src/ci/docker/dist-x86_64-linux/build-headers.sh
Executable file
|
@ -0,0 +1,25 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
# option. This file may not be copied, modified, or distributed
|
||||
# except according to those terms.
|
||||
|
||||
set -ex
|
||||
source shared.sh
|
||||
|
||||
curl https://cdn.kernel.org/pub/linux/kernel/v3.x/linux-3.2.84.tar.xz | unxz | tar x
|
||||
|
||||
cd linux-3.2.84
|
||||
hide_output make mrproper
|
||||
hide_output make INSTALL_HDR_PATH=dest headers_install
|
||||
|
||||
find dest/include \( -name .install -o -name ..install.cmd \) -delete
|
||||
yes | cp -fr dest/include/* /usr/include
|
||||
|
||||
cd ..
|
||||
rm -rf linux-3.2.84
|
27
src/ci/docker/dist-x86_64-linux/build-openssl.sh
Executable file
27
src/ci/docker/dist-x86_64-linux/build-openssl.sh
Executable file
|
@ -0,0 +1,27 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
# option. This file may not be copied, modified, or distributed
|
||||
# except according to those terms.
|
||||
|
||||
set -ex
|
||||
source shared.sh
|
||||
|
||||
VERSION=1.0.2j
|
||||
|
||||
curl https://www.openssl.org/source/openssl-$VERSION.tar.gz | tar xzf -
|
||||
|
||||
cd openssl-$VERSION
|
||||
hide_output ./config --prefix=/rustroot shared -fPIC
|
||||
hide_output make -j10
|
||||
hide_output make install
|
||||
cd ..
|
||||
rm -rf openssl-$VERSION
|
||||
|
||||
# Make the system cert collection available to the new install.
|
||||
ln -nsf /etc/pki/tls/cert.pem /rustroot/ssl/
|
30
src/ci/docker/dist-x86_64-linux/build-python.sh
Executable file
30
src/ci/docker/dist-x86_64-linux/build-python.sh
Executable file
|
@ -0,0 +1,30 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
# option. This file may not be copied, modified, or distributed
|
||||
# except according to those terms.
|
||||
|
||||
set -ex
|
||||
source shared.sh
|
||||
|
||||
curl https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tgz | \
|
||||
tar xzf -
|
||||
|
||||
mkdir python-build
|
||||
cd python-build
|
||||
|
||||
# Gotta do some hackery to tell python about our custom OpenSSL build, but other
|
||||
# than that fairly normal.
|
||||
CFLAGS='-I /rustroot/include' LDFLAGS='-L /rustroot/lib -L /rustroot/lib64' \
|
||||
hide_output ../Python-2.7.12/configure --prefix=/rustroot
|
||||
hide_output make -j10
|
||||
hide_output make install
|
||||
|
||||
cd ..
|
||||
rm -rf python-build
|
||||
rm -rf Python-2.7.12
|
25
src/ci/docker/dist-x86_64-linux/shared.sh
Normal file
25
src/ci/docker/dist-x86_64-linux/shared.sh
Normal file
|
@ -0,0 +1,25 @@
|
|||
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
# option. This file may not be copied, modified, or distributed
|
||||
# except according to those terms.
|
||||
|
||||
hide_output() {
|
||||
set +x
|
||||
on_err="
|
||||
echo ERROR: An error was encountered with the build.
|
||||
cat /tmp/build.log
|
||||
exit 1
|
||||
"
|
||||
trap "$on_err" ERR
|
||||
bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
|
||||
PING_LOOP_PID=$!
|
||||
$@ &> /tmp/build.log
|
||||
trap - ERR
|
||||
kill $PING_LOOP_PID
|
||||
set -x
|
||||
}
|
|
@ -26,7 +26,7 @@ RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-ini
|
|||
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-24-sccache-x86_64-unknown-linux-musl && \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-04-04-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS \
|
||||
|
|
|
@ -15,7 +15,7 @@ set -ex
|
|||
export CFLAGS="-fPIC -Wa,-mrelax-relocations=no"
|
||||
export CXXFLAGS="-Wa,-mrelax-relocations=no"
|
||||
|
||||
MUSL=musl-1.1.14
|
||||
MUSL=musl-1.1.16
|
||||
curl https://www.musl-libc.org/releases/$MUSL.tar.gz | tar xzf -
|
||||
cd $MUSL
|
||||
./configure --prefix=/musl-x86_64 --disable-shared
|
||||
|
|
78
src/ci/docker/dist-x86_64-netbsd/Dockerfile
Normal file
78
src/ci/docker/dist-x86_64-netbsd/Dockerfile
Normal file
|
@ -0,0 +1,78 @@
|
|||
FROM ubuntu:16.04
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
automake \
|
||||
bison \
|
||||
bzip2 \
|
||||
ca-certificates \
|
||||
cmake \
|
||||
curl \
|
||||
file \
|
||||
flex \
|
||||
g++ \
|
||||
gawk \
|
||||
gdb \
|
||||
git \
|
||||
gperf \
|
||||
help2man \
|
||||
libncurses-dev \
|
||||
libtool-bin \
|
||||
make \
|
||||
patch \
|
||||
python2.7 \
|
||||
sudo \
|
||||
texinfo \
|
||||
wget \
|
||||
xz-utils \
|
||||
libssl-dev \
|
||||
pkg-config
|
||||
|
||||
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
|
||||
dpkg -i dumb-init_*.deb && \
|
||||
rm dumb-init_*.deb
|
||||
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
||||
|
||||
# Ubuntu 16.04 (this contianer) ships with make 4, but something in the
|
||||
# toolchains we build below chokes on that, so go back to make 3
|
||||
RUN curl https://ftp.gnu.org/gnu/make/make-3.81.tar.gz | tar xzf - && \
|
||||
cd make-3.81 && \
|
||||
./configure --prefix=/usr && \
|
||||
make && \
|
||||
make install && \
|
||||
cd .. && \
|
||||
rm -rf make-3.81
|
||||
|
||||
RUN curl http://crosstool-ng.org/download/crosstool-ng/crosstool-ng-1.22.0.tar.bz2 | \
|
||||
tar xjf - && \
|
||||
cd crosstool-ng && \
|
||||
./configure --prefix=/usr/local && \
|
||||
make -j$(nproc) && \
|
||||
make install && \
|
||||
cd .. && \
|
||||
rm -rf crosstool-ng
|
||||
|
||||
RUN groupadd -r rustbuild && useradd -m -r -g rustbuild rustbuild
|
||||
RUN mkdir /x-tools && chown rustbuild:rustbuild /x-tools
|
||||
USER rustbuild
|
||||
WORKDIR /tmp
|
||||
|
||||
COPY build-netbsd-toolchain.sh /tmp/
|
||||
RUN ./build-netbsd-toolchain.sh
|
||||
|
||||
USER root
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-04-04-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
ENV PATH=$PATH:/x-tools/x86_64-unknown-netbsd/bin
|
||||
|
||||
ENV \
|
||||
AR_x86_64_unknown_netbsd=x86_64--netbsd-ar \
|
||||
CC_x86_64_unknown_netbsd=x86_64--netbsd-gcc-sysroot \
|
||||
CXX_x86_64_unknown_netbsd=x86_64--netbsd-g++-sysroot
|
||||
|
||||
ENV HOSTS=x86_64-unknown-netbsd
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --host=$HOSTS --enable-extended
|
||||
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
|
|
@ -15,7 +15,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||
lib32stdc++6
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-24-sccache-x86_64-unknown-linux-musl && \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-04-04-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
|
||||
|
|
|
@ -14,7 +14,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||
xz-utils
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-24-sccache-x86_64-unknown-linux-musl && \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-04-04-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
|
||||
|
|
|
@ -14,7 +14,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||
xz-utils
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-24-sccache-x86_64-unknown-linux-musl && \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-04-04-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
|
||||
|
|
|
@ -15,7 +15,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||
pkg-config
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-24-sccache-x86_64-unknown-linux-musl && \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-04-04-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
|
||||
|
|
|
@ -14,7 +14,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||
xz-utils
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-24-sccache-x86_64-unknown-linux-musl && \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-04-04-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
|
||||
|
|
|
@ -16,7 +16,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||
pkg-config
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-24-sccache-x86_64-unknown-linux-musl && \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-04-04-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
|
||||
|
|
|
@ -14,7 +14,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||
xz-utils
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-24-sccache-x86_64-unknown-linux-musl && \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-04-04-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
|
||||
|
|
|
@ -14,7 +14,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||
xz-utils
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-24-sccache-x86_64-unknown-linux-musl && \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-04-04-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
|
||||
|
|
|
@ -17,7 +17,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||
xz-utils
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-24-sccache-x86_64-unknown-linux-musl && \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-04-04-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
|
||||
|
|
|
@ -14,7 +14,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||
xz-utils
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-24-sccache-x86_64-unknown-linux-musl && \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-04-04-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
|
||||
|
|
|
@ -14,7 +14,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||
xz-utils
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-24-sccache-x86_64-unknown-linux-musl && \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-04-04-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
|
||||
|
|
|
@ -123,6 +123,7 @@
|
|||
- [no_debug](no-debug.md)
|
||||
- [non_ascii_idents](non-ascii-idents.md)
|
||||
- [nonzero](nonzero.md)
|
||||
- [offset_to](offset-to.md)
|
||||
- [omit_gdb_pretty_printer_section](omit-gdb-pretty-printer-section.md)
|
||||
- [on_unimplemented](on-unimplemented.md)
|
||||
- [once_poison](once-poison.md)
|
||||
|
@ -171,6 +172,7 @@
|
|||
- [slice_concat_ext](slice-concat-ext.md)
|
||||
- [slice_get_slice](slice-get-slice.md)
|
||||
- [slice_patterns](slice-patterns.md)
|
||||
- [slice_rsplit](slice-rsplit.md)
|
||||
- [sort_internals](sort-internals.md)
|
||||
- [sort_unstable](sort-unstable.md)
|
||||
- [specialization](specialization.md)
|
||||
|
@ -203,11 +205,11 @@
|
|||
- [unwind_attributes](unwind-attributes.md)
|
||||
- [update_panic_count](update-panic-count.md)
|
||||
- [use_extern_macros](use-extern-macros.md)
|
||||
- [used](used.md)
|
||||
- [utf8_error_error_len](utf8-error-error-len.md)
|
||||
- [vec_remove_item](vec-remove-item.md)
|
||||
- [windows_c](windows-c.md)
|
||||
- [windows_handle](windows-handle.md)
|
||||
- [windows_net](windows-net.md)
|
||||
- [windows_stdio](windows-stdio.md)
|
||||
- [windows_subsystem](windows-subsystem.md)
|
||||
- [zero_one](zero-one.md)
|
||||
|
|
7
src/doc/unstable-book/src/offset-to.md
Normal file
7
src/doc/unstable-book/src/offset-to.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
# `offset_to`
|
||||
|
||||
The tracking issue for this feature is: [#41079]
|
||||
|
||||
[#41079]: https://github.com/rust-lang/rust/issues/41079
|
||||
|
||||
------------------------
|
10
src/doc/unstable-book/src/slice-rsplit.md
Normal file
10
src/doc/unstable-book/src/slice-rsplit.md
Normal file
|
@ -0,0 +1,10 @@
|
|||
# `slice_rsplit`
|
||||
|
||||
The tracking issue for this feature is: [#41020]
|
||||
|
||||
[#41020]: https://github.com/rust-lang/rust/issues/41020
|
||||
|
||||
------------------------
|
||||
|
||||
The `slice_rsplit` feature enables two methods on slices:
|
||||
`slice.rsplit(predicate)` and `slice.rsplit_mut(predicate)`.
|
153
src/doc/unstable-book/src/used.md
Normal file
153
src/doc/unstable-book/src/used.md
Normal file
|
@ -0,0 +1,153 @@
|
|||
# `used`
|
||||
|
||||
The tracking issue for this feature
|
||||
is: [40289](https://github.com/rust-lang/rust/issues/40289).
|
||||
|
||||
------------------------
|
||||
|
||||
The `#[used]` attribute can be applied to `static` variables to prevent the Rust
|
||||
compiler from optimizing them away even if they appear to be unused by the crate
|
||||
(appear to be "dead code").
|
||||
|
||||
``` rust
|
||||
#![feature(used)]
|
||||
|
||||
#[used]
|
||||
static FOO: i32 = 1;
|
||||
|
||||
static BAR: i32 = 2;
|
||||
|
||||
fn main() {}
|
||||
```
|
||||
|
||||
If you compile this program into an object file, you'll see that `FOO` makes it
|
||||
to the object file but `BAR` doesn't. Neither static variable is used by the
|
||||
program.
|
||||
|
||||
``` text
|
||||
$ rustc -C opt-level=3 --emit=obj used.rs
|
||||
|
||||
$ nm -C used.o
|
||||
0000000000000000 T main
|
||||
U std::rt::lang_start
|
||||
0000000000000000 r used::FOO
|
||||
0000000000000000 t used::main
|
||||
```
|
||||
|
||||
Note that the *linker* knows nothing about the `#[used]` attribute and will
|
||||
remove `#[used]` symbols if they are not referenced by other parts of the
|
||||
program:
|
||||
|
||||
``` text
|
||||
$ rustc -C opt-level=3 used.rs
|
||||
|
||||
$ nm -C used | grep FOO
|
||||
```
|
||||
|
||||
"This doesn't sound too useful then!" you may think but keep reading.
|
||||
|
||||
To preserve the symbols all the way to the final binary, you'll need the
|
||||
cooperation of the linker. Here's one example:
|
||||
|
||||
The ELF standard defines two special sections, `.init_array` and
|
||||
`.pre_init_array`, that may contain function pointers which will be executed
|
||||
*before* the `main` function is invoked. The linker will preserve symbols placed
|
||||
in these sections (at least when linking programs that target the `*-*-linux-*`
|
||||
targets).
|
||||
|
||||
``` rust,ignore
|
||||
#![feature(used)]
|
||||
|
||||
extern "C" fn before_main() {
|
||||
println!("Hello, world!");
|
||||
}
|
||||
|
||||
#[link_section = ".init_array"]
|
||||
#[used]
|
||||
static INIT_ARRAY: [extern "C" fn(); 1] = [before_main];
|
||||
|
||||
fn main() {}
|
||||
```
|
||||
|
||||
So, `#[used]` and `#[link_section]` can be combined to obtain "life before
|
||||
main".
|
||||
|
||||
``` text
|
||||
$ rustc -C opt-level=3 before-main.rs
|
||||
|
||||
$ ./before-main
|
||||
Hello, world!
|
||||
```
|
||||
|
||||
Another example: ARM Cortex-M microcontrollers need their reset handler, a
|
||||
pointer to the function that will executed right after the microcontroller is
|
||||
turned on, to be placed near the start of their FLASH memory to boot properly.
|
||||
|
||||
This condition can be met using `#[used]` and `#[link_section]` plus a linker
|
||||
script.
|
||||
|
||||
``` rust,ignore
|
||||
#![feature(lang_items)]
|
||||
#![feature(used)]
|
||||
#![no_main]
|
||||
#![no_std]
|
||||
|
||||
extern "C" fn reset_handler() -> ! {
|
||||
loop {}
|
||||
}
|
||||
|
||||
#[link_section = ".reset_handler"]
|
||||
#[used]
|
||||
static RESET_HANDLER: extern "C" fn() -> ! = reset_handler;
|
||||
|
||||
#[lang = "panic_fmt"]
|
||||
fn panic_fmt() {}
|
||||
```
|
||||
|
||||
``` text
|
||||
MEMORY
|
||||
{
|
||||
FLASH : ORIGIN = 0x08000000, LENGTH = 128K
|
||||
RAM : ORIGIN = 0x20000000, LENGTH = 20K
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.text ORIGIN(FLASH) :
|
||||
{
|
||||
/* Vector table */
|
||||
LONG(ORIGIN(RAM) + LENGTH(RAM)); /* initial SP value */
|
||||
KEEP(*(.reset_handler));
|
||||
|
||||
/* Omitted: The rest of the vector table */
|
||||
|
||||
*(.text.*);
|
||||
} > FLASH
|
||||
|
||||
/DISCARD/ :
|
||||
{
|
||||
/* Unused unwinding stuff */
|
||||
*(.ARM.exidx.*)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
``` text
|
||||
$ xargo rustc --target thumbv7m-none-eabi --release -- \
|
||||
-C link-arg=-Tlink.x -C link-arg=-nostartfiles
|
||||
|
||||
$ arm-none-eabi-objdump -Cd target/thumbv7m-none-eabi/release/app
|
||||
./target/thumbv7m-none-eabi/release/app: file format elf32-littlearm
|
||||
|
||||
|
||||
Disassembly of section .text:
|
||||
|
||||
08000000 <app::RESET_HANDLER-0x4>:
|
||||
8000000: 20005000 .word 0x20005000
|
||||
|
||||
08000004 <app::RESET_HANDLER>:
|
||||
8000004: 08000009 ....
|
||||
|
||||
08000008 <app::reset_handler>:
|
||||
8000008: e7fe b.n 8000008 <app::reset_handler>
|
||||
```
|
|
@ -1,10 +0,0 @@
|
|||
# `windows_subsystem`
|
||||
|
||||
The tracking issue for this feature is: [#37499]
|
||||
|
||||
[#37499]: https://github.com/rust-lang/rust/issues/37499
|
||||
|
||||
------------------------
|
||||
|
||||
|
||||
|
|
@ -76,6 +76,66 @@ def get_codepoints(f):
|
|||
for c in range(prev_codepoint + 1, NUM_CODEPOINTS):
|
||||
yield Codepoint(c, None)
|
||||
|
||||
def compress_singletons(singletons):
|
||||
uppers = [] # (upper, # items in lowers)
|
||||
lowers = []
|
||||
|
||||
for i in singletons:
|
||||
upper = i >> 8
|
||||
lower = i & 0xff
|
||||
if len(uppers) == 0 or uppers[-1][0] != upper:
|
||||
uppers.append((upper, 1))
|
||||
else:
|
||||
upper, count = uppers[-1]
|
||||
uppers[-1] = upper, count + 1
|
||||
lowers.append(lower)
|
||||
|
||||
return uppers, lowers
|
||||
|
||||
def compress_normal(normal):
|
||||
# lengths 0x00..0x7f are encoded as 00, 01, ..., 7e, 7f
|
||||
# lengths 0x80..0x7fff are encoded as 80 80, 80 81, ..., ff fe, ff ff
|
||||
compressed = [] # [truelen, (truelenaux), falselen, (falselenaux)]
|
||||
|
||||
prev_start = 0
|
||||
for start, count in normal:
|
||||
truelen = start - prev_start
|
||||
falselen = count
|
||||
prev_start = start + count
|
||||
|
||||
assert truelen < 0x8000 and falselen < 0x8000
|
||||
entry = []
|
||||
if truelen > 0x7f:
|
||||
entry.append(0x80 | (truelen >> 8))
|
||||
entry.append(truelen & 0xff)
|
||||
else:
|
||||
entry.append(truelen & 0x7f)
|
||||
if falselen > 0x7f:
|
||||
entry.append(0x80 | (falselen >> 8))
|
||||
entry.append(falselen & 0xff)
|
||||
else:
|
||||
entry.append(falselen & 0x7f)
|
||||
|
||||
compressed.append(entry)
|
||||
|
||||
return compressed
|
||||
|
||||
def print_singletons(uppers, lowers, uppersname, lowersname):
|
||||
print("const {}: &'static [(u8, u8)] = &[".format(uppersname))
|
||||
for u, c in uppers:
|
||||
print(" ({:#04x}, {}),".format(u, c))
|
||||
print("];")
|
||||
print("const {}: &'static [u8] = &[".format(lowersname))
|
||||
for i in range(0, len(lowers), 8):
|
||||
print(" {}".format(" ".join("{:#04x},".format(l) for l in lowers[i:i+8])))
|
||||
print("];")
|
||||
|
||||
def print_normal(normal, normalname):
|
||||
print("const {}: &'static [u8] = &[".format(normalname))
|
||||
for v in normal:
|
||||
print(" {}".format(" ".join("{:#04x},".format(i) for i in v)))
|
||||
print("];")
|
||||
|
||||
def main():
|
||||
file = get_file("http://www.unicode.org/Public/UNIDATA/UnicodeData.txt")
|
||||
|
||||
|
@ -111,6 +171,11 @@ def main():
|
|||
else:
|
||||
normal0.append((a, b - a))
|
||||
|
||||
singletons0u, singletons0l = compress_singletons(singletons0)
|
||||
singletons1u, singletons1l = compress_singletons(singletons1)
|
||||
normal0 = compress_normal(normal0)
|
||||
normal1 = compress_normal(normal1)
|
||||
|
||||
print("""\
|
||||
// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
|
@ -125,38 +190,49 @@ def main():
|
|||
// NOTE: The following code was generated by "src/etc/char_private.py",
|
||||
// do not edit directly!
|
||||
|
||||
use slice::SliceExt;
|
||||
|
||||
fn check(x: u16, singletons: &[u16], normal: &[u16]) -> bool {
|
||||
for &s in singletons {
|
||||
if x == s {
|
||||
return false;
|
||||
} else if x < s {
|
||||
break;
|
||||
}
|
||||
}
|
||||
for w in normal.chunks(2) {
|
||||
let start = w[0];
|
||||
let len = w[1];
|
||||
let difference = (x as i32) - (start as i32);
|
||||
if 0 <= difference {
|
||||
if difference < len as i32 {
|
||||
return false;
|
||||
fn check(x: u16, singletonuppers: &[(u8, u8)], singletonlowers: &[u8],
|
||||
normal: &[u8]) -> bool {
|
||||
let xupper = (x >> 8) as u8;
|
||||
let mut lowerstart = 0;
|
||||
for &(upper, lowercount) in singletonuppers {
|
||||
let lowerend = lowerstart + lowercount as usize;
|
||||
if xupper == upper {
|
||||
for &lower in &singletonlowers[lowerstart..lowerend] {
|
||||
if lower == x as u8 {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
} else if xupper < upper {
|
||||
break;
|
||||
}
|
||||
lowerstart = lowerend;
|
||||
}
|
||||
true
|
||||
|
||||
let mut x = x as i32;
|
||||
let mut normal = normal.iter().cloned();
|
||||
let mut current = true;
|
||||
while let Some(v) = normal.next() {
|
||||
let len = if v & 0x80 != 0 {
|
||||
((v & 0x7f) as i32) << 8 | normal.next().unwrap() as i32
|
||||
} else {
|
||||
v as i32
|
||||
};
|
||||
x -= len;
|
||||
if x < 0 {
|
||||
break;
|
||||
}
|
||||
current = !current;
|
||||
}
|
||||
current
|
||||
}
|
||||
|
||||
pub fn is_printable(x: char) -> bool {
|
||||
let x = x as u32;
|
||||
let lower = x as u16;
|
||||
if x < 0x10000 {
|
||||
check(lower, SINGLETONS0, NORMAL0)
|
||||
check(lower, SINGLETONS0U, SINGLETONS0L, NORMAL0)
|
||||
} else if x < 0x20000 {
|
||||
check(lower, SINGLETONS1, NORMAL1)
|
||||
check(lower, SINGLETONS1U, SINGLETONS1L, NORMAL1)
|
||||
} else {\
|
||||
""")
|
||||
for a, b in extra:
|
||||
|
@ -169,22 +245,10 @@ pub fn is_printable(x: char) -> bool {
|
|||
}\
|
||||
""")
|
||||
print()
|
||||
print("const SINGLETONS0: &'static [u16] = &[")
|
||||
for s in singletons0:
|
||||
print(" 0x{:x},".format(s))
|
||||
print("];")
|
||||
print("const SINGLETONS1: &'static [u16] = &[")
|
||||
for s in singletons1:
|
||||
print(" 0x{:x},".format(s))
|
||||
print("];")
|
||||
print("const NORMAL0: &'static [u16] = &[")
|
||||
for a, b in normal0:
|
||||
print(" 0x{:x}, 0x{:x},".format(a, b))
|
||||
print("];")
|
||||
print("const NORMAL1: &'static [u16] = &[")
|
||||
for a, b in normal1:
|
||||
print(" 0x{:x}, 0x{:x},".format(a, b))
|
||||
print("];")
|
||||
print_singletons(singletons0u, singletons0l, 'SINGLETONS0U', 'SINGLETONS0L')
|
||||
print_singletons(singletons1u, singletons1l, 'SINGLETONS1U', 'SINGLETONS1L')
|
||||
print_normal(normal0, 'NORMAL0')
|
||||
print_normal(normal1, 'NORMAL1')
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -51,7 +51,7 @@ def make_win_dist(rust_root, plat_root, target_triple):
|
|||
|
||||
target_tools = ["gcc.exe", "ld.exe", "ar.exe", "dlltool.exe"]
|
||||
|
||||
rustc_dlls = ["libstdc++-6.dll"]
|
||||
rustc_dlls = ["libstdc++-6.dll", "libwinpthread-1.dll"]
|
||||
if target_triple.startswith("i686-"):
|
||||
rustc_dlls.append("libgcc_s_dw2-1.dll")
|
||||
else:
|
||||
|
@ -67,6 +67,7 @@ def make_win_dist(rust_root, plat_root, target_triple):
|
|||
"libstdc++.a",
|
||||
"libiconv.a",
|
||||
"libmoldname.a",
|
||||
"libpthread.a",
|
||||
# Windows import libs
|
||||
"libadvapi32.a",
|
||||
"libbcrypt.a",
|
||||
|
|
|
@ -13,8 +13,8 @@ core = { path = "../libcore" }
|
|||
std_unicode = { path = "../libstd_unicode" }
|
||||
|
||||
[[test]]
|
||||
name = "collectionstest"
|
||||
path = "../libcollectionstest/lib.rs"
|
||||
name = "collectionstests"
|
||||
path = "../libcollections/tests/lib.rs"
|
||||
|
||||
[[bench]]
|
||||
name = "collectionsbenches"
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
#![feature(shared)]
|
||||
#![feature(slice_get_slice)]
|
||||
#![feature(slice_patterns)]
|
||||
#![feature(slice_rsplit)]
|
||||
#![cfg_attr(not(test), feature(sort_unstable))]
|
||||
#![feature(specialization)]
|
||||
#![feature(staged_api)]
|
||||
|
@ -62,6 +63,7 @@
|
|||
#![feature(untagged_unions)]
|
||||
#![cfg_attr(not(test), feature(str_checked_slicing))]
|
||||
#![cfg_attr(test, feature(rand, test))]
|
||||
#![feature(offset_to)]
|
||||
|
||||
#![no_std]
|
||||
|
||||
|
|
|
@ -697,8 +697,8 @@ pub fn split_off(&mut self, at: usize) -> LinkedList<T> {
|
|||
|
||||
/// Returns a place for insertion at the front of the list.
|
||||
///
|
||||
/// Using this method with placement syntax is equivalent to [`push_front`]
|
||||
/// (#method.push_front), but may be more efficient.
|
||||
/// Using this method with placement syntax is equivalent to
|
||||
/// [`push_front`](#method.push_front), but may be more efficient.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
|
|
|
@ -115,6 +115,8 @@
|
|||
pub use core::slice::{SplitMut, ChunksMut, Split};
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use core::slice::{SplitN, RSplitN, SplitNMut, RSplitNMut};
|
||||
#[unstable(feature = "slice_rsplit", issue = "41020")]
|
||||
pub use core::slice::{RSplit, RSplitMut};
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use core::slice::{from_raw_parts, from_raw_parts_mut};
|
||||
#[unstable(feature = "slice_get_slice", issue = "35729")]
|
||||
|
@ -779,6 +781,72 @@ pub fn split_mut<F>(&mut self, pred: F) -> SplitMut<T, F>
|
|||
core_slice::SliceExt::split_mut(self, pred)
|
||||
}
|
||||
|
||||
/// Returns an iterator over subslices separated by elements that match
|
||||
/// `pred`, starting at the end of the slice and working backwards.
|
||||
/// The matched element is not contained in the subslices.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(slice_rsplit)]
|
||||
///
|
||||
/// let slice = [11, 22, 33, 0, 44, 55];
|
||||
/// let mut iter = slice.rsplit(|num| *num == 0);
|
||||
///
|
||||
/// assert_eq!(iter.next().unwrap(), &[44, 55]);
|
||||
/// assert_eq!(iter.next().unwrap(), &[11, 22, 33]);
|
||||
/// assert_eq!(iter.next(), None);
|
||||
/// ```
|
||||
///
|
||||
/// As with `split()`, if the first or last element is matched, an empty
|
||||
/// slice will be the first (or last) item returned by the iterator.
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(slice_rsplit)]
|
||||
///
|
||||
/// let v = &[0, 1, 1, 2, 3, 5, 8];
|
||||
/// let mut it = v.rsplit(|n| *n % 2 == 0);
|
||||
/// assert_eq!(it.next().unwrap(), &[]);
|
||||
/// assert_eq!(it.next().unwrap(), &[3, 5]);
|
||||
/// assert_eq!(it.next().unwrap(), &[1, 1]);
|
||||
/// assert_eq!(it.next().unwrap(), &[]);
|
||||
/// assert_eq!(it.next(), None);
|
||||
/// ```
|
||||
#[unstable(feature = "slice_rsplit", issue = "41020")]
|
||||
#[inline]
|
||||
pub fn rsplit<F>(&self, pred: F) -> RSplit<T, F>
|
||||
where F: FnMut(&T) -> bool
|
||||
{
|
||||
core_slice::SliceExt::rsplit(self, pred)
|
||||
}
|
||||
|
||||
/// Returns an iterator over mutable subslices separated by elements that
|
||||
/// match `pred`, starting at the end of the slice and working
|
||||
/// backwards. The matched element is not contained in the subslices.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(slice_rsplit)]
|
||||
///
|
||||
/// let mut v = [100, 400, 300, 200, 600, 500];
|
||||
///
|
||||
/// let mut count = 0;
|
||||
/// for group in v.rsplit_mut(|num| *num % 3 == 0) {
|
||||
/// count += 1;
|
||||
/// group[0] = count;
|
||||
/// }
|
||||
/// assert_eq!(v, [3, 400, 300, 2, 600, 1]);
|
||||
/// ```
|
||||
///
|
||||
#[unstable(feature = "slice_rsplit", issue = "41020")]
|
||||
#[inline]
|
||||
pub fn rsplit_mut<F>(&mut self, pred: F) -> RSplitMut<T, F>
|
||||
where F: FnMut(&T) -> bool
|
||||
{
|
||||
core_slice::SliceExt::rsplit_mut(self, pred)
|
||||
}
|
||||
|
||||
/// Returns an iterator over subslices separated by elements that match
|
||||
/// `pred`, limited to returning at most `n` items. The matched element is
|
||||
/// not contained in the subslices.
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue