forked from proxy-wasm/proxy-wasm-cpp-sdk
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
28 lines (22 loc) · 1.32 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
CPP_API ?= .
all: proxy_wasm_intrinsics.pb.h proxy_wasm_intrinsics_lite.pb.h struct_lite.pb.h ${CPP_API}/libprotobuf.a ${CPP_API}/libprotobuf-lite.a
protobuf: proxy_wasm_intrinsics.pb.h proxy_wasm_intrinsics_lite.pb.h struct_lite.pb.h
proxy_wasm_intrinsics.pb.h: proxy_wasm_intrinsics.proto
protoc --cpp_out=. proxy_wasm_intrinsics.proto
proxy_wasm_intrinsics_lite.pb.h struct_lite.pb.h: proxy_wasm_intrinsics_lite.proto
protoc --cpp_out=. -I. proxy_wasm_intrinsics_lite.proto
protoc --cpp_out=. struct_lite.proto
${CPP_API}/libprotobuf.a ${CPP_API}/libprotobuf-lite.a:
rm -rf protobuf-wasm && git clone https://github.com/protocolbuffers/protobuf protobuf-wasm \
&& cd protobuf-wasm && git checkout v3.9.1 \
&& rm -rf wasm-patches && git clone https://github.com/kwonoj/protobuf-wasm wasm-patches \
&& cd wasm-patches && git checkout 4bba8b2f38b5004f87489642b6ca4525ae72fe7f \
&& cd .. && git apply wasm-patches/*.patch \
&& ./autogen.sh \
&& emconfigure ./configure --disable-shared CXXFLAGS="-O3 -flto" \
&& emmake make \
&& cd .. \
&& cp protobuf-wasm/src/.libs/libprotobuf-lite.a ${CPP_API}/libprotobuf-lite.a \
&& cp protobuf-wasm/src/.libs/libprotobuf.a ${CPP_API}/libprotobuf.a
clean:
rm -f proxy_wasm_intrinsics.pb.h proxy_wasm_intrinsics_lite.pb.h struct_lite.pb.h ${CPP_API}/libprotobuf.a ${CPP_API}/libprotobuf-lite.a