summaryrefslogtreecommitdiff
path: root/ci
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2017-08-26 20:39:46 -0700
committerAlex Crichton <alex@alexcrichton.com>2017-08-26 22:15:29 -0700
commit22b98dedfee82bd8e08d979093eaca355ab85e9c (patch)
tree1fd032898b1baa6a211093c97b51b2853877cb7c /ci
parent2f4ca8788bce9138e2cf06611774a617e4810488 (diff)
downloadrust-libc-22b98dedfee82bd8e08d979093eaca355ab85e9c.tar.gz
Add asmjs/wasm32 to CI
Rebase of #610 and also move emscripten up much higher in the hierarchy to ensure that it doesn't have too much of a ripple effect on other platforms. This involved moving down a good number of definitions, but hopefully was done with care to not break anything!
Diffstat (limited to 'ci')
-rw-r--r--ci/docker/asmjs-unknown-emscripten/Dockerfile20
-rw-r--r--ci/docker/wasm32-unknown-emscripten/Dockerfile21
-rwxr-xr-xci/docker/wasm32-unknown-emscripten/node-wrapper.sh11
-rwxr-xr-xci/emscripten-entry.sh19
-rw-r--r--ci/emscripten.sh54
5 files changed, 125 insertions, 0 deletions
diff --git a/ci/docker/asmjs-unknown-emscripten/Dockerfile b/ci/docker/asmjs-unknown-emscripten/Dockerfile
new file mode 100644
index 0000000000..3088fc53c4
--- /dev/null
+++ b/ci/docker/asmjs-unknown-emscripten/Dockerfile
@@ -0,0 +1,20 @@
+FROM ubuntu:16.04
+
+RUN apt-get update && \
+ apt-get install -y --no-install-recommends \
+ ca-certificates \
+ curl \
+ gcc \
+ git \
+ libc6-dev \
+ python \
+ xz-utils
+
+COPY emscripten.sh /
+RUN bash /emscripten.sh
+
+ENV PATH=$PATH:/rust/bin \
+ CARGO_TARGET_ASMJS_UNKNOWN_EMSCRIPTEN_RUNNER=node
+
+COPY emscripten-entry.sh /
+ENTRYPOINT ["/emscripten-entry.sh"]
diff --git a/ci/docker/wasm32-unknown-emscripten/Dockerfile b/ci/docker/wasm32-unknown-emscripten/Dockerfile
new file mode 100644
index 0000000000..59bf7d9a23
--- /dev/null
+++ b/ci/docker/wasm32-unknown-emscripten/Dockerfile
@@ -0,0 +1,21 @@
+FROM ubuntu:16.04
+
+RUN apt-get update && \
+ apt-get install -y --no-install-recommends \
+ ca-certificates \
+ curl \
+ gcc \
+ git \
+ libc6-dev \
+ python \
+ xz-utils
+
+COPY emscripten.sh /
+RUN bash /emscripten.sh
+
+ENV PATH=$PATH:/rust/bin \
+ CARGO_TARGET_WASM32_UNKNOWN_EMSCRIPTEN_RUNNER=node-wrapper.sh
+
+COPY emscripten-entry.sh /
+COPY docker/wasm32-unknown-emscripten/node-wrapper.sh /usr/local/bin/node-wrapper.sh
+ENTRYPOINT ["/emscripten-entry.sh"]
diff --git a/ci/docker/wasm32-unknown-emscripten/node-wrapper.sh b/ci/docker/wasm32-unknown-emscripten/node-wrapper.sh
new file mode 100755
index 0000000000..b1936f0410
--- /dev/null
+++ b/ci/docker/wasm32-unknown-emscripten/node-wrapper.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -e
+
+me=$1
+shift
+dir=$(dirname $me)
+file=$(basename $me)
+
+cd $dir
+exec node $file "$@"
diff --git a/ci/emscripten-entry.sh b/ci/emscripten-entry.sh
new file mode 100755
index 0000000000..acaebfe8c7
--- /dev/null
+++ b/ci/emscripten-entry.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+# file at the top-level directory of this distribution and at
+# http://rust-lang.org/COPYRIGHT.
+#
+# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+# option. This file may not be copied, modified, or distributed
+# except according to those terms.
+
+set -ex
+
+source /emsdk-portable/emsdk_env.sh &> /dev/null
+
+# emsdk-portable provides a node binary, but we need version 8 to run wasm
+export PATH="/node-v8.0.0-linux-x64/bin:$PATH"
+
+exec "$@"
diff --git a/ci/emscripten.sh b/ci/emscripten.sh
new file mode 100644
index 0000000000..d5d55e2fc4
--- /dev/null
+++ b/ci/emscripten.sh
@@ -0,0 +1,54 @@
+# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+# file at the top-level directory of this distribution and at
+# http://rust-lang.org/COPYRIGHT.
+#
+# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+# option. This file may not be copied, modified, or distributed
+# except according to those terms.
+
+set -ex
+
+hide_output() {
+ set +x
+ on_err="
+echo ERROR: An error was encountered with the build.
+cat /tmp/build.log
+exit 1
+"
+ trap "$on_err" ERR
+ bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
+ PING_LOOP_PID=$!
+ $@ &> /tmp/build.log
+ trap - ERR
+ kill $PING_LOOP_PID
+ rm -f /tmp/build.log
+ set -x
+}
+
+cd /
+curl -L https://s3.amazonaws.com/mozilla-games/emscripten/releases/emsdk-portable.tar.gz | \
+ tar -xz
+
+cd /emsdk-portable
+./emsdk update
+hide_output ./emsdk install sdk-1.37.14-64bit
+./emsdk activate sdk-1.37.14-64bit
+
+# Compile and cache libc
+source ./emsdk_env.sh
+echo "main(){}" > a.c
+HOME=/emsdk-portable/ emcc a.c
+HOME=/emsdk-portable/ emcc -s BINARYEN=1 a.c
+rm -f a.*
+
+# Make emsdk usable by any user
+cp /root/.emscripten /emsdk-portable
+chmod a+rxw -R /emsdk-portable
+
+# node 8 is required to run wasm
+cd /
+curl -L https://nodejs.org/dist/v8.0.0/node-v8.0.0-linux-x64.tar.xz | \
+ tar -xJ
+