Skip to content

Commit a06a036

Browse files
authored
feat: build apisix-nginx-module (openresty#34)
And allow the script to use current directory's code instead of download it
1 parent 9aded1d commit a06a036

File tree

1 file changed

+28
-6
lines changed

1 file changed

+28
-6
lines changed

build-apisix-openresty.sh

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,33 @@ else
1414
OR_PREFIX=${OR_PREFIX:="/usr/local/openresty"}
1515
fi
1616

17+
prev_workdir="$PWD"
18+
repo=$(basename "$prev_workdir")
1719
workdir=$(mktemp -d)
1820
cd "$workdir" || exit 1
1921

2022
wget https://openresty.org/download/openresty-1.19.3.1.tar.gz
2123
tar -zxvpf openresty-1.19.3.1.tar.gz
2224

23-
git clone --depth=1 $ngx_multi_upstream_module_ver \
24-
https://github.com/api7/ngx_multi_upstream_module.git
25-
git clone --depth=1 $mod_dubbo_ver \
26-
https://github.com/api7/mod_dubbo.git
27-
git clone --depth=1 https://github.com/api7/apisix-nginx-module.git
25+
if [ "$repo" == ngx_multi_upstream_module ]; then
26+
cp -r "$prev_workdir" .
27+
else
28+
git clone --depth=1 $ngx_multi_upstream_module_ver \
29+
https://github.com/api7/ngx_multi_upstream_module.git
30+
fi
31+
32+
if [ "$repo" == mod_dubbo ]; then
33+
cp -r "$prev_workdir" .
34+
else
35+
git clone --depth=1 $mod_dubbo_ver \
36+
https://github.com/api7/mod_dubbo.git
37+
fi
38+
39+
if [ "$repo" == apisix-nginx-module ]; then
40+
cp -r "$prev_workdir" .
41+
else
42+
git clone --depth=1 https://github.com/api7/apisix-nginx-module.git
43+
fi
2844

2945
cd ngx_multi_upstream_module || exit 1
3046
./patch.sh ../openresty-1.19.3.1
@@ -36,7 +52,9 @@ cd ../..
3652

3753
cd openresty-1.19.3.1 || exit 1
3854
./configure --prefix="$OR_PREFIX" \
39-
--add-module=../mod_dubbo --add-module=../ngx_multi_upstream_module \
55+
--add-module=../mod_dubbo \
56+
--add-module=../ngx_multi_upstream_module \
57+
--add-module=../apisix-nginx-module \
4058
$debug_args \
4159
--with-poll_module \
4260
--with-pcre-jit \
@@ -67,3 +85,7 @@ cd openresty-1.19.3.1 || exit 1
6785
--with-luajit-xcflags='-DLUAJIT_NUMMODE=2 -DLUAJIT_ENABLE_LUA52COMPAT'
6886
make
6987
sudo make install
88+
cd ..
89+
90+
cd apisix-nginx-module || exit 1
91+
sudo OPENRESTY_PREFIX="$OR_PREFIX" make install

0 commit comments

Comments
 (0)