Permalink
Browse files

ci: build i686-pc-windows-gnu in ubuntu trusty container

By setting up our own container we can share the build.sh file (almost)
fully between containerised- and bare metal builds.  The apt dependencies
needed are listed in i686-trusty/Dockerfile.

We build i686-pc-windows-gnu in a custom container because the Ubuntu
trusty VM provided by Travis does not have a sufficiently modern gcc
compiler.
1 parent 5b29f65 commit b2274b8054ac9b7eb829267a61fa4e6b138aabc2 @andreastt andreastt committed Oct 3, 2016
Showing with 42 additions and 24 deletions.
  1. +2 −1 .travis.yml
  2. +20 −7 build.sh
  3. +16 −16 ci.sh
  4. +4 −0 i686-trusty/Dockerfile
View
@@ -48,7 +48,8 @@ matrix:
- TARGET=i686-pc-windows-gnu
- NAME=win32
- EXT=zip
- - USE_DOCKER=1
+ - TOOLCHAIN=nightly
+ - DOCKER_IMAGE=i686-trusty
dist: trusty
services:
- docker
View
@@ -24,6 +24,12 @@ setup_docker() {
cd /mnt/host
}
+mingw_i686_install() {
+ curl https://static.rust-lang.org/dist/rust-mingw-nightly-i686-pc-windows-gnu.tar.gz \
+ | tar xzvf - -C /tmp
+ /tmp/rust-mingw-nightly-i686-pc-windows-gnu/install.sh --prefix=`rustc --print sysroot`
+}
+
# Configure rustc target for cross compilation. Provided with a build
# target, this will determine which linker to use for cross compilation.
cargo_config() {
@@ -120,7 +126,7 @@ package_binary() {
tar zcvf "$filename" geckodriver
file "$filename"
fi
- if [ ! -z "$USE_DOCKER" ]
+ if [ ! -z "$DOCKER_IMAGE" ]
then
chown "$USER_ID:$GROUP_ID" "$filename"
fi
@@ -129,14 +135,21 @@ package_binary() {
main() {
TOOLCHAIN=${TOOLCHAIN:=stable}
- if [ ! -z "$USE_DOCKER" ]
+ if [ ! -z "$DOCKER_IMAGE" ]
then
setup_docker
- print_versions
- else
- rustup_install $TOOLCHAIN
- print_versions
- rustup_target_add $TARGET
+ fi
+
+ rustup_install $TOOLCHAIN
+ print_versions
+ rustup_target_add $TARGET
+
+ # custom mingw component required
+ # when compiling on 32-bit windows
+ # see https://github.com/mozilla/geckodriver/pull/138#issuecomment-232139097
+ if [[ $TARGET == "i686-pc-windows-gnu" ]]
+ then
+ mingw_i686_install
fi
cargo_config $TARGET
View
@@ -1,21 +1,21 @@
set -ex
-if [ ! -z "$USE_DOCKER" ]
+if [ ! -z "$DOCKER_IMAGE" ]
then
- ls .
- tag="port-of-rust/$TARGET/latest"
- docker build https://github.com/alexcrichton/port-of-rust.git -f "$TARGET/Dockerfile" -t $tag
- docker run\
- -e USER="$USER"\
- -e TARGET="$TARGET"\
- -e USE_DOCKER=1\
- -e NAME="$NAME"\
- -e TRAVIS_TAG="$TRAVIS_TAG"\
- -e USER_ID=$(id -u)\
- -e GROUP_ID=$(id -g)\
- -v $PWD:/mnt/host\
- -i $tag\
- bash -s -- < build.sh
+ tag="$DOCKER_IMAGE/latest"
+ docker build $DOCKER_IMAGE -t $tag
+ docker run \
+ -e USER="$USER" \
+ -e TARGET="$TARGET" \
+ -e TOOLCHAIN="$TOOLCHAIN" \
+ -e DOCKER_IMAGE="$DOCKER_IMAGE" \
+ -e NAME="$NAME" \
+ -e TRAVIS_TAG="$TRAVIS_TAG" \
+ -e USER_ID=$(id -u) \
+ -e GROUP_ID=$(id -g) \
+ -v $PWD:/mnt/host \
+ -i $tag \
+ bash -s -- < build.sh
else
- bash build.sh
+ bash build.sh
fi
@@ -0,0 +1,4 @@
+FROM ubuntu:15.10
+
+RUN apt-get -y update
+RUN apt-get -y install curl file gcc gcc-mingw-w64-i686 zip

0 comments on commit b2274b8

Please sign in to comment.