From b2fd9181ee5cafff5d29be91d25e2f6a544a23a9 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 21 Nov 2016 12:36:30 -0800 Subject: [PATCH 1/6] Link OpenSSL statically on OSX Now that Cargo requires OpenSSL >= 1.0.1 transitively through the `openssl-sys` 0.9 release the dynamic libraries for OpenSSL are no longer located on OSX by default. This means that the support necessary for libssh2 needs to be statically linked rather than dynamically linked. Closes #3303 --- Makefile.in | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Makefile.in b/Makefile.in index 2af0c33e3b4..c36156da8ea 100644 --- a/Makefile.in +++ b/Makefile.in @@ -232,6 +232,12 @@ OPENSSL_CFLAGS_i686-unknown-linux-gnu := -m32 OPENSSL_CFLAGS_i686-unknown-linux-musl := -m32 define BUILD_OPENSSL + +ifdef CFG_ENABLE_NIGHTLY +cargo-$(1): export OPENSSL_STATIC := 1 +test-unit-$(1): export OPENSSL_STATIC := 1 +endif + ifdef OPENSSL_OS_$(1) ifdef CFG_ENABLE_NIGHTLY OPENSSL_INSTALL_$(1) := $$(CFG_BUILD_DIR)/target/openssl/$(1)-install @@ -250,9 +256,7 @@ target/openssl/$(1).stamp: target/openssl/openssl-$$(OPENSSL_VERS).tar.gz \ touch $$@ # variables read by various build scripts to find openssl -cargo-$(1): export OPENSSL_STATIC := 1 cargo-$(1): export OPENSSL_DIR := $$(OPENSSL_INSTALL_$(1)) -test-unit-$(1): export OPENSSL_STATIC := 1 test-unit-$(1): export OPENSSL_DIR := $$(OPENSSL_INSTALL_$(1)) # build libz statically into the cargo we're producing From b30ccec0bfb81e9dea610c1df230b80533ef21b9 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 22 Nov 2016 21:37:26 -0800 Subject: [PATCH 2/6] Really fix OSX nightlies After #3311 we're now correctly trying to link OpenSSL statically on OSX. Unfortunately though this is failing to complete on the builders. Turns out the way we install OpenSSL through Homebrew create "universal archives" which is essentially an archive with both i686 and x86_64 object files, but separated. The linker takes care of this just fine but rustc currently chokes on it, unable to include the library statically into the compiler. To work around this we prepare our own mini install of OpenSSL by copying relevant bits into a local directory (like we do on Linux). As part of this we use the `lipo` tool, which is used to manage these fat archives, to disassemble the archive and only extract the relevant architecture. This should make a pre-installation step which both extracts the information and configures Cargo to use it. This should also fix the errors we're seeing on Travis I believe. --- Makefile.in | 40 +++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/Makefile.in b/Makefile.in index c36156da8ea..6b7bcd1de51 100644 --- a/Makefile.in +++ b/Makefile.in @@ -231,17 +231,20 @@ SETARCH_i686-unknown-linux-gnu := setarch i386 OPENSSL_CFLAGS_i686-unknown-linux-gnu := -m32 OPENSSL_CFLAGS_i686-unknown-linux-musl := -m32 +LIPO_FAMILY_i686-apple-darwin := i386 +LIPO_FAMILY_x86_64-apple-darwin := x86_64 + define BUILD_OPENSSL ifdef CFG_ENABLE_NIGHTLY + cargo-$(1): export OPENSSL_STATIC := 1 test-unit-$(1): export OPENSSL_STATIC := 1 -endif -ifdef OPENSSL_OS_$(1) -ifdef CFG_ENABLE_NIGHTLY OPENSSL_INSTALL_$(1) := $$(CFG_BUILD_DIR)/target/openssl/$(1)-install +ifdef OPENSSL_OS_$(1) + target/openssl/$(1).stamp: target/openssl/openssl-$$(OPENSSL_VERS).tar.gz \ | target/openssl/ mkdir -p target/openssl/$(1) @@ -261,12 +264,39 @@ test-unit-$(1): export OPENSSL_DIR := $$(OPENSSL_INSTALL_$(1)) # build libz statically into the cargo we're producing cargo-$(1): export LIBZ_SYS_STATIC := 1 -else + +else ifdef LIPO_FAMILY_$(1) + target/openssl/$(1).stamp: + @echo installing from `brew --prefix openssl` + @rm -rf $$(OPENSSL_INSTALL_$(1)) + mkdir -p $$(OPENSSL_INSTALL_$(1))/lib + cp -r `brew --prefix openssl`/include $$(OPENSSL_INSTALL_$(1))/include + cp -r `brew --prefix openssl`/lib/pkgconfig $$(OPENSSL_INSTALL_$(1))/lib/pkgconfig + lipo -output $$(OPENSSL_INSTALL_$(1))/lib/libssl.a \ + -extract_family $$(LIPO_FAMILY_$(1)) \ + `brew --prefix openssl`/lib/libssl.a || \ + cp `brew --prefix openssl`/lib/libssl.a \ + $$(OPENSSL_INSTALL_$(1))/lib/libssl.a + lipo -output $$(OPENSSL_INSTALL_$(1))/lib/libcrypto.a \ + -extract_family $$(LIPO_FAMILY_$(1)) \ + `brew --prefix openssl`/lib/libcrypto.a || \ + cp `brew --prefix openssl`/lib/libcrypto.a \ + $$(OPENSSL_INSTALL_$(1))/lib/libcrypto.a + touch $$@ + +cargo-$(1): export OPENSSL_DIR := $$(OPENSSL_INSTALL_$(1)) +test-unit-$(1): export OPENSSL_DIR := $$(OPENSSL_INSTALL_$(1)) + +else # !OPENSSL_OS_$(1) && !OSX +target/openssl/$(1).stamp: + endif -else + +else # !CFG_ENABLE_NIGHTLY target/openssl/$(1).stamp: endif + endef $(foreach target,$(CFG_TARGET),$(eval $(call BUILD_OPENSSL,$(target)))) From 1b3a8cae052c871f6a93ff02ae3da433c474886e Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 24 Nov 2016 09:58:46 -0800 Subject: [PATCH 3/6] Make a freshness test less flaky We can't rely on frobbing mtimes, need to actually just wait a whole second. --- tests/freshness.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/freshness.rs b/tests/freshness.rs index e3e059eb7b0..f04fff5e8e5 100644 --- a/tests/freshness.rs +++ b/tests/freshness.rs @@ -201,16 +201,15 @@ fn rebuild_tests_if_lib_changes() { "#); p.build(); - p.root().move_into_the_past(); - assert_that(p.cargo("build"), execs().with_status(0)); assert_that(p.cargo("test"), execs().with_status(0)); + sleep_ms(1000); File::create(&p.root().join("src/lib.rs")).unwrap(); - assert_that(p.cargo("build"), + assert_that(p.cargo("build").arg("-v"), execs().with_status(0)); assert_that(p.cargo("test").arg("-v"), execs().with_status(101)); From cc5f2298d73077e0de0d3ec017b4d956a82e5b14 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sat, 26 Nov 2016 14:37:27 -0800 Subject: [PATCH 4/6] Compile OpenSSL from source on OSX I'm seeing a bunch of weird illegal instructions on OSX nightlies for Cargo. My guess is that they're all related to OpenSSL linking. Right now we're linking from Homebrew but I have a sneaking suspicion that it compiles with `-march=native` rather than what we'd like as a portable binary. To work around this compile OpenSSL ourselves and link it that way. Note that I believe this won't bring in the certificate trust store of OpenSSL on OSX (or at least not the right one from the keychain). We shouldn't need that, however, as OpenSSL is just used as the cryptographic primitives in libssh2 and Cargo itself. So in that sense we shouldn't need it for actually SSL at all. --- .travis.yml | 1 - Makefile.in | 48 ++++++++++++++++++------------------------------ 2 files changed, 18 insertions(+), 31 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9046991de40..eb7b08655d1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,7 +29,6 @@ matrix: MACOSX_DEPLOYMENT_TARGET=10.7 CFG_DISABLE_CROSS_TESTS=1 os: osx - install: brew uninstall openssl && brew install openssl --universal --without-test # stable musl target, tested - env: TARGET=x86_64-unknown-linux-musl diff --git a/Makefile.in b/Makefile.in index 6b7bcd1de51..d165a24ee2b 100644 --- a/Makefile.in +++ b/Makefile.in @@ -172,17 +172,19 @@ OPENSSL_OS_aarch64-unknown-linux-gnu := linux-aarch64 OPENSSL_OS_arm-unknown-linux-gnueabi := linux-armv4 OPENSSL_OS_arm-unknown-linux-gnueabihf := linux-armv4 OPENSSL_OS_armv7-unknown-linux-gnueabihf := linux-armv4 +OPENSSL_OS_i686-apple-darwin := darwin-i386-cc OPENSSL_OS_i686-unknown-freebsd := BSD-x86-elf OPENSSL_OS_i686-unknown-linux-gnu := linux-elf OPENSSL_OS_i686-unknown-linux-musl := linux-elf OPENSSL_OS_mips-unknown-linux-gnu := linux-mips32 -OPENSSL_OS_mipsel-unknown-linux-gnu := linux-mips32 OPENSSL_OS_mips64-unknown-linux-gnuabi64 := linux64-mips64 OPENSSL_OS_mips64el-unknown-linux-gnuabi64 := linux64-mips64 +OPENSSL_OS_mipsel-unknown-linux-gnu := linux-mips32 OPENSSL_OS_powerpc-unknown-linux-gnu := linux-ppc OPENSSL_OS_powerpc64-unknown-linux-gnu := linux-ppc64 OPENSSL_OS_powerpc64le-unknown-linux-gnu := linux-ppc64le OPENSSL_OS_s390x-unknown-linux-gnu := linux64-s390x +OPENSSL_OS_x86_64-apple-darwin := darwin64-x86_64-cc OPENSSL_OS_x86_64-unknown-freebsd := BSD-x86_64 OPENSSL_OS_x86_64-unknown-linux-gnu := linux-x86_64 OPENSSL_OS_x86_64-unknown-linux-musl := linux-x86_64 @@ -192,6 +194,7 @@ OPENSSL_AR_aarch64-unknown-linux-gnu := aarch64-linux-gnu-ar OPENSSL_AR_arm-unknown-linux-gnueabi := arm-linux-gnueabi-ar OPENSSL_AR_arm-unknown-linux-gnueabihf := arm-linux-gnueabihf-ar OPENSSL_AR_armv7-unknown-linux-gnueabihf := armv7-linux-gnueabihf-ar +OPENSSL_AR_i686-apple-darwin := ar OPENSSL_AR_i686-unknown-freebsd := i686-unknown-freebsd10-ar OPENSSL_AR_i686-unknown-linux-gnu := ar OPENSSL_AR_i686-unknown-linux-musl := ar @@ -203,6 +206,7 @@ OPENSSL_AR_powerpc-unknown-linux-gnu := powerpc-linux-gnu-ar OPENSSL_AR_powerpc64-unknown-linux-gnu := powerpc64-linux-gnu-ar OPENSSL_AR_powerpc64le-unknown-linux-gnu := powerpc64le-linux-gnu-ar OPENSSL_AR_s390x-unknown-linux-gnu := s390x-linux-gnu-ar +OPENSSL_AR_x86_64-apple-darwin := ar OPENSSL_AR_x86_64-unknown-freebsd := x86_64-unknown-freebsd10-ar OPENSSL_AR_x86_64-unknown-linux-gnu := ar OPENSSL_AR_x86_64-unknown-linux-musl := ar @@ -211,6 +215,7 @@ OPENSSL_CC_aarch64-unknown-linux-gnu := aarch64-linux-gnu-gcc OPENSSL_CC_arm-unknown-linux-gnueabi := arm-linux-gnueabi-gcc OPENSSL_CC_arm-unknown-linux-gnueabihf := arm-linux-gnueabihf-gcc OPENSSL_CC_armv7-unknown-linux-gnueabihf := armv7-linux-gnueabihf-gcc +OPENSSL_CC_i686-apple-darwin := clang OPENSSL_CC_i686-unknown-freebsd := i686-unknown-freebsd10-gcc OPENSSL_CC_i686-unknown-linux-gnu := gcc OPENSSL_CC_i686-unknown-linux-musl := musl-gcc @@ -222,18 +227,17 @@ OPENSSL_CC_powerpc-unknown-linux-gnu := powerpc-linux-gnu-gcc OPENSSL_CC_powerpc64-unknown-linux-gnu := powerpc64-linux-gnu-gcc-5 OPENSSL_CC_powerpc64le-unknown-linux-gnu := powerpc64le-linux-gnu-gcc OPENSSL_CC_s390x-unknown-linux-gnu := s390x-linux-gnu-gcc +OPENSSL_CC_x86_64-apple-darwin := clang OPENSSL_CC_x86_64-unknown-freebsd := x86_64-unknown-freebsd10-gcc OPENSSL_CC_x86_64-unknown-linux-gnu := gcc OPENSSL_CC_x86_64-unknown-linux-musl := musl-gcc OPENSSL_CC_x86_64-unknown-netbsd := x86_64-unknown-netbsd-gcc SETARCH_i686-unknown-linux-gnu := setarch i386 +OPENSSL_CFLAGS_i686-apple-darwin := -m32 OPENSSL_CFLAGS_i686-unknown-linux-gnu := -m32 OPENSSL_CFLAGS_i686-unknown-linux-musl := -m32 -LIPO_FAMILY_i686-apple-darwin := i386 -LIPO_FAMILY_x86_64-apple-darwin := x86_64 - define BUILD_OPENSSL ifdef CFG_ENABLE_NIGHTLY @@ -265,30 +269,7 @@ test-unit-$(1): export OPENSSL_DIR := $$(OPENSSL_INSTALL_$(1)) # build libz statically into the cargo we're producing cargo-$(1): export LIBZ_SYS_STATIC := 1 -else ifdef LIPO_FAMILY_$(1) - -target/openssl/$(1).stamp: - @echo installing from `brew --prefix openssl` - @rm -rf $$(OPENSSL_INSTALL_$(1)) - mkdir -p $$(OPENSSL_INSTALL_$(1))/lib - cp -r `brew --prefix openssl`/include $$(OPENSSL_INSTALL_$(1))/include - cp -r `brew --prefix openssl`/lib/pkgconfig $$(OPENSSL_INSTALL_$(1))/lib/pkgconfig - lipo -output $$(OPENSSL_INSTALL_$(1))/lib/libssl.a \ - -extract_family $$(LIPO_FAMILY_$(1)) \ - `brew --prefix openssl`/lib/libssl.a || \ - cp `brew --prefix openssl`/lib/libssl.a \ - $$(OPENSSL_INSTALL_$(1))/lib/libssl.a - lipo -output $$(OPENSSL_INSTALL_$(1))/lib/libcrypto.a \ - -extract_family $$(LIPO_FAMILY_$(1)) \ - `brew --prefix openssl`/lib/libcrypto.a || \ - cp `brew --prefix openssl`/lib/libcrypto.a \ - $$(OPENSSL_INSTALL_$(1))/lib/libcrypto.a - touch $$@ - -cargo-$(1): export OPENSSL_DIR := $$(OPENSSL_INSTALL_$(1)) -test-unit-$(1): export OPENSSL_DIR := $$(OPENSSL_INSTALL_$(1)) - -else # !OPENSSL_OS_$(1) && !OSX +else # !OPENSSL_OS_$(1) target/openssl/$(1).stamp: endif @@ -301,10 +282,17 @@ endef $(foreach target,$(CFG_TARGET),$(eval $(call BUILD_OPENSSL,$(target)))) +ifeq ($(shell uname),Darwin) +SHASUM := shasum -a 256 +else +SHASUM := sha256sum +endif + target/openssl/openssl-$(OPENSSL_VERS).tar.gz: | target/openssl/ - curl -o $(@) https://www.openssl.org/source/openssl-$(OPENSSL_VERS).tar.gz - sha256sum $(@) > $(@).sha256 + curl -o $(@).tmp https://www.openssl.org/source/openssl-$(OPENSSL_VERS).tar.gz + $(SHASUM) $(@).tmp > $(@).sha256 test $(OPENSSL_SHA256) = `cut -d ' ' -f 1 $(@).sha256` + mv $(@).tmp $(@) target/openssl/: mkdir -p $(@) From e61f78c091da7bd54153abe5670a282228fa21c4 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 29 Nov 2016 06:36:31 -0800 Subject: [PATCH 5/6] Add support for release branches in Cargo Follow the same strategy as the compiler for now in basically every respect: * Add new `--release-channel` configure option, defaulting to `dev` * Remove old `--enable-nightly` * Add `--enable-build-openssl` as an orthogonal option * Hook up Travis/AppVeyor to stable/beta/master branches to do the right channel builds. --- .travis.yml | 12 +++++---- Makefile.in | 23 ++++++++++------ appveyor.yml | 7 ++--- configure | 49 +++++++--------------------------- src/ci/docker/cross/Dockerfile | 16 +++++++++++ src/ci/docker/run.sh | 1 + src/ci/run.sh | 20 +++++++++++++- 7 files changed, 71 insertions(+), 57 deletions(-) diff --git a/.travis.yml b/.travis.yml index eb7b08655d1..961c8488c99 100644 --- a/.travis.yml +++ b/.travis.yml @@ -57,13 +57,13 @@ matrix: IMAGE=cross - env: TARGET=mips64-unknown-linux-gnuabi64 IMAGE=cross - rust: nightly + rust: beta - env: TARGET=mips64el-unknown-linux-gnuabi64 IMAGE=cross - rust: nightly + rust: beta - env: TARGET=s390x-unknown-linux-gnu IMAGE=cross - rust: nightly + rust: beta - env: TARGET=powerpc-unknown-linux-gnu IMAGE=cross rust: beta @@ -86,7 +86,7 @@ matrix: IMAGE=dist MAKE_TARGETS="test distcheck doc install uninstall" DEPLOY=0 - rust: nightly + rust: nightly-2016-11-26 exclude: - rust: stable @@ -125,10 +125,12 @@ branches: only: - master - auto-cargo + - beta + - stable before_deploy: - mkdir -p deploy/$TRAVIS_COMMIT - - cp target/$TARGET/release/dist/cargo-nightly-$TARGET.tar.gz + - cp target/$TARGET/release/dist/cargo-*-$TARGET.tar.gz deploy/$TRAVIS_COMMIT deploy: diff --git a/Makefile.in b/Makefile.in index d165a24ee2b..80be401d83e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -8,13 +8,20 @@ include config.mk export PATH := $(dir $(CFG_RUSTC)):$(PATH) -ifdef CFG_ENABLE_NIGHTLY -CFG_RELEASE=$(CFG_RELEASE_NUM)$(CFG_RELEASE_LABEL)-nightly -CFG_PACKAGE_VERS = nightly -else -CFG_RELEASE=$(CFG_RELEASE_NUM)$(CFG_RELEASE_LABEL) -CFG_PACKAGE_VERS=$(CFG_RELEASE) +ifeq ($(CFG_RELEASE_CHANNEL),stable) +CFG_RELEASE=$(CFG_RELEASE_NUM) +CFG_PACKAGE_VERS=$(CFG_RELEASE_NUM) +else ifeq ($(CFG_RELEASE_CHANNEL),beta) +CFG_RELEASE=$(CFG_RELEASE_NUM)-beta$(CFG_PRERELEASE_VERSION) +CFG_PACKAGE_VERS=beta +else ifeq ($(CFG_RELEASE_CHANNEL),nightly) +CFG_RELEASE=$(CFG_RELEASE_NUM)-nightly +CFG_PACKAGE_VERS=nightly +else ifeq ($(CFG_RELEASE_CHANNEL),dev) +CFG_RELEASE=$(CFG_RELEASE_NUM)-dev +CFG_PACKAGE_VERS=$(CFG_RELEASE_NUM)-dev endif + CFG_BUILD_DATE = $(shell date +%F) ifeq ($(wildcard .git),) @@ -240,7 +247,7 @@ OPENSSL_CFLAGS_i686-unknown-linux-musl := -m32 define BUILD_OPENSSL -ifdef CFG_ENABLE_NIGHTLY +ifdef CFG_ENABLE_BUILD_OPENSSL cargo-$(1): export OPENSSL_STATIC := 1 test-unit-$(1): export OPENSSL_STATIC := 1 @@ -274,7 +281,7 @@ target/openssl/$(1).stamp: endif -else # !CFG_ENABLE_NIGHTLY +else # !CFG_ENABLE_BUILD_OPENSSL target/openssl/$(1).stamp: endif diff --git a/appveyor.yml b/appveyor.yml index 7187fc0d5eb..905b35b9c32 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -49,16 +49,17 @@ cache: after_test: - mkdir %APPVEYOR_REPO_COMMIT% - - copy target\%TARGET%\release\dist\cargo-nightly-%TARGET%.tar.gz - %APPVEYOR_REPO_COMMIT% + - ps: Get-ChildItem -Path target\${env:TARGET}\release\dist -Filter '*.tar.gz' | Move-Item -Destination ${env:APPVEYOR_REPO_COMMIT} branches: only: - master - auto-cargo + - beta + - stable artifacts: - - path: $(APPVEYOR_REPO_COMMIT)\cargo-nightly-$(TARGET).tar.gz + - path: $(APPVEYOR_REPO_COMMIT)\cargo-*-$(TARGET).tar.gz name: cargo deploy: diff --git a/configure b/configure index 1ead582545e..55e9bb0dbb5 100755 --- a/configure +++ b/configure @@ -300,10 +300,10 @@ VAL_OPTIONS="" opt debug 1 "build with extra debug fun" opt optimize 1 "build with optimizations" -opt nightly 0 "build nightly packages" opt verify-install 1 "verify installed binaries work" opt option-checking 1 "complain about unrecognized options in this configure script" opt cross-tests 1 "run cross-compilation tests" +opt build-openssl 0 "compile OpenSSL at build time to link to" valopt prefix "/usr/local" "set installation prefix" valopt local-rust-root "" "set prefix for local rust binary" @@ -336,6 +336,14 @@ valopt docdir "${CFG_PREFIX}/share/doc/cargo" "install extra docs" valopt mandir "${CFG_PREFIX}/share/man" "install man pages in PATH" valopt libdir "${CFG_PREFIX}/lib" "install libraries" +if [ -e ${CFG_SRC_DIR}.git ] +then + valopt release-channel "dev" "the name of the release channel to build" +else + msg "git: no git directory. Changing default release channel to stable" + valopt release-channel "stable" "the name of the release channel to build" +fi + if [ $HELP -eq 1 ] then echo @@ -385,45 +393,6 @@ if [ "$CFG_SRC_DIR" != "$CFG_BUILD_DIR" ]; then putvar CFG_CUSTOM_BUILD_DIR fi -if [ ! -z "$CFG_ENABLE_NIGHTLY" ]; then - need_cmd curl - if [ ! -f .cargo/config ]; then - mkdir -p .cargo - cat > .cargo/config <<-EOF -[target.arm-unknown-linux-gnueabi] -linker = "arm-linux-gnueabi-gcc" -[target.arm-unknown-linux-gnueabihf] -linker = "arm-linux-gnueabihf-gcc" -[target.armv7-unknown-linux-gnueabihf] -linker = "armv7-linux-gnueabihf-gcc" -[target.aarch64-unknown-linux-gnu] -linker = "aarch64-linux-gnu-gcc" -[target.i686-unknown-freebsd] -linker = "i686-unknown-freebsd10-gcc" -[target.x86_64-unknown-freebsd] -linker = "x86_64-unknown-freebsd10-gcc" -[target.x86_64-unknown-netbsd] -linker = "x86_64-unknown-netbsd-gcc" -[target.powerpc-unknown-linux-gnu] -linker = "powerpc-linux-gnu-gcc" -[target.powerpc64-unknown-linux-gnu] -linker = "powerpc64-linux-gnu-gcc-5" -[target.powerpc64le-unknown-linux-gnu] -linker = "powerpc64le-linux-gnu-gcc" -[target.mips-unknown-linux-gnu] -linker = "mips-linux-gnu-gcc" -[target.mipsel-unknown-linux-gnu] -linker = "mipsel-linux-gnu-gcc" -[target.mips64el-unknown-linux-gnuabi64] -linker = "mips64el-linux-gnuabi64-gcc" -[target.mips64-unknown-linux-gnuabi64] -linker = "mips64-linux-gnuabi64-gcc" -[target.s390x-unknown-linux-gnu] -linker = "s390x-linux-gnu-gcc" -EOF - fi -fi - step_msg "writing configuration" putvar CFG_SRC_DIR diff --git a/src/ci/docker/cross/Dockerfile b/src/ci/docker/cross/Dockerfile index e0a9840e05c..eb4818fed95 100644 --- a/src/ci/docker/cross/Dockerfile +++ b/src/ci/docker/cross/Dockerfile @@ -1,2 +1,18 @@ FROM alexcrichton/rust-slave-linux-cross:2016-10-11c ENTRYPOINT [] + +ENV CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABI_LINKER=arm-linux-gnueabi-gcc \ + CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc \ + CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=armv7-linux-gnueabihf-gcc \ + CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc \ + CARGO_TARGET_I686_UNKNOWN_FREEBSD_LINKER=i686-unknown-freebsd10-gcc \ + CARGO_TARGET_X86_64_UNKNOWN_FREEBSD_LINKER=x86_64-unknown-freebsd10-gcc \ + CARGO_TARGET_X86_64_UNKNOWN_NETBSD_LINKER=x86_64-unknown-netbsd-gcc \ + CARGO_TARGET_MIPS_UNKNOWN_LINUX_GNU_LINKER=mips-linux-gnu-gcc \ + CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_GNU_LINKER=mipsel-linux-gnu-gcc \ + CARGO_TARGET_MIPS64_UNKNOWN_LINUX_GNUABI64_LINKER=mips64-linux-gnuabi64-gcc \ + CARGO_TARGET_MIPS64EL_UNKNOWN_LINUX_GNUABI64_LINKER=mips64el-linux-gnuabi64-gcc \ + CARGO_TARGET_POWERPC_UNKNOWN_LINUX_GNU_LINKER=powerpc-linux-gnu-gcc \ + CARGO_TARGET_POWERPC64_UNKNOWN_LINUX_GNU_LINKER=powerpc64-linux-gnu-gcc-5 \ + CARGO_TARGET_POWERPC64LE_UNKNOWN_LINUX_GNU_LINKER=powerpc64le-linux-gnu-gcc \ + CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_LINKER=s390x-linux-gnu-gcc diff --git a/src/ci/docker/run.sh b/src/ci/docker/run.sh index a8f71fab1e7..1a0bb0c21c7 100755 --- a/src/ci/docker/run.sh +++ b/src/ci/docker/run.sh @@ -36,6 +36,7 @@ exec docker run \ --env MAKE_TARGETS="$MAKE_TARGETS" \ --env SRC=/checkout \ --env CARGO_HOME=/cargo \ + --env TRAVIS_BRANCH=$TRAVIS_BRANCH \ --volume "$HOME/.cargo:/cargo" \ --volume `rustc --print sysroot`:/rust:ro \ --volume `pwd`/target:/tmp/target \ diff --git a/src/ci/run.sh b/src/ci/run.sh index 456c3f8b2b1..a532757d9f3 100755 --- a/src/ci/run.sh +++ b/src/ci/run.sh @@ -17,10 +17,28 @@ if [ -z "$SRC" ]; then SRC=. fi +BRANCH=$TRAVIS_BRANCH +if [ "$BRANCH" = "" ]; then + BRANCH=$APPVEYOR_BRANCH +fi + +if [ "$BRANCH" = "stable" ]; then + CHANNEL=stable +elif [ "$BRANCH" = "beta" ]; then + CHANNEL=beta +elif [ "$BRANCH" = "master" ]; then + CHANNEL=nightly +elif [ "$BRANCH" = "auto-cargo" ]; then + CHANNEL=nightly +else + CHANNEL=dev +fi + $SRC/configure \ --prefix=/tmp/obj/install \ --target=$TARGET \ - --enable-nightly + --release-channel=$CHANNEL \ + --enable-build-openssl make cargo-$TARGET make dist-$TARGET From 6eb113aa3090e18342ead3261121259d8f6ffa59 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 30 Nov 2016 11:12:49 -0800 Subject: [PATCH 6/6] Slight tweaks to CI * Pass `--quiet` to all tests to have some quieter output * Skip builds on branches other than `auto-cargo` as it's already checked * Check the right env var for repo branches on appveyor * Only run a few builds on PRs --- .travis.yml | 25 +++++++++++++------------ Makefile.in | 3 ++- appveyor.yml | 20 ++++++++------------ src/ci/docker/run.sh | 3 +++ src/ci/run.sh | 15 ++++++++++++++- 5 files changed, 40 insertions(+), 26 deletions(-) diff --git a/.travis.yml b/.travis.yml index 961c8488c99..51e50435f8b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,9 @@ os: linux services: - docker +git: + depth: 1 + matrix: include: # stable linux builds, tested @@ -13,6 +16,7 @@ matrix: ALT=i686-unknown-linux-gnu IMAGE=dist MAKE_TARGETS="test distcheck doc install uninstall" + ALLOW_PR=1 - env: TARGET=i686-unknown-linux-gnu IMAGE=dist MAKE_TARGETS=test-unit-i686-unknown-linux-gnu @@ -99,11 +103,15 @@ before_script: sh -s -- --add-target=$ALT --disable-sudo -y --prefix=`rustc --print sysroot`; fi script: - - if [ "$TRAVIS_OS_NAME" = "osx" ]; then - SRC=. src/ci/run.sh $TARGET; - else - src/ci/docker/run.sh $IMAGE $TARGET; - fi + - > + if [ "$ALLOW_PR" = "" ] && [ "$TRAVIS_BRANCH" != "auto-cargo" ]; then + echo skipping, not a full build; + elif [ "$TRAVIS_OS_NAME" = "osx" ]; then + SRC=. src/ci/run.sh $TARGET; + else + src/ci/docker/run.sh $IMAGE $TARGET; + fi + after_success: | [ $TRAVIS_BRANCH = master ] && [ $TRAVIS_PULL_REQUEST = false ] && @@ -121,13 +129,6 @@ notifications: email: on_success: never -branches: - only: - - master - - auto-cargo - - beta - - stable - before_deploy: - mkdir -p deploy/$TRAVIS_COMMIT - cp target/$TARGET/release/dist/cargo-*-$TARGET.tar.gz diff --git a/Makefile.in b/Makefile.in index 80be401d83e..12d6afaa078 100644 --- a/Makefile.in +++ b/Makefile.in @@ -103,7 +103,8 @@ test-unit-$(1): target/openssl/$(1).stamp cargo-$(1) @mkdir -p $$(CFG_BUILD_DIR)/target/$(1)/cit $$(CARGO) test --target $(1) \ --manifest-path $(S)Cargo.toml \ - $$(OPT_FLAG) $$(CARGOFLAGS) $$(VERBOSE_FLAG) $$(only) + $$(OPT_FLAG) $$(CARGOFLAGS) $$(VERBOSE_FLAG) $$(only) -- \ + --quiet endef $(foreach target,$(CFG_TARGET),$(eval $(call CARGO_TARGET,$(target)))) diff --git a/appveyor.yml b/appveyor.yml index 905b35b9c32..cfc59f75d0b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,12 +1,10 @@ environment: matrix: - TARGET: x86_64-pc-windows-gnu - ARCH: amd64 BITS: 64 CFG_DISABLE_CROSS_TESTS: 1 MAKE_TARGETS: test-unit-x86_64-pc-windows-gnu - TARGET: i686-pc-windows-gnu - ARCH: x86 BITS: 32 MINGW_URL: https://s3.amazonaws.com/rust-lang-ci MINGW_ARCHIVE: i686-4.9.2-release-win32-dwarf-rt_v4-rev4.7z @@ -15,13 +13,12 @@ environment: MAKE_TARGETS: test-unit-i686-pc-windows-gnu - TARGET: i686-pc-windows-msvc BITS: 32 - ARCH: x86 MAKE_TARGETS: test-unit-i686-pc-windows-msvc CFG_DISABLE_CROSS_TESTS: 1 + ALLOW_PR: 1 - TARGET: x86_64-pc-windows-msvc OTHER_TARGET: i686-pc-windows-msvc BITS: 64 - ARCH: amd64 MAKE_TARGETS: test-unit-x86_64-pc-windows-msvc install: @@ -38,6 +35,8 @@ install: - cargo -V - git submodule update --init +clone_depth: 1 + build: false test_script: @@ -48,16 +47,13 @@ cache: - C:\Users\appveyor\.cargo\registry after_test: - - mkdir %APPVEYOR_REPO_COMMIT% + - ps: New-Item -Path "${env:APPVEYOR_REPO_COMMIT}" -ItemType "directory" + - ps: New-Item -Path "target" -ItemType "directory" -Force + - ps: New-Item -Path "target/${env:TARGET}" -ItemType "directory" -Force + - ps: New-Item -Path "target/${env:TARGET}/release" -ItemType "directory" -Force + - ps: New-Item -Path "target/${env:TARGET}/release/dist" -ItemType "directory" -Force - ps: Get-ChildItem -Path target\${env:TARGET}\release\dist -Filter '*.tar.gz' | Move-Item -Destination ${env:APPVEYOR_REPO_COMMIT} -branches: - only: - - master - - auto-cargo - - beta - - stable - artifacts: - path: $(APPVEYOR_REPO_COMMIT)\cargo-*-$(TARGET).tar.gz name: cargo diff --git a/src/ci/docker/run.sh b/src/ci/docker/run.sh index 1a0bb0c21c7..f0546972be6 100755 --- a/src/ci/docker/run.sh +++ b/src/ci/docker/run.sh @@ -37,6 +37,9 @@ exec docker run \ --env SRC=/checkout \ --env CARGO_HOME=/cargo \ --env TRAVIS_BRANCH=$TRAVIS_BRANCH \ + --env TRAVIS_PULL_REQUEST_BRANCH=$TRAVIS_PULL_REQUEST_BRANCH \ + --env ALLOW_PR=$ALLOW_PR \ + --env CI=$CI \ --volume "$HOME/.cargo:/cargo" \ --volume `rustc --print sysroot`:/rust:ro \ --volume `pwd`/target:/tmp/target \ diff --git a/src/ci/run.sh b/src/ci/run.sh index a532757d9f3..1f20a7652d9 100755 --- a/src/ci/run.sh +++ b/src/ci/run.sh @@ -19,7 +19,7 @@ fi BRANCH=$TRAVIS_BRANCH if [ "$BRANCH" = "" ]; then - BRANCH=$APPVEYOR_BRANCH + BRANCH=$APPVEYOR_REPO_BRANCH fi if [ "$BRANCH" = "stable" ]; then @@ -34,6 +34,19 @@ else CHANNEL=dev fi +# We want to only run tests in a few situations: +# +# * All tests on the auto-cargo branch +# * One test on PRs +# * Any tests done locally +# +# This means that here if we're on CI, then we skip tests if it's not the right +# branch or if we're not configured to run a test on PRs +if [ -n "$CI" ] && [ "$BRANCH" != "auto-cargo" ] && [ "$ALLOW_PR" = "" ]; then + echo no build necessary, skipping + exit 0 +fi + $SRC/configure \ --prefix=/tmp/obj/install \ --target=$TARGET \