代码拉取完成,页面将自动刷新
同步操作将从 Gitee 极速下载/lua-resty-ffi 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#!/usr/bin/env bash
set -euo pipefail
set -x
. /etc/os-release
export_openresty_variables() {
export openssl_prefix=/usr/local/openresty/openssl111
export zlib_prefix=/usr/local/openresty/zlib
export pcre_prefix=/usr/local/openresty/pcre
export cc_opt="-DNGX_LUA_ABORT_AT_PANIC -I${zlib_prefix}/include -I${pcre_prefix}/include -I${openssl_prefix}/include"
export 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"
}
prepare_centos() {
if [[ $(rpm --eval '%{centos_ver}') == "7" ]]; then
yum -y install centos-release-scl
yum -y install devtoolset-9 patch wget git make sudo
set +eu
source scl_source enable devtoolset-9
set -eu
elif [[ $(rpm --eval '%{centos_ver}') == "8" ]]; then
dnf install -y gcc-toolset-9-toolchain patch wget git make sudo
dnf install -y yum-utils
set +eu
source /opt/rh/gcc-toolset-9/enable
set -eu
fi
yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo
yum -y install openresty-openssl111-devel openresty-pcre-devel openresty-zlib-devel
}
prepare_debian() {
export DEBIAN_FRONTEND=noninteractive
apt update
apt -y install sudo git perl build-essential curl unzip
apt -y install --no-install-recommends wget gnupg ca-certificates
wget -O - https://openresty.org/package/pubkey.gpg | apt-key add -
if [[ $ID == "ubuntu" ]]; then
echo "deb http://openresty.org/package/ubuntu ${VERSION_CODENAME} main" > /etc/apt/sources.list.d/openresty.list
fi
if [[ $ID == "debian" ]]; then
echo "deb http://openresty.org/package/debian ${VERSION_CODENAME} openresty" > /etc/apt/sources.list.d/openresty.list
fi
apt update
apt install -y build-essential openresty-openssl111-dev openresty-pcre-dev openresty-zlib-dev
}
if [[ $ID == "centos" ]]; then
prepare_centos
else
prepare_debian
fi
export_openresty_variables
SRC=$PWD
mkdir -p /opt/resty_ffi/src
cd /opt/resty_ffi/src
wget https://openresty.org/download/openresty-1.21.4.1.tar.gz
tar zxf openresty-1.21.4.1.tar.gz
cd openresty-1.21.4.1/bundle/
for f in $SRC/patches/*; do
patch -p0 < $f
done
cp -a $SRC/ngx_http_lua_ffi.c ngx_lua-0.10.21/src/
cp -a $SRC/ffi.lua lua-resty-core-0.1.23/lib/resty/core/
cd ..
./configure --prefix=/opt/resty_ffi --with-threads --with-cc-opt="$cc_opt" --with-ld-opt="$ld_opt" $@
make install
# compile and install luarocks for luajit and openssl from openresty
cd /tmp
wget https://github.com/luarocks/luarocks/archive/v3.8.0.tar.gz
tar zxf v3.8.0.tar.gz
cd luarocks-3.8.0
./configure --with-lua=/opt/resty_ffi/luajit
make install
export PATH=$PATH:/usr/local/bin
mkdir ~/.luarocks
luarocks config variables.OPENSSL_LIBDIR /usr/local/openresty/openssl111/lib
luarocks config variables.OPENSSL_INCDIR /usr/local/openresty/openssl111/include
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。