Skip to content

Commit 06d173a

Browse files
committed
Add AppVeyor configuration to the repo
We hope to move to AppVeyor in the near future off of Buildbot + EC2. This adds an `appveyor.yml` configuration file which is ready to run builds on the auto branch. This is also accompanied with a few minor fixes to the build system and such to accomodate AppVeyor. The intention is that we're not switching over to AppVeyor entirely just yet, but rather we'll watch the builds for a week or so. If everything checks out then we'll start gating on AppVeyor instead of Buildbot!
1 parent a8d189a commit 06d173a

File tree

9 files changed

+164
-32
lines changed

9 files changed

+164
-32
lines changed

appveyor.yml

+110
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
environment:
2+
matrix:
3+
# 32/64 bit MSVC
4+
- MSYS_BITS: 64
5+
TARGET: x86_64-pc-windows-msvc
6+
CHECK: check
7+
CONFIGURE_ARGS: --enable-llvm-assertions --enable-debug-assertions
8+
- MSYS_BITS: 32
9+
TARGET: i686-pc-windows-msvc
10+
CHECK: check
11+
CONFIGURE_ARGS: --enable-llvm-assertions --enable-debug-assertions
12+
13+
# MSVC rustbuild
14+
- MSYS_BITS: 64
15+
CONFIGURE_ARGS: --enable-rustbuild --enable-llvm-assertions --enable-debug-assertions
16+
TARGET: x86_64-pc-windows-msvc
17+
CHECK: check
18+
19+
# MSVC cargotest
20+
- MSYS_BITS: 64
21+
CONFIGURE_ARGS: --enable-rustbuild --enable-llvm-assertions --enable-debug-assertions
22+
TARGET: x86_64-pc-windows-msvc
23+
CHECK: check-cargotest
24+
25+
# 32/64-bit MinGW builds.
26+
#
27+
# The MinGW builds unfortunately have to both download a custom toolchain and
28+
# avoid the one installed by AppVeyor by default. Interestingly, though, for
29+
# different reasons!
30+
#
31+
# For 32-bit the installed gcc toolchain on AppVeyor uses the pthread
32+
# threading model. This is unfortunately not what we want, and if we compile
33+
# with it then there's lots of link errors in the standard library (undefined
34+
# references to pthread symbols).
35+
#
36+
# For 64-bit the installed gcc toolchain is currently 5.3.0 which
37+
# unfortunately segfaults on Windows with --enable-llvm-assertions (segfaults
38+
# in LLVM). See rust-lang/rust#28445 for more information, but to work around
39+
# this we go back in time to 4.9.2 specifically.
40+
#
41+
# Finally, note that the downloads below are all in the `rust-lang-ci` S3
42+
# bucket, but they cleraly didn't originate there! The downloads originally
43+
# came from the mingw-w64 SourceForge download site. Unfortunately
44+
# SourceForge is notoriously flaky, so we mirror it on our own infrastructure.
45+
#
46+
# And as a final point of note, the 32-bit MinGW build using the makefiles do
47+
# *not* use debug assertions and llvm assertions. This is because they take
48+
# too long on appveyor and this is tested by rustbuild below.
49+
- MSYS_BITS: 32
50+
TARGET: i686-pc-windows-gnu
51+
CHECK: check
52+
MINGW_URL: https://s3.amazonaws.com/rust-lang-ci
53+
MINGW_ARCHIVE: i686-4.9.2-release-win32-dwarf-rt_v4-rev4.7z
54+
MINGW_DIR: mingw32
55+
56+
- MSYS_BITS: 32
57+
CONFIGURE_ARGS: --enable-rustbuild --enable-llvm-assertions --enable-debug-assertions
58+
TARGET: i686-pc-windows-gnu
59+
CHECK: check
60+
MINGW_URL: https://s3.amazonaws.com/rust-lang-ci
61+
MINGW_ARCHIVE: i686-4.9.2-release-win32-dwarf-rt_v4-rev4.7z
62+
MINGW_DIR: mingw32
63+
64+
- MSYS_BITS: 64
65+
CONFIGURE_ARGS: --enable-llvm-assertions --enable-debug-assertions
66+
TARGET: x86_64-pc-windows-gnu
67+
CHECK: check
68+
MINGW_URL: https://s3.amazonaws.com/rust-lang-ci
69+
MINGW_ARCHIVE: x86_64-4.9.2-release-win32-seh-rt_v4-rev4.7z
70+
MINGW_DIR: mingw64
71+
72+
clone_depth: 1
73+
build: false
74+
75+
install:
76+
# If we need to download a custom MinGW, do so here and set the path
77+
# appropriately.
78+
#
79+
# Note that this *also* means that we're not using what is typically
80+
# /mingw32/bin/python2.7.exe, which is a "correct" python interpreter where
81+
# /usr/bin/python2.7.exe is not. To ensure we use the right interpreter we
82+
# move `C:\Python27` ahead in PATH and then also make sure the `python2.7.exe`
83+
# file exists in there (which it doesn't by default).
84+
- if defined MINGW_URL appveyor DownloadFile %MINGW_URL%/%MINGW_ARCHIVE%
85+
- if defined MINGW_URL 7z x -y %MINGW_ARCHIVE% > nul
86+
- if defined MINGW_URL set PATH=C:\Python27;%CD%\%MINGW_DIR%\bin;C:\msys64\usr\bin;%PATH%
87+
- if defined MINGW_URL copy C:\Python27\python.exe C:\Python27\python2.7.exe
88+
89+
# Otherwise pull in the MinGW installed on appveyor
90+
- if NOT defined MINGW_URL set PATH=C:\msys64\mingw%MSYS_BITS%\bin;C:\msys64\usr\bin;%PATH%
91+
92+
test_script:
93+
- sh ./configure
94+
%CONFIGURE_ARGS%
95+
--build=%TARGET%
96+
- bash -c "make -j$(nproc)"
97+
- bash -c "make %CHECK% -j$(nproc)"
98+
99+
cache:
100+
- build/%TARGET%/llvm -> src/rustllvm/llvm-auto-clean-trigger
101+
- "%TARGET%/llvm -> src/rustllvm/llvm-auto-clean-trigger"
102+
103+
branches:
104+
only:
105+
- auto
106+
107+
# init:
108+
# - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
109+
# on_finish:
110+
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

mk/llvm.mk

+13-19
Original file line numberDiff line numberDiff line change
@@ -36,22 +36,27 @@ endif
3636
# If CFG_LLVM_ROOT is defined then we don't build LLVM ourselves
3737
ifeq ($(CFG_LLVM_ROOT),)
3838

39-
LLVM_STAMP_$(1) = $$(CFG_LLVM_BUILD_DIR_$(1))/llvm-auto-clean-stamp
39+
LLVM_STAMP_$(1) = $(S)src/rustllvm/llvm-auto-clean-trigger
4040
LLVM_DONE_$(1) = $$(CFG_LLVM_BUILD_DIR_$(1))/llvm-finished-building
4141

4242
$$(LLVM_CONFIG_$(1)): $$(LLVM_DONE_$(1))
4343

44-
$$(LLVM_DONE_$(1)): $$(LLVM_DEPS_TARGET_$(1)) $$(LLVM_STAMP_$(1))
45-
@$$(call E, cmake: llvm)
4644
ifneq ($$(CFG_NINJA),)
47-
$$(Q)$$(CFG_NINJA) -C $$(CFG_LLVM_BUILD_DIR_$(1))
45+
BUILD_LLVM_$(1) := $$(CFG_NINJA) -C $$(CFG_LLVM_BUILD_DIR_$(1))
4846
else ifeq ($$(findstring msvc,$(1)),msvc)
49-
$$(Q)$$(CFG_CMAKE) --build $$(CFG_LLVM_BUILD_DIR_$(1)) \
50-
--config $$(LLVM_BUILD_CONFIG_MODE)
47+
BUILD_LLVM_$(1) := $$(CFG_CMAKE) --build $$(CFG_LLVM_BUILD_DIR_$(1)) \
48+
--config $$(LLVM_BUILD_CONFIG_MODE)
5149
else
52-
$$(Q)$$(MAKE) -C $$(CFG_LLVM_BUILD_DIR_$(1))
50+
BUILD_LLVM_$(1) := $$(MAKE) -C $$(CFG_LLVM_BUILD_DIR_$(1))
5351
endif
54-
$$(Q)touch $$@
52+
53+
$$(LLVM_DONE_$(1)): $$(LLVM_DEPS_TARGET_$(1)) $$(LLVM_STAMP_$(1))
54+
@$$(call E, cmake: llvm)
55+
$$(Q)if ! cmp $$(LLVM_STAMP_$(1)) $$(LLVM_DONE_$(1)); then \
56+
$$(MAKE) clean-llvm$(1); \
57+
$$(BUILD_LLVM_$(1)); \
58+
fi
59+
$$(Q)cp $$(LLVM_STAMP_$(1)) $$@
5560

5661
ifneq ($$(CFG_NINJA),)
5762
clean-llvm$(1):
@@ -75,17 +80,6 @@ endif
7580

7681
$$(LLVM_AR_$(1)): $$(LLVM_CONFIG_$(1))
7782

78-
# This is used to independently force an LLVM clean rebuild
79-
# when we changed something not otherwise captured by builtin
80-
# dependencies. In these cases, commit a change that touches
81-
# the stamp in the source dir.
82-
$$(LLVM_STAMP_$(1)): $$(S)src/rustllvm/llvm-auto-clean-trigger
83-
@$$(call E, make: cleaning llvm)
84-
$$(Q)touch $$@.start_time
85-
$$(Q)$$(MAKE) clean-llvm$(1)
86-
@$$(call E, make: done cleaning llvm)
87-
touch -r $$@.start_time $$@ && rm $$@.start_time
88-
8983
ifeq ($$(CFG_ENABLE_LLVM_STATIC_STDCPP),1)
9084
LLVM_STDCPP_RUSTFLAGS_$(1) = -L "$$(dir $$(shell $$(CC_$(1)) $$(CFG_GCCISH_CFLAGS_$(1)) \
9185
-print-file-name=lib$(CFG_STDCPP_NAME).a))"

src/bootstrap/config.rs

+2
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ struct Build {
120120
rustc: Option<String>,
121121
compiler_docs: Option<bool>,
122122
docs: Option<bool>,
123+
submodules: Option<bool>,
123124
}
124125

125126
/// TOML representation of how the LLVM build is configured.
@@ -225,6 +226,7 @@ impl Config {
225226
config.cargo = build.cargo.map(PathBuf::from);
226227
set(&mut config.compiler_docs, build.compiler_docs);
227228
set(&mut config.docs, build.docs);
229+
set(&mut config.submodules, build.submodules);
228230

229231
if let Some(ref llvm) = toml.llvm {
230232
set(&mut config.ccache, llvm.ccache);

src/bootstrap/config.toml.example

+3
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@
7676
# library and facade crates.
7777
#compiler-docs = false
7878

79+
# Indicate whether submodules are managed and updated automatically.
80+
#submodules = true
81+
7982
# =============================================================================
8083
# Options for compiling Rust code itself
8184
# =============================================================================

src/bootstrap/native.rs

+16-9
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@
1818
//! LLVM and compiler-rt are essentially just wired up to everything else to
1919
//! ensure that they're always in place if needed.
2020
21+
use std::fs::{self, File};
22+
use std::io::{Read, Write};
2123
use std::path::Path;
2224
use std::process::Command;
23-
use std::fs::{self, File};
2425

2526
use build_helper::output;
2627
use cmake;
@@ -43,11 +44,17 @@ pub fn llvm(build: &Build, target: &str) {
4344
// artifacts are missing) then we keep going, otherwise we bail out.
4445
let dst = build.llvm_out(target);
4546
let stamp = build.src.join("src/rustllvm/llvm-auto-clean-trigger");
47+
let mut stamp_contents = String::new();
48+
t!(t!(File::open(&stamp)).read_to_string(&mut stamp_contents));
4649
let done_stamp = dst.join("llvm-finished-building");
47-
build.clear_if_dirty(&dst, &stamp);
48-
if fs::metadata(&done_stamp).is_ok() {
49-
return
50+
if done_stamp.exists() {
51+
let mut done_contents = String::new();
52+
t!(t!(File::open(&done_stamp)).read_to_string(&mut done_contents));
53+
if done_contents == stamp_contents {
54+
return
55+
}
5056
}
57+
drop(fs::remove_dir_all(&dst));
5158

5259
println!("Building LLVM for {}", target);
5360

@@ -73,7 +80,9 @@ pub fn llvm(build: &Build, target: &str) {
7380
.define("WITH_POLLY", "OFF")
7481
.define("LLVM_ENABLE_TERMINFO", "OFF")
7582
.define("LLVM_ENABLE_LIBEDIT", "OFF")
76-
.define("LLVM_PARALLEL_COMPILE_JOBS", build.jobs().to_string());
83+
.define("LLVM_PARALLEL_COMPILE_JOBS", build.jobs().to_string())
84+
.define("LLVM_TARGET_ARCH", target.split('-').next().unwrap())
85+
.define("LLVM_DEFAULT_TARGET_TRIPLE", target);
7786

7887
if target.starts_with("i686") {
7988
cfg.define("LLVM_BUILD_32_BITS", "ON");
@@ -86,9 +95,7 @@ pub fn llvm(build: &Build, target: &str) {
8695
// actually exists most of the time in normal installs of LLVM.
8796
let host = build.llvm_out(&build.config.build).join("bin/llvm-tblgen");
8897
cfg.define("CMAKE_CROSSCOMPILING", "True")
89-
.define("LLVM_TARGET_ARCH", target.split('-').next().unwrap())
90-
.define("LLVM_TABLEGEN", &host)
91-
.define("LLVM_DEFAULT_TARGET_TRIPLE", target);
98+
.define("LLVM_TABLEGEN", &host);
9299
}
93100

94101
// MSVC handles compiler business itself
@@ -114,7 +121,7 @@ pub fn llvm(build: &Build, target: &str) {
114121
// tools and libs on all platforms.
115122
cfg.build();
116123

117-
t!(File::create(&done_stamp));
124+
t!(t!(File::create(&done_stamp)).write_all(stamp_contents.as_bytes()));
118125
}
119126

120127
fn check_llvm_version(build: &Build, llvm_config: &Path) {

src/rustllvm/llvm-auto-clean-trigger

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# If this file is modified, then llvm will be forcibly cleaned and then rebuilt.
22
# The actual contents of this file do not matter, but to trigger a change on the
33
# build bots then the contents should be changed so git updates the mtime.
4-
2016-10-10
4+
2016-10-10b

src/test/run-make/tools.mk

-3
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@ RLIB_GLOB = lib$(1)*.rlib
2222
BIN = $(1)
2323

2424
UNAME = $(shell uname)
25-
ifneq (,$(findstring MINGW,$(UNAME)))
26-
IS_WINDOWS=1
27-
endif
2825

2926
ifeq ($(UNAME),Darwin)
3027
RUN = $(TARGET_RPATH_ENV) $(RUN_BINFILE)

src/tools/cargotest/main.rs

+14
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,20 @@ const TEST_REPOS: &'static [Test] = &[Test {
3636

3737

3838
fn main() {
39+
// One of the projects being tested here is Cargo, and when being tested
40+
// Cargo will at some point call `nmake.exe` on Windows MSVC. Unfortunately
41+
// `nmake` will read these two environment variables below and try to
42+
// intepret them. We're likely being run, however, from MSYS `make` which
43+
// uses the same variables.
44+
//
45+
// As a result, to prevent confusion and errors, we remove these variables
46+
// from our environment to prevent passing MSYS make flags to nmake, causing
47+
// it to blow up.
48+
if cfg!(target_env = "msvc") {
49+
env::remove_var("MAKE");
50+
env::remove_var("MAKEFLAGS");
51+
}
52+
3953
let args = env::args().collect::<Vec<_>>();
4054
let ref cargo = args[1];
4155
let out_dir = Path::new(&args[2]);

src/tools/compiletest/src/runtest.rs

+5
Original file line numberDiff line numberDiff line change
@@ -2105,12 +2105,17 @@ actual:\n\
21052105
.collect::<Vec<_>>().join(" ");
21062106

21072107
cmd.env("IS_MSVC", "1")
2108+
.env("IS_WINDOWS", "1")
21082109
.env("MSVC_LIB", format!("'{}' -nologo", lib.display()))
21092110
.env("CC", format!("'{}' {}", self.config.cc, cflags))
21102111
.env("CXX", &self.config.cxx);
21112112
} else {
21122113
cmd.env("CC", format!("{} {}", self.config.cc, self.config.cflags))
21132114
.env("CXX", format!("{} {}", self.config.cxx, self.config.cflags));
2115+
2116+
if self.config.target.contains("windows") {
2117+
cmd.env("IS_WINDOWS", "1");
2118+
}
21142119
}
21152120

21162121
let output = cmd.output().expect("failed to spawn `make`");

0 commit comments

Comments
 (0)