clean up readme and build script

This commit is contained in:
Lily Tsuru 2024-09-16 00:24:22 -04:00
parent 635efc8350
commit 0435cc9a2c
2 changed files with 23 additions and 19 deletions

View file

@ -1,6 +1,8 @@
# `nginx-cn` # `nginx-cn`
Our build of NGINX we use. Precompiled with OpenResty core and several other useful modules. Our build of NGINX used on computernewb
Essentially, this is OpenResty core (and a few Lua modules we actually use), and several other useful modules.
# Build/installaction instructions # Build/installaction instructions

38
build
View file

@ -1,19 +1,19 @@
#!/bin/bash #!/bin/bash
# installation prefix. unfortunately we have to vendor # installation prefix. unfortunately we have to vendor
# certains dependencies (luajit) so this /opt path is # certain dependencies (luajit) so this /opt path is
# (probably) going to unfortunately stick. # (probably) going to unfortunately stick.
PREFIX="/opt/nginx" PREFIX="/opt/nginx"
TOP="$(pwd)" TOP="$(pwd)"
# clean Nginx sources # clean Nginx sources beforehand.
pushd sources/nginx/ pushd sources/nginx/
echo "cleaning nginx sources" echo "cleaning nginx sources"
git clean -dxf git clean -dxf
popd popd
BASE_CONFIGURE_FLAGS=( local BASE_CONFIGURE_FLAGS=(
# Build everything with Clang + ThinLTO # Build everything with Clang + ThinLTO
--with-cc="clang" --with-cc="clang"
--with-cc-opt="-pipe -march=native -mtune=native -flto=thin" --with-cc-opt="-pipe -march=native -mtune=native -flto=thin"
@ -57,7 +57,7 @@ BASE_CONFIGURE_FLAGS=(
--with-stream_ssl_preread_module --with-stream_ssl_preread_module
--with-threads --with-threads
# Add modules into the build we use # Add modules into the build
--add-module=$TOP/sources/modules/nginx-module-vts --add-module=$TOP/sources/modules/nginx-module-vts
--add-module=$TOP/sources/modules/ngx-fancyindex --add-module=$TOP/sources/modules/ngx-fancyindex
--add-module=$TOP/sources/modules/lua-nginx-module --add-module=$TOP/sources/modules/lua-nginx-module
@ -65,7 +65,8 @@ BASE_CONFIGURE_FLAGS=(
# --add-module=$TOP/modules/nginx-dav-ext-module # --add-module=$TOP/modules/nginx-dav-ext-module
) )
# Do a dummy config of cloudflare zlib so nginx build can actually distclean and do what it wants.. # Do a dummy config of cloudflare zlib so nginx build can actually distclean (which it does for some reason)..
# I wish it didn't try that but oh well.
pushd $TOP/sources/cf-zlib pushd $TOP/sources/cf-zlib
CFLAGS="-O3 -march=native -mtune=native -pipe -flto=thin -pipe" CC="clang" \ CFLAGS="-O3 -march=native -mtune=native -pipe -flto=thin -pipe" CC="clang" \
./configure ./configure
@ -78,17 +79,18 @@ pushd $TOP/sources/luajit2
sudo make PREFIX=$PREFIX install sudo make PREFIX=$PREFIX install
popd popd
pushd $TOP/sources/lua-resty-core # resty libs that can be installed
sudo make install PREFIX=$PREFIX local RESTY_LIBS=(
popd lua-resty-{core,lrucache,websocket}
)
pushd $TOP/sources/lua-resty-lrucache # install resty libs
sudo make install PREFIX=$PREFIX for lib in ${RESTY_LIBS[@]}; do
popd echo "installing $lib"
pushd $TOP/sources/$lib
pushd $TOP/sources/lua-resty-websocket sudo make install PREFIX=$PREFIX
sudo make install PREFIX=$PREFIX popd
popd done
pushd $TOP/sources/nginx pushd $TOP/sources/nginx
@ -100,7 +102,7 @@ export LUAJIT_LIB="$PREFIX/lib"
./auto/configure \ ./auto/configure \
--prefix=$PREFIX/etc/nginx \ --prefix=$PREFIX/etc/nginx \
--conf-path=$PREFIX/etc/nginx/nginx.conf \ --conf-path=$PREFIX/etc/nginx/nginx.conf \
--sbin-path=$PREFIX/usr/bin/nginx \ --sbin-path=$PREFIX/bin/nginx \
--pid-path=/run/nginx.pid \ --pid-path=/run/nginx.pid \
--lock-path=/run/lock/nginx.lock \ --lock-path=/run/lock/nginx.lock \
--user=http \ --user=http \