]> git.lizzy.rs Git - rust.git/blob - src/ci/docker/emscripten/build-emscripten.sh
travis: try to fix the build on emscripten
[rust.git] / src / ci / docker / emscripten / build-emscripten.sh
1 #!/bin/bash
2 # Copyright 2017 The Rust Project Developers. See the COPYRIGHT
3 # file at the top-level directory of this distribution and at
4 # http://rust-lang.org/COPYRIGHT.
5 #
6 # Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
7 # http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
8 # <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
9 # option. This file may not be copied, modified, or distributed
10 # except according to those terms.
11
12 set -ex
13
14 hide_output() {
15   set +x
16   on_err="
17 echo ERROR: An error was encountered with the build.
18 cat /tmp/build.log
19 exit 1
20 "
21   trap "$on_err" ERR
22   bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
23   PING_LOOP_PID=$!
24   $@ &> /tmp/build.log
25   trap - ERR
26   kill $PING_LOOP_PID
27   rm /tmp/build.log
28   set -x
29 }
30
31 curl https://s3.amazonaws.com/mozilla-games/emscripten/releases/emsdk-portable.tar.gz | \
32     tar xzf -
33
34 # Some versions of the EMSDK archive have their contents in .emsdk-portable
35 # and others in emsdk_portable. Make sure the EMSDK ends up in a fixed path.
36 if [ -d emsdk-portable ]; then
37     mv emsdk-portable emsdk_portable
38 fi
39
40 if [ ! -d emsdk_portable ]; then
41     echo "ERROR: Invalid emsdk archive. Dumping working directory." >&2
42     ls -l
43     exit 1
44 fi
45
46 source emsdk_portable/emsdk_env.sh
47 hide_output emsdk update
48 hide_output emsdk install --build=Release sdk-tag-1.37.1-32bit
49 hide_output emsdk activate --build=Release sdk-tag-1.37.1-32bit