nginx_build_script build_gitea : refactor:

nginx_build_script -> add: arguments to include/not include ModSecurity Lua in build.
					  add: Ninja for BoringSSL build.
					  refactor: use seperated params for ./auto/configure arguments.
					  refactor: build modules.conf directly instead of curl from internet.
					  fix: BoringSSL is disappeared from code for some reason.

build_gitea 	   -> refactor: arguments handling.
					  fix: correctly handle BUILD_STATIC as boolean.
This commit is contained in:
minoplhy 2024-04-27 22:38:20 +07:00
parent 542edd1bbc
commit f21da7115a
Signed by: minoplhy
GPG Key ID: 41D406044E2434BF
4 changed files with 206 additions and 92 deletions

View File

@ -7,14 +7,27 @@ rm -rf $DESTINATION
mkdir -p $DESTINATION
cd $MAKE_DIR
while getopts 'v:g:n:s' flag
do
case "${flag}" in
v) GITEA_GIT_TAG=${OPTARG};; # Gitea Git Tag
g) GO_VERSION=${OPTARG};; # GOLANG Version
n) NODEJS_VERSION=${OPTARG};; # NodeJS Version
s) BUILD_STATIC="True";; # Build as Static Assets file
while [ ${#} -gt 0 ]; do
case "$1" in
--git-tag | -v)
shift
GITEA_GIT_TAG=$1
;; # Gitea Git Tag
--golang-version | -g)
shift
GO_VERSION=$1
;; # GOLANG Version
--nodejs-version | -n)
shift
NODEJS_VERSION=$1
;; # NodeJS Version
--static | -s)
BUILD_STATIC=true
;; # Build as Static Assets file
*)
;;
esac
shift # Shift to next response for parsing
done
# GITEA_GIT_TAG is being process below
@ -72,7 +85,7 @@ fi
export NODE_MAX_CONCURRENCY=1
export GOMAXPROCS=1
if [[ "$BUILD_STATIC" == "True" ]]
if [[ "$BUILD_STATIC" == true ]]
then
mkdir -p $DESTINATION/gitea-static
LDFLAGS="-X \"code.gitea.io/gitea/modules/setting.AppWorkPath=/var/lib/gitea/\" -X \"code.gitea.io/gitea/modules/setting.CustomConf=/etc/gitea/app.ini\"" TAGS="bindata sqlite sqlite_unlock_notify" GOOS=linux GOARCH=amd64 make frontend

View File

@ -13,10 +13,28 @@ curl -L https://github.com/minoplhy/scriptbox/raw/main/build_gitea/Linux/build.s
# Arguments
```bash
v) GITEA_GIT_TAG=${OPTARG};; # Gitea Git Tag
g) GO_VERSION=${OPTARG};; # GOLANG Version
n) NODEJS_VERSION=${OPTARG};; # NodeJS Version
s) BUILD_STATIC="True";; # Build as Static Assets file
while [ ${#} -gt 0 ]; do
case "$1" in
--git-tag | -v)
shift
GITEA_GIT_TAG=$1
;; # Gitea Git Tag
--golang-version | -g)
shift
GO_VERSION=$1
;; # GOLANG Version
--nodejs-version | -n)
shift
NODEJS_VERSION=$1
;; # NodeJS Version
--static | -s)
BUILD_STATIC=true
;; # Build as Static Assets file
*)
;;
esac
shift # Shift to next response for parsing
done
```
# Known Issues

View File

@ -2,12 +2,29 @@
The script here is entirely copied from [minoplhy/nginquic](https://github.com/minoplhy/nginquic)@ModSecurity_incl. Which included ModSecurity for my own using.
```shell
```bash
export Nginx_Install=yes # This variable is required if you want Nginx to be installed scriptibly (on Debian-based systems).
curl https://raw.githubusercontent.com/minoplhy/scriptbox/main/nginx_build_script/build.sh > ~/nginx_scriptbox.sh
bash ~/nginx_scriptbox.sh
```
# Arguments
```bash
while [ ${#} -gt 0 ]; do
case "$1" in
--no-modsecurity | -nm )
DISABLE_MODSECURITY=true # Not include ModSecurity in building
;;
--no-lua | -nl )
DISABLE_LUA=true # Not include Lua in building
;;
*)
;;
esac
shift
done
```
#### Note : don't forgot to add necessary `lua_package_path` directive to `nginx.conf`, in the http context. else Nginx won't run.
```lua
lua_package_path "/usr/local/lua/?.lua;;';

File diff suppressed because it is too large Load Diff