Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable build for ARM processor architectuere #9

Merged
merged 3 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
ARG EMSCRIPTEN_VERSION=3.1.51
ARG EMSDK_IMAGE=docker.io/emscripten/emsdk

# Build libsodium
FROM docker.io/emscripten/emsdk:$EMSCRIPTEN_VERSION AS SODIUM
FROM ${EMSDK_IMAGE}:${EMSCRIPTEN_VERSION} AS SODIUM

ARG LIBSODIUM_VERSION=1.0.19-stable

ADD https://download.libsodium.org/libsodium/releases/libsodium-${LIBSODIUM_VERSION}.tar.gz .

RUN tar xvf libsodium-${LIBSODIUM_VERSION}.tar.gz \
&& cd libsodium-stable \
&& sed -i -e 's/WASM_INITIAL_MEMORY=4MB/WASM_INITIAL_MEMORY=8MB/g' dist-build/emscripten.sh \
&& dist-build/emscripten.sh --sumo

# Build openssl
FROM docker.io/emscripten/emsdk:$EMSCRIPTEN_VERSION AS OPENSSL
FROM ${EMSDK_IMAGE}:${EMSCRIPTEN_VERSION} AS OPENSSL

ARG OPENSSL_VERSION=1.1.1w

Expand All @@ -30,7 +32,7 @@ RUN bash -c 'echo "$(cat openssl-${OPENSSL_VERSION}.tar.gz.sha256) openssl-${OPE
&& emmake make install

# Build libcrypt4gh
FROM docker.io/emscripten/emsdk:$EMSCRIPTEN_VERSION AS LIBCRYPT4GH
FROM ${EMSDK_IMAGE}:${EMSCRIPTEN_VERSION} AS LIBCRYPT4GH

RUN rm -f /etc/apt/apt.conf.d/docker-clean; echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache

Expand All @@ -57,7 +59,7 @@ RUN export EMCC_CFLAGS="-I/emsdk/upstream/include -L/emsdk/upstream/lib" \
&& emmake make install

# Build libcrypt4gh-keys
FROM docker.io/emscripten/emsdk:$EMSCRIPTEN_VERSION AS LIBCRYPT4GHKEYS
FROM ${EMSDK_IMAGE}:${EMSCRIPTEN_VERSION} AS LIBCRYPT4GHKEYS

COPY --from=SODIUM /src/libsodium-stable/libsodium-js-sumo/include/ /emsdk/upstream/include/
COPY --from=SODIUM /src/libsodium-stable/libsodium-js-sumo/lib/ /emsdk/upstream/lib/
Expand Down Expand Up @@ -85,7 +87,7 @@ RUN export EMCC_CFLAGS="-I/emsdk/upstream/include -L/emsdk/upstream/lib" \
&& emmake make install

# Build wasm application
FROM docker.io/emscripten/emsdk:$EMSCRIPTEN_VERSION AS WASMCRYPT
FROM ${EMSDK_IMAGE}:${EMSCRIPTEN_VERSION} AS WASMCRYPT

LABEL maintainer="CSC Developers"
LABEL org.label-schema.schema-version="1.0"
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ Build your application
## Extras
You can provide argument variables to change which library versions get built.

`emscripten`, `libsodium`, and `openssl` versions can be changed with `--build-arg` by changing the value of `EMSCRIPTEN_VERSION`, `LIBSODIUM_VERSION`, and `OPENSSL_VERSION`.
`emscripten`, `libsodium`, and `openssl` versions can be changed with `--build-arg` by changing the value of `EMSCRIPTEN_VERSION`, `LIBSODIUM_VERSION`, `EMSDK_IMAGE` and `OPENSSL_VERSION`.

>__NOTE:__ To build only ARM images use -arm in version tag and for ARM built images. For example `EMSDK_IMAGE --build-arg="EMSDK_IMAGE=<local-registry>/emscripten/emsdk" --build-arg="EMSCRIPTEN_VERSION=3.1.21-arm"` instructs to use locally build emsdk:3.1.21-arm container.

# License

Expand Down
2 changes: 1 addition & 1 deletion build_wasm.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

EMCC_CFLAGS="-I/emsdk/upstream/include -L/emsdk/upstream/lib" EMCC_FORCE_STDLIBS=libc emmake make $1
EMCC_CFLAGS="-I/emsdk/upstream/include -L/emsdk/upstream/lib -sINITIAL_MEMORY=26214400" EMCC_FORCE_STDLIBS=libc emmake make $1
csc-felipe marked this conversation as resolved.
Show resolved Hide resolved