Skip to content

Commit

Permalink
Update emscripten.
Browse files Browse the repository at this point in the history
  • Loading branch information
reitermarkus committed Jan 1, 2020
1 parent 160517d commit 94c020c
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 31 deletions.
8 changes: 4 additions & 4 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ strategy:
aarch64-unknown-linux-gnu: { TARGET: aarch64-unknown-linux-gnu, CPP: 1, DYLIB: 1, STD: 1, RUN: 1, RUNNERS: qemu-user qemu-system }
arm-unknown-linux-gnueabi: { TARGET: arm-unknown-linux-gnueabi, CPP: 1, DYLIB: 1, STD: 1, RUN: 1 }
arm-unknown-linux-gnueabihf: { TARGET: arm-unknown-linux-gnueabihf, CPP: 1, DYLIB: 1, STD: 1, RUN: 1 }
armv7-unknown-linux-gnueabihf: { TARGET: armv7-unknown-linux-gnueabihf, CPP: 1, DYLIB: 1, STD: 1, RUN: 1, RUNNERS: qemu-user qemu-system }
armv7-unknown-linux-gnueabihf: { TARGET: armv7-unknown-linux-gnueabihf, CPP: 1, DYLIB: 1, STD: 1, RUN: 1, RUNNERS: qemu-user qemu-system }
i586-unknown-linux-gnu: { TARGET: i586-unknown-linux-gnu, CPP: 1, DYLIB: 1, STD: 1, RUN: 1 }
i686-unknown-linux-gnu: { TARGET: i686-unknown-linux-gnu, CPP: 1, DYLIB: 1, STD: 1, RUN: 1, RUNNERS: native qemu-user qemu-system }
i686-unknown-linux-gnu: { TARGET: i686-unknown-linux-gnu, CPP: 1, DYLIB: 1, STD: 1, RUN: 1, RUNNERS: native qemu-user qemu-system }
mips-unknown-linux-gnu: { TARGET: mips-unknown-linux-gnu, CPP: 1, DYLIB: 1, STD: 1, RUN: 1, RUNNERS: qemu-user qemu-system }
mipsel-unknown-linux-gnu: { TARGET: mipsel-unknown-linux-gnu, CPP: 1, DYLIB: 1, STD: 1, RUN: 1, RUNNERS: qemu-user qemu-system }
mips64-unknown-linux-gnuabi64: { TARGET: mips64-unknown-linux-gnuabi64, CPP: 1, DYLIB: 1, STD: 1, RUN: 1 }
Expand Down Expand Up @@ -61,9 +61,9 @@ strategy:
x86_64-unknown-netbsd: { TARGET: x86_64-unknown-netbsd, CPP: 1, DYLIB: 1, STD: 1 }
sparcv9-sun-solaris: { TARGET: sparcv9-sun-solaris, CPP: 1, DYLIB: 1, STD: 1 }
x86_64-sun-solaris: { TARGET: x86_64-sun-solaris, CPP: 1, DYLIB: 1, STD: 1 }
asmjs-unknown-emscripten: { TARGET: asmjs-unknown-emscripten, CPP: 1, STD: 1, RUN: 1 }
asmjs-unknown-emscripten: { TARGET: asmjs-unknown-emscripten, STD: 1, RUN: 1 }
# `cargo run` fails with an assertion error (https://github.com/rust-lang/cargo/issues/4689) on `wasm32-unknown-emscripten`.
wasm32-unknown-emscripten: { TARGET: wasm32-unknown-emscripten, CPP: 1, STD: 1 }
wasm32-unknown-emscripten: { TARGET: wasm32-unknown-emscripten, STD: 1 }
thumbv6m-none-eabi: { TARGET: thumbv6m-none-eabi, STD: 1 }
thumbv7em-none-eabi: { TARGET: thumbv7em-none-eabi, STD: 1 }
thumbv7em-none-eabihf: { TARGET: thumbv7em-none-eabihf, STD: 1 }
Expand Down
26 changes: 21 additions & 5 deletions docker/Dockerfile.asmjs-unknown-emscripten
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,28 @@ RUN /common.sh
COPY cmake.sh /
RUN /cmake.sh

RUN apt-get install -y --no-install-recommends python
COPY xargo.sh /
RUN /xargo.sh

COPY emscripten.sh /
RUN /emscripten.sh
COPY --from=trzeci/emscripten:1.38.46-upstream /emsdk_portable /emsdk_portable

COPY emscripten-entry.sh /
ENTRYPOINT ["/emscripten-entry.sh"]
ENV EMSDK /emsdk_portable
ENV EMSCRIPTEN=${EMSDK}/emscripten/sdk

ENV EM_DATA ${EMSDK}/.data
ENV EM_CONFIG ${EMSDK}/.emscripten
ENV EM_CACHE ${EM_DATA}/cache
ENV EM_PORTS ${EM_DATA}/ports

ENV PATH="${EMSDK}:${EMSDK}/emscripten/sdk:${EMSDK}/llvm/clang/bin:${EMSDK}/node/current/bin:${EMSDK}/binaryen/bin:${PATH}"

ENTRYPOINT ["/emsdk_portable/entrypoint"]

RUN apt-get update && apt-get install -y --no-install-recommends \
libxml2 \
python

ENV CARGO_TARGET_ASMJS_UNKNOWN_EMSCRIPTEN_RUNNER=node

# Prevent 'wasm2js does not support source maps yet' error.
ENV RUSTFLAGS='-C debuginfo=0'
23 changes: 18 additions & 5 deletions docker/Dockerfile.wasm32-unknown-emscripten
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,26 @@ RUN /common.sh
COPY cmake.sh /
RUN /cmake.sh

RUN apt-get install -y --no-install-recommends python
COPY xargo.sh /
RUN /xargo.sh

COPY emscripten.sh /
RUN /emscripten.sh
COPY --from=trzeci/emscripten:1.38.46-upstream /emsdk_portable /emsdk_portable

COPY emscripten-entry.sh /
ENTRYPOINT ["/emscripten-entry.sh"]
ENV EMSDK /emsdk_portable
ENV EMSCRIPTEN=${EMSDK}/emscripten/sdk

ENV EM_DATA ${EMSDK}/.data
ENV EM_CONFIG ${EMSDK}/.emscripten
ENV EM_CACHE ${EM_DATA}/cache
ENV EM_PORTS ${EM_DATA}/ports

ENV PATH="${EMSDK}:${EMSDK}/emscripten/sdk:${EMSDK}/llvm/clang/bin:${EMSDK}/node/current/bin:${EMSDK}/binaryen/bin:${PATH}"

ENTRYPOINT ["/emsdk_portable/entrypoint"]

RUN apt-get update && apt-get install -y --no-install-recommends \
libxml2 \
python

COPY node-wasm /usr/local/bin/
ENV CARGO_TARGET_WASM32_UNKNOWN_EMSCRIPTEN_RUNNER=node-wasm
9 changes: 0 additions & 9 deletions docker/emscripten-entry.sh

This file was deleted.

13 changes: 5 additions & 8 deletions docker/emscripten.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ main() {
ca-certificates
curl
git
libxml2
python
)

Expand All @@ -24,14 +25,11 @@ main() {
git clone https://github.com/emscripten-core/emsdk.git /emsdk-portable
cd /emsdk-portable

export HOME=/emsdk-portable/

./emsdk install sdk-1.38.15-64bit
./emsdk activate sdk-1.38.15-64bit
./emsdk install 1.38.46-upstream
./emsdk activate 1.38.46-upstream

# Compile and cache libc
source ./emsdk_env.sh
echo "main(){}" > a.c
echo 'int main() {}' > a.c
emcc a.c
emcc -s BINARYEN=1 a.c
echo -e "#include <iostream>\n void hello(){ std::cout << std::endl; }" > a.cpp
Expand All @@ -40,8 +38,7 @@ main() {
rm -f a.*

# Make emsdk usable by any user
chmod a+rw -R /emsdk-portable/
find /emsdk-portable/ -executable -print0 | xargs -0 chmod a+x
chmod a+rwX -R "${EMSDK}"

if (( ${#purge_list[@]} )); then
apt-get purge --auto-remove -y ${purge_list[@]}
Expand Down

0 comments on commit 94c020c

Please sign in to comment.