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`
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

38
build
View file

@ -1,19 +1,19 @@
#!/bin/bash
# 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.
PREFIX="/opt/nginx"
TOP="$(pwd)"
# clean Nginx sources
# clean Nginx sources beforehand.
pushd sources/nginx/
echo "cleaning nginx sources"
git clean -dxf
echo "cleaning nginx sources"
git clean -dxf
popd
BASE_CONFIGURE_FLAGS=(
local BASE_CONFIGURE_FLAGS=(
# Build everything with Clang + ThinLTO
--with-cc="clang"
--with-cc-opt="-pipe -march=native -mtune=native -flto=thin"
@ -57,7 +57,7 @@ BASE_CONFIGURE_FLAGS=(
--with-stream_ssl_preread_module
--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/ngx-fancyindex
--add-module=$TOP/sources/modules/lua-nginx-module
@ -65,7 +65,8 @@ BASE_CONFIGURE_FLAGS=(
# --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
CFLAGS="-O3 -march=native -mtune=native -pipe -flto=thin -pipe" CC="clang" \
./configure
@ -78,17 +79,18 @@ pushd $TOP/sources/luajit2
sudo make PREFIX=$PREFIX install
popd
pushd $TOP/sources/lua-resty-core
sudo make install PREFIX=$PREFIX
popd
# resty libs that can be installed
local RESTY_LIBS=(
lua-resty-{core,lrucache,websocket}
)
pushd $TOP/sources/lua-resty-lrucache
sudo make install PREFIX=$PREFIX
popd
pushd $TOP/sources/lua-resty-websocket
sudo make install PREFIX=$PREFIX
popd
# install resty libs
for lib in ${RESTY_LIBS[@]}; do
echo "installing $lib"
pushd $TOP/sources/$lib
sudo make install PREFIX=$PREFIX
popd
done
pushd $TOP/sources/nginx
@ -100,7 +102,7 @@ export LUAJIT_LIB="$PREFIX/lib"
./auto/configure \
--prefix=$PREFIX/etc/nginx \
--conf-path=$PREFIX/etc/nginx/nginx.conf \
--sbin-path=$PREFIX/usr/bin/nginx \
--sbin-path=$PREFIX/bin/nginx \
--pid-path=/run/nginx.pid \
--lock-path=/run/lock/nginx.lock \
--user=http \