Skip to content

Instantly share code, notes, and snippets.

@xeioex
Created September 19, 2023 21:49
Show Gist options
  • Save xeioex/b7162e6110e675ccdca565996847dbb4 to your computer and use it in GitHub Desktop.
Save xeioex/b7162e6110e675ccdca565996847dbb4 to your computer and use it in GitHub Desktop.
#!/bin/sh
SRC=$PWD
BBUILD=/tmp/build/nginx/
mkdir -p $BBUILD
rm -fr "$BBUILD/*"
BUILD="$BBUILD/$1"
mkdir -p "$BUILD"
NGX_MODS_SAFE="--with-http_ssl_module
--with-http_v2_module
--with-http_dav_module
--with-http_random_index_module
--with-http_flv_module
--with-http_mp4_module
--with-http_realip_module
--with-http_secure_link_module
--with-http_gunzip_module
--with-http_gzip_static_module
--with-http_stub_status_module
--with-http_sub_module
--with-http_auth_request_module
--with-http_addition_module
--with-file-aio
--with-threads
--with-stream
--with-stream_ssl_module"
# NOT IN luaresty
# --with-http_geoip_module
# --with-http_slice_module
# --with-http_geoip_module
# --with-http_image_filter_module
# --with-http_xslt_module
NGX_MODS_TEST_BUILD="
--test-build-devpoll
--test-build-eventport
--test-build-solaris-sendfilev"
NGX_MODS_UNSAFE="
--with-http_perl_module
--with-perl_modules_path=$BUILD/build/pm"
NGX_MODS_EXCLUDE="
--without-http_charset_module
--without-http_gzip_module
--without-http_ssi_module
--without-http_userid_module
--without-http_access_module
--without-http_auth_basic_module
--without-http_autoindex_module
--without-http_status_module
--without-http_map_module
--without-http_split_clients_module
--without-http_referer_module
--without-http_fastcgi_module
--without-http_uwsgi_module
--without-http_scgi_module
--without-http_memcached_module
--without-http_limit_conn_module
--without-http_limit_req_module
--without-http_empty_gif_module
--without-http_browser_module
--without-http_upstream_hash_module
--without-http_upstream_ip_hash_module
--without-http_upstream_least_conn_module
--without-http_upstream_zone_module"
# --without-http_upstream_keepalive_module
# --without-http_upstream_zone_module
NGX_CC_OPT="-O0 -DNGX_DEBUG_MALLOC=1 -DNGX_DEBUG_PALLOC=1"
NGX_OPT="--with-debug --build=$BUILD --builddir=$SRC/objs"
NGX_MODS="$NGX_MODS_SAFE"
echo "arg1:$1 arg2:$2"
case $1 in
nginx)
shift
;;
nginx-ipv4)
shift
;;
nginx-se)
echo "using nginx-se"
NGX_MODS="$NGX_MODS
--with-http_auth_jwt_module
--with-http_hls_module"
shift
;;
esac
case "$1" in
clang)
echo "COMPILER:$COMPILER"
NGX_CC=$COMPILER
shift
;;
bench)
NGX_CC=$COMPILER
NGX_CC_OPT="-O2"
NGX_LD_OPT=""
NGX_MODS="$NGX_MODS $NGX_MODS_EXCLUDE"
shift
;;
gcc)
NGX_CC=gcc-12
#NGX_CC_OPT="-O0 -g -fsanitize=address"
#NGX_LD_OPT="-fsanitize=address"
NGX_CC_OPT="-O0 -g"
NGX_LD_OPT=""
shift
;;
gcov)
NGX_CC=gcc-12
NGX_CC_OPT="$NGX_CC_OPT -fprofile-arcs -ftest-coverage -O0"
NGX_LD_OPT="-lgcov --coverage"
shift
;;
sanitizer)
NGX_CC=gcc-12
# disabled: -fsanitize=undefined -fno-sanitize=nonnull-attribute -fno-sanitize=alignment
NGX_CC_OPT="$NGX_CC_OPT -fdiagnostics-color=auto -fsanitize=address"
NGX_LD_OPT="-fsanitize=address -fsanitize=undefined"
shift
;;
esac
echo "$SRC/auto/configure --with-cc=\"$NGX_CC\" \
--with-cc-opt=\"$NGX_CC_OPT\" \
--with-ld-opt=\"$NGX_LD_OPT\" \
$NGX_OPT $NGX_MODS $@"
$SRC/auto/configure \
--with-cc="$NGX_CC" \
--with-cc-opt="$NGX_CC_OPT" \
--with-ld-opt="$NGX_LD_OPT" \
$NGX_OPT $NGX_MODS $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment