Skip to content

Commit b32e2da

Browse files
committed
feat: add wasm-nginx-module
1 parent c27d49a commit b32e2da

File tree

2 files changed

+30
-3
lines changed

2 files changed

+30
-3
lines changed

build-apisix-openresty.sh

+22-2
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@ if [ $# -gt 0 ] && [ "$1" == "latest" ]; then
66
ngx_multi_upstream_module_ver=""
77
mod_dubbo_ver=""
88
apisix_nginx_module_ver=""
9+
wasm_nginx_module_ver=""
910
lua_var_nginx_module_ver=""
1011
debug_args="--with-debug"
1112
OR_PREFIX=${OR_PREFIX:="/usr/local/openresty-debug"}
1213
else
1314
ngx_multi_upstream_module_ver="-b 1.0.0"
1415
mod_dubbo_ver="-b 1.0.0"
1516
apisix_nginx_module_ver="-b 1.3.0"
17+
wasm_nginx_module_ver=""
1618
lua_var_nginx_module_ver="-b v0.5.2"
1719
debug_args=${debug_args:-}
1820
OR_PREFIX=${OR_PREFIX:="/usr/local/openresty"}
@@ -48,6 +50,13 @@ else
4850
https://github.com/api7/apisix-nginx-module.git
4951
fi
5052

53+
if [ "$repo" == wasm-nginx-module ]; then
54+
cp -r "$prev_workdir" .
55+
else
56+
git clone --depth=1 $wasm_nginx_module_ver \
57+
https://github.com/api7/wasm-nginx-module.git
58+
fi
59+
5160
if [ "$repo" == lua-var-nginx-module ]; then
5261
cp -r "$prev_workdir" .
5362
else
@@ -63,6 +72,10 @@ cd apisix-nginx-module/patch || exit 1
6372
./patch.sh ../../openresty-${or_ver}
6473
cd ../..
6574

75+
cd wasm-nginx-module || exit 1
76+
./install-wasmtime.sh
77+
cd ..
78+
6679
version=${version:-0.0.0}
6780
cc_opt=${cc_opt:-}
6881
ld_opt=${ld_opt:-}
@@ -72,10 +85,11 @@ no_pool_patch=${no_pool_patch:-}
7285
cd openresty-${or_ver} || exit 1
7386
./configure --prefix="$OR_PREFIX" \
7487
--with-cc-opt="-DAPISIX_OPENRESTY_VER=$version $cc_opt" \
75-
--with-ld-opt="$ld_opt" \
88+
--with-ld-opt="-Wl,-rpath,$OR_PREFIX/wasmtime-c-api/lib $ld_opt" \
7689
--add-module=../mod_dubbo \
7790
--add-module=../ngx_multi_upstream_module \
7891
--add-module=../apisix-nginx-module \
92+
--add-module=../wasm-nginx-module \
7993
--add-module=../lua-var-nginx-module \
8094
$debug_args \
8195
--with-poll_module \
@@ -112,5 +126,11 @@ make -j`nproc`
112126
sudo make install
113127
cd ..
114128

129+
export OPENRESTY_PREFIX="$OR_PREFIX"
115130
cd apisix-nginx-module || exit 1
116-
sudo OPENRESTY_PREFIX="$OR_PREFIX" make install
131+
sudo --preserve-env=OPENRESTY_PREFIX make install
132+
cd ..
133+
134+
cd wasm-nginx-module || exit 1
135+
sudo --preserve-env=OPENRESTY_PREFIX make install
136+
cd ..

utils/build-common.sh

+8-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,15 @@ set -euo pipefail
33
set -x
44

55
build_apisix_openresty_rpm() {
6+
yum -y install centos-release-scl
7+
yum -y install devtoolset-8 patch wget git make sudo
8+
set +eu
9+
source scl_source enable devtoolset-8
10+
set -eu
11+
command -v gcc
12+
gcc --version
13+
614
yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo
7-
yum -y install gcc gcc-c++ patch wget git make sudo
815
yum -y install openresty-openssl111-devel openresty-pcre-devel openresty-zlib-devel
916

1017
export_openresty_variables

0 commit comments

Comments
 (0)