From d3dc3ed8e8b6dc6362f5a988f2c7d28fed6adb8b Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Sun, 29 Dec 2024 19:36:29 -0500 Subject: [PATCH] web-wasm: support arm64 builds --- Makefile | 15 +++++++++++---- web-wasm/Dockerfile.in | 3 ++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index f74b7b6..3053fe3 100644 --- a/Makefile +++ b/Makefile @@ -140,13 +140,20 @@ $(GEN_IMAGE_DOCKERFILES) Dockerfile: %Dockerfile: %Dockerfile.in $(DOCKER_COMPOS # # web-wasm # +ifeq ($(HOST_ARCH),amd64) + EMSCRIPTEN_HOST_ARCH_TAG = "" +endif +ifeq ($(HOST_ARCH),arm64) + EMSCRIPTEN_HOST_ARCH_TAG = "-arm64" +endif web-wasm: web-wasm/Dockerfile mkdir -p $@/imagefiles && cp -r imagefiles $@/ cp -r test web-wasm/ - $(BUILD_DOCKER) $(BUILD_CMD) $(TAG_FLAG) $(ORG)/web-wasm:$(TAG) \ - $(TAG_FLAG) $(ORG)/web-wasm:latest \ + $(BUILD_DOCKER) $(BUILD_CMD) $(TAG_FLAG) $(ORG)/web-wasm:$(TAG)-$(HOST_ARCH) \ + $(TAG_FLAG) $(ORG)/web-wasm:latest-$(HOST_ARCH) \ --build-arg IMAGE=$(ORG)/web-wasm \ --build-arg VERSION=$(TAG) \ + --build-arg HOST_ARCH_TAG=$(EMSCRIPTEN_HOST_ARCH_TAG) \ --build-arg VCS_REF=`git rev-parse --short HEAD` \ --build-arg VCS_URL=`git config --get remote.origin.url` \ --build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \ @@ -156,8 +163,8 @@ web-wasm: web-wasm/Dockerfile web-wasm.test: web-wasm cp -r test web-wasm/ - $(TEST_DOCKER) run $(RM) $(ORG)/web-wasm:latest > $(BIN)/dockcross-web-wasm && chmod +x $(BIN)/dockcross-web-wasm - $(BIN)/dockcross-web-wasm -i $(ORG)/web-wasm:latest python test/run.py --exe-suffix ".js" + $(TEST_DOCKER) run $(RM) $(ORG)/web-wasm:latest-$(HOST_ARCH) > $(BIN)/dockcross-web-wasm && chmod +x $(BIN)/dockcross-web-wasm + $(BIN)/dockcross-web-wasm -i $(ORG)/web-wasm:latest-$(HOST_ARCH) python test/run.py --exe-suffix ".js" rm -rf web-wasm/test # diff --git a/web-wasm/Dockerfile.in b/web-wasm/Dockerfile.in index 1091ff2..4f23eac 100644 --- a/web-wasm/Dockerfile.in +++ b/web-wasm/Dockerfile.in @@ -1,5 +1,6 @@ ARG DOCKER_IMAGE_VERSION=3.1.74 -FROM emscripten/emsdk:$DOCKER_IMAGE_VERSION +ARG HOST_ARCH_TAG +FROM emscripten/emsdk:$DOCKER_IMAGE_VERSION$HOST_ARCH_TAG LABEL maintainer="Matt McCormick matt@mmmccormick.com"