44
55runtime_version=${runtime_version:- 0.0.0}
66
7+
8+ debug_args=${debug_args:- }
9+ ENABLE_FIPS=${ENABLE_FIPS:- " false" }
10+ OPENSSL_CONF_PATH=${OPENSSL_CONF_PATH:- $PWD / conf/ openssl3/ openssl.cnf}
11+
12+
13+ OR_PREFIX=${OR_PREFIX:= " /usr/local/openresty" }
14+ OPENSSL_PREFIX=${OPENSSL_PREFIX:= $OR_PREFIX / openssl3}
15+ zlib_prefix=${OR_PREFIX} /zlib
16+ pcre_prefix=${OR_PREFIX} /pcre
17+
18+ cc_opt=${cc_opt:- " -DNGX_LUA_ABORT_AT_PANIC -I$zlib_prefix /include -I$pcre_prefix /include -I$OPENSSL_PREFIX /include" }
19+ ld_opt=${ld_opt:- " -L$zlib_prefix /lib -L$pcre_prefix /lib -L$OPENSSL_PREFIX /lib -Wl,-rpath,$zlib_prefix /lib:$pcre_prefix /lib:$OPENSSL_PREFIX /lib" }
20+
21+
22+ # dependencies for building openresty
23+ OPENSSL_VERSION=${OPENSSL_VERSION:- " 3.2.0" }
724OPENRESTY_VERSION=" 1.21.4.2"
825ngx_multi_upstream_module_ver=" 1.1.1"
926mod_dubbo_ver=" 1.0.2"
@@ -12,8 +29,41 @@ wasm_nginx_module_ver="0.6.5"
1229lua_var_nginx_module_ver=" v0.5.3"
1330grpc_client_nginx_module_ver=" v0.4.4"
1431lua_resty_events_ver=" 0.2.0"
15- OR_PREFIX=${OR_PREFIX:= " /usr/local/openresty" }
16- debug_args=${debug_args:- }
32+
33+
34+ install_openssl_3 (){
35+ local fips=" "
36+ if [ " $ENABLE_FIPS " == " true" ]; then
37+ fips=" enable-fips"
38+ fi
39+ # required for openssl 3.x config
40+ cpanm IPC/Cmd.pm
41+ wget --no-check-certificate https://www.openssl.org/source/openssl-${OPENSSL_VERSION} .tar.gz
42+ tar xvf openssl-${OPENSSL_VERSION} .tar.gz
43+ cd openssl-${OPENSSL_VERSION} /
44+ export LDFLAGS=" -Wl,-rpath,$zlib_prefix /lib:$OPENSSL_PREFIX /lib"
45+ ./config $fips \
46+ shared \
47+ zlib \
48+ enable-camellia enable-seed enable-rfc3779 \
49+ enable-cms enable-md2 enable-rc5 \
50+ enable-weak-ssl-ciphers \
51+ --prefix=$OPENSSL_PREFIX \
52+ --libdir=lib \
53+ --with-zlib-lib=$zlib_prefix /lib \
54+ --with-zlib-include=$zlib_prefix /include
55+ make -j $( nproc) LD_LIBRARY_PATH= CC=" gcc"
56+ make install
57+ if [ -f " $OPENSSL_CONF_PATH " ]; then
58+ cp " $OPENSSL_CONF_PATH " " $OPENSSL_PREFIX " /ssl/openssl.cnf
59+ fi
60+ if [ " $ENABLE_FIPS " == " true" ]; then
61+ $OPENSSL_PREFIX /bin/openssl fipsinstall -out $OPENSSL_PREFIX /ssl/fipsmodule.cnf -module $OPENSSL_PREFIX /lib/ossl-modules/fips.so
62+ sed -i ' s@# .include fipsmodule.cnf@.include ' " $OPENSSL_PREFIX " ' /ssl/fipsmodule.cnf@g; s/# \(fips = fips_sect\)/\1\nbase = base_sect\n\n[base_sect]\nactivate=1\n/g' $OPENSSL_PREFIX /ssl/openssl.cnf
63+ fi
64+ cd ..
65+ }
66+
1767
1868if ([ $# -gt 0 ] && [ " $1 " == " latest" ]) || [ " $version " == " latest" ]; then
1969 debug_args=" --with-debug"
@@ -24,6 +74,9 @@ repo=$(basename "$prev_workdir")
2474workdir=$( mktemp -d)
2575cd " $workdir " || exit 1
2676
77+
78+ install_openssl_3
79+
2780wget --no-check-certificate https://openresty.org/download/openresty-${OPENRESTY_VERSION} .tar.gz
2881tar -zxvpf openresty-${OPENRESTY_VERSION} .tar.gz > /dev/null
2982
@@ -95,8 +148,7 @@ cd wasm-nginx-module-${wasm_nginx_module_ver} || exit 1
95148./install-wasmtime.sh
96149cd ..
97150
98- cc_opt=${cc_opt:- }
99- ld_opt=${ld_opt:- }
151+
100152luajit_xcflags=${luajit_xcflags:= " -DLUAJIT_NUMMODE=2 -DLUAJIT_ENABLE_LUA52COMPAT" }
101153no_pool_patch=${no_pool_patch:- }
102154# TODO: remove old NGX_HTTP_GRPC_CLI_ENGINE_PATH once we have released a new
126178 mv lua-resty-limit-traffic-$limit_ver bundle/lua-resty-limit-traffic-$or_limit_ver
127179fi
128180
181+
129182./configure --prefix=" $OR_PREFIX " \
130183 --with-cc-opt=" -DAPISIX_RUNTIME_VER=$runtime_version $grpc_engine_path $cc_opt " \
131184 --with-ld-opt=" -Wl,-rpath,$OR_PREFIX /wasmtime-c-api/lib $ld_opt " \
0 commit comments