Skip to content
This repository was archived by the owner on Mar 17, 2025. It is now read-only.

Commit 97cebc1

Browse files
authored
Implements emsdk v3.1.16 toolchain (#24)
Implements emsdk 3.1.16 toolchain Signed-off-by: M4tteoP <pace.matteo96@gmail.com>
1 parent 96d15a3 commit 97cebc1

File tree

2 files changed

+24
-14
lines changed

2 files changed

+24
-14
lines changed

e2e/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ build-wasm-plugin-static:
1212
extract-wasm-plugin-static:
1313
@docker rm -f $(EXTRACT_CONTAINER_NAME) || true
1414
@docker create --rm --name $(EXTRACT_CONTAINER_NAME) $(IMAGE_NAME):$(IMAGE_VERSION) /plugin.wasm
15-
@mkdir ./build
15+
@mkdir -p ./build
1616
@docker cp $(EXTRACT_CONTAINER_NAME):/plugin.wasm ./build/modsecurity-filter.wasm
1717
@docker rm -f $(EXTRACT_CONTAINER_NAME)
1818

wasmplugin/Dockerfile

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,32 +33,26 @@ RUN git clone -b v3.9.1 https://github.com/protocolbuffers/protobuf \
3333
ARG MODSEC_SHA=a3454df9b09a8de16d41be10cdea4fc46ef08e91
3434

3535
WORKDIR /root/
36-
RUN git clone https://github.com/emscripten-core/emsdk.git -b 3.1.15 \
37-
&& git clone https://github.com/maxfierke/libpcre.git -b mf-wasm32-wasi-cross-compile \
36+
RUN git clone https://github.com/emscripten-core/emsdk.git -b 3.1.16 \
37+
&& git clone https://github.com/M4tteoP/libpcre.git -b wasm-emscripten \
3838
&& git clone https://github.com/SpiderLabs/ModSecurity.git \
3939
&& git -C ModSecurity checkout $MODSEC_SHA \
4040
&& git clone https://github.com/abseil/abseil-cpp -b 20211102.0 \
4141
&& git clone https://github.com/proxy-wasm/proxy-wasm-cpp-sdk \
4242
&& git clone https://github.com/istio/proxy.git -b 1.13.3
4343

4444
WORKDIR /root/emsdk
45-
RUN ./emsdk install 2.0.7 \
46-
&& ./emsdk activate 2.0.7 \
45+
RUN ./emsdk install 3.1.16 \
46+
&& ./emsdk activate 3.1.16 \
4747
&& echo "source /root/emsdk/emsdk_env.sh" >> ~/.bashrc \
4848
&& cd ..
4949

50-
RUN wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-linux.tar.gz \
51-
&& tar xvf wasi-sdk-12.0-linux.tar.gz -C /opt/ \
52-
&& mv /opt/wasi-sdk-12.0/ /opt/wasi-sdk \
53-
&& rm wasi-sdk-12.0-linux.tar.gz
54-
55-
ENV WASI_SDK_PATH="/opt/wasi-sdk"
56-
5750
WORKDIR /root/libpcre
5851
RUN autoreconf -ivf \
59-
&& ./build_for_crystal.sh wasm32-wasi \
52+
&& source "/root/emsdk/emsdk_env.sh" \
53+
&& ./build_for_wasm.sh wasm32-emscripten \
6054
&& mkdir /usr/local/pcre \
61-
&& cp targets/wasm32-wasi/*.a /usr/local/pcre \
55+
&& cp targets/wasm32-emscripten/*.a /usr/local/pcre \
6256
&& cd ..
6357

6458
WORKDIR /root/ModSecurity
@@ -80,6 +74,22 @@ WORKDIR /root/proxy-wasm-cpp-sdk
8074
RUN mkdir /build /sdk \
8175
&& cp *.cc *.h *.js *.proto Makefile* *.a /sdk/
8276

77+
WORKDIR /root
78+
RUN source "/root/emsdk/emsdk_env.sh" \
79+
&& git clone https://github.com/protocolbuffers/protobuf -b v3.9.1 protobuf-wasm \
80+
&& cd protobuf-wasm \
81+
&& git clone https://github.com/kwonoj/protobuf-wasm wasm-patches \
82+
&& cd wasm-patches \
83+
&& git checkout 4bba8b2f38b5004f87489642b6ca4525ae72fe7f \
84+
&& cd .. \
85+
&& git apply wasm-patches/*.patch \
86+
&& ./autogen.sh \
87+
&& emconfigure ./configure --disable-shared CXXFLAGS="-O3 -flto" \
88+
&& emmake make \
89+
&& cd .. \
90+
&& cp protobuf-wasm/src/.libs/libprotobuf-lite.a /sdk/libprotobuf-lite.a \
91+
&& cp protobuf-wasm/src/.libs/libprotobuf.a /sdk/libprotobuf.a
92+
8393
WORKDIR /root
8494
RUN wget -O /usr/local/bin/bazel https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-linux-amd64 \
8595
&& chmod +x /usr/local/bin/bazel

0 commit comments

Comments
 (0)