Skip to content

Commit

Permalink
Auto merge of #3345 - alexcrichton:release-branches, r=alexcrichton
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bors committed Nov 30, 2016
2 parents 930bdaa + 7a9f908 commit 294c7e5
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 57 deletions.
12 changes: 7 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand Down
23 changes: 15 additions & 8 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -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),)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -274,7 +281,7 @@ target/openssl/$(1).stamp:

endif

else # !CFG_ENABLE_NIGHTLY
else # !CFG_ENABLE_BUILD_OPENSSL
target/openssl/$(1).stamp:
endif

Expand Down
7 changes: 4 additions & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
49 changes: 9 additions & 40 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
16 changes: 16 additions & 0 deletions src/ci/docker/cross/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions src/ci/docker/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
20 changes: 19 additions & 1 deletion src/ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 294c7e5

Please sign in to comment.