geckodriver: 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.

Source-Repo: https://github.com/mozilla/geckodriver
Source-Revision: b2274b8054ac9b7eb829267a61fa4e6b138aabc2

--HG--
extra : rebase_source : a1d510b4f0a6e4e6d859b50a97617f1595d23903
This commit is contained in:
Andreas Tolfsen 2016-10-03 22:45:44 +01:00
parent 045639d8dd
commit f6a6377949
4 changed files with 42 additions and 24 deletions

View File

@ -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 File

@ -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 File

@ -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

View File

@ -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