Skip to content

Commit 5e0f913

Browse files
committed
Apply a patch to emscripten 4.0.5 to enable MAIN_MODULE without RELOCATABLE
1 parent e936c9b commit 5e0f913

File tree

3 files changed

+652
-19
lines changed

3 files changed

+652
-19
lines changed

packages/php-wasm/compile/base-image/Dockerfile

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,7 @@ RUN set -euxo pipefail;\
3030
wget \
3131
unzip \
3232
cmake \
33-
python3 \
34-
# NOTE: Temporary use PR #25522 version of Emscripten
35-
# to build php.wasm with MAIN_MODULE=2 ensurnig
36-
# correct build without increasing binary size.
37-
# npm required to run emscripten/bootstrap.py
38-
npm
33+
python3
3934

4035
# Install Emscripten from the repository. We'd use the official
4136
# Docker image, but there is no arm64 image available which makes
@@ -57,19 +52,14 @@ RUN git clone https://github.com/emscripten-core/emsdk.git && \
5752
./emsdk/emsdk install 4.0.5 && \
5853
/root/emsdk/emsdk activate 4.0.5
5954

60-
# NOTE: Temporary use PR #25522 version of Emscripten
61-
# to build php.wasm with MAIN_MODULE=2 ensurnig
55+
# NOTE: Use of Emscripten PR #25522 patch
56+
# to build php.wasm with MAIN_MODULE ensuring
6257
# correct build without increasing binary size.
63-
RUN rm -rf /root/emsdk/upstream/emscripten && \
64-
git clone https://github.com/sbc100/emscripten.git /root/emsdk/upstream/emscripten && \
65-
cd /root/emsdk/upstream/emscripten && \
66-
git checkout main_module_static_v2
67-
68-
# NOTE: Temporary use PR #25522 version of Emscripten
69-
# to build php.wasm with MAIN_MODULE=2 ensurnig
70-
# correct build without increasing binary size.
71-
# running bootstrap.py to install npm packages.
72-
RUN python3 /root/emsdk/upstream/emscripten/bootstrap.py
58+
COPY ./main_module_without_relocatable.patch /root/main_module_without_relocatable.patch
59+
RUN cd /root/emsdk/upstream/emscripten && \
60+
git init && \
61+
git config --global --add safe.directory /root/emsdk/upstream/emscripten && \
62+
git apply --verbose /root/main_module_without_relocatable.patch
7363

7464
RUN mkdir -p /root/lib/lib /root/lib/include /root/lib/share /root/lib/bin
7565

0 commit comments

Comments
 (0)