From 0435cc9a2cfdbe8e9caf97565cc036bd0a7577b6 Mon Sep 17 00:00:00 2001 From: modeco80 Date: Mon, 16 Sep 2024 00:24:22 -0400 Subject: [PATCH] clean up readme and build script --- README.md | 4 +++- build | 38 ++++++++++++++++++++------------------ 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 392b48d..7634382 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/build b/build index 2124530..9998f1c 100755 --- a/build +++ b/build @@ -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 \