pull/64/head
Alec Muffett 2020-06-08 08:00:43 +00:00
rodzic 9203eced6b
commit b6ed79d4e3
1 zmienionych plików z 22 dodań i 49 usunięć

Wyświetl plik

@ -1,66 +1,43 @@
#!/bin/sh -x
keyserver=keyserver.ubuntu.com
ngxversion=1.16.1
ngxsigningkey=B0F4253373F8F6F510D42178520A9993A1C052F8
# docs: https://github.com/openresty/lua-nginx-module#installation
luaurl="https://github.com/openresty/luajit2.git"
orversion=1.15.8.3
# All the releases are signed by the public PGP key A0E98066 of Yichun Zhang.
MODS="
https://github.com/openresty/headers-more-nginx-module.git
https://github.com/openresty/lua-nginx-module.git
https://github.com/simpl/ngx_devel_kit.git
https://github.com/yaoweibin/ngx_http_substitutions_filter_module.git
"
OPTS="
--with-http_sub_module
--with-http_ssl_module
"
# install dir
opt_dir=`dirname $0`
opt_dir=/tmp/foo # CHANGE THIS !!!!!!
cd $opt_dir || exit 1
opt_dir=`pwd`
# dependencies
# CHANGE THIS # sudo aptitude install -y libpcre3-dev zlib1g-dev libssl1.0.2 libssl1.0-dev dirmngr || exit 1
sudo aptitude install -y libpcre3-dev zlib1g-dev libssl1.0.2 libssl1.0-dev dirmngr || exit 1
# get NGINX and cd into it
ngxurl=http://nginx.org/download/nginx-$ngxversion.tar.gz
ngxsigurl=http://nginx.org/download/nginx-$ngxversion.tar.gz.asc
ngxfile=`basename "$ngxurl"`
ngxsig=`basename "$ngxsigurl"`
ngxdir=`basename "$ngxfile" .tar.gz`
test -f "$ngxfile" || curl -o "$ngxfile" "$ngxurl" || exit 1
test -f $ngxsig || curl -o $ngxsig $ngxsigurl || exit 1
gpg --keyserver hkp://$keyserver:80 --recv-keys $ngxsigningkey || exit 1
gpg --verify $ngxsig || exit 1
test -d "$ngxdir" || tar zxf "$ngxfile" || exit 1
cd $ngxdir || exit 1
# get OpenResty and cd into it
orurl=https://openresty.org/download/openresty-$orversion.tar.gz
orsigurl=https://openresty.org/download/openresty-1.15.8.3.tar.gz.asc
orfile=`basename "$orurl"`
orsig=`basename "$orsigurl"`
ordir=`basename "$orfile" .tar.gz`
test -f "$orfile" || curl -o "$orfile" "$orurl" || exit 1
test -f "$orsig" || curl -o "$orsig" "$orsigurl" || exit 1
#gpg --keyserver hkp://$keyserver:80 --recv-keys $ngxsigningkey || exit 1
#gpg --verify $ngxsig || exit 1
test -d "$ordir" || tar zxf "$orfile" || exit 1
# build dir
cd $ordir || exit 1
src_dir=`pwd`
# make luajit
luadir=`basename $luaurl .git`
if [ -d $luadir ] ; then
( cd $luadir ; exec git pull ) || exit 1
else
git clone $luaurl || exit 1
fi
cd $luadir || exit 1
make DESTDIR=$opt_dir install || exit 1
cd $src_dir || exit 1
# get mods
MODADD=""
for modurl in $MODS ; do
@ -73,15 +50,11 @@ for modurl in $MODS ; do
MODADD="$MODADD --add-module=$src_dir/$moddir"
done
# make NGINX
export LUAJIT_LIB=$opt_dir/usr/local/lib
export LUAJIT_INC=$opt_dir/usr/local/include/luajit-2.1
# --with-cc-opt="-fPIE -fstack-protector-strong -fexceptions -D_FORTIFY_SOURCE=2" \
# --with-ld-opt="-Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now -Wl,-rpath,$LUAJIT_LIB" \
env \
./configure \
--with-cc-opt="-fPIE -fstack-protector-strong -fexceptions -D_FORTIFY_SOURCE=2" \
--with-ld-opt="-Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now -Wl,-rpath,$LUAJIT_LIB" \
--prefix=$opt_dir \
$OPTS \
$MODADD || exit 1
@ -92,11 +65,11 @@ make install || exit 1
cd $opt_dir || exit 1
ln -sf sbin/nginx || exit 1
ln -sf nginx/sbin/nginx || exit 1
# cleanup
: rm -rf $ngxfile $ngxsig $ngxdir
: rm -rf $orfile $orsig $ordir
# done