Skip to content

Commit

Permalink
add optional Clang 4.0 support for Nginx compiles in 123.09beta01
Browse files Browse the repository at this point in the history
For CentOS 7 where CLANG_FOUR='y' is set in persist config file at /etc/centminmod/custom_config.inc, will enable Clang 4.0 detection support. If custom Clang 4.0 binary is detected at /opt/sbin/llvm/bin/clang, and CLANG_FOUR='y set, then Nginx will compile with Clang 4.0 instead of Clang 3.4.2 when CLANG='y' is set (default). Details https://community.centminmod.com/posts/44039/
  • Loading branch information
centminmod committed Jan 31, 2017
1 parent d9e03a9 commit 773c426
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
1 change: 1 addition & 0 deletions centmin.sh
Expand Up @@ -287,6 +287,7 @@ CCACHESIZE='2.2G'
PARALLEL_MODE=y
# compiler related
CLANG='y' # Nginx and LibreSSL
CLANG_FOUR='n' # Clang 4.0+ optional support https://community.centminmod.com/posts/44039/
CLANG_PHP='n' # PHP
CLANG_APC='n' # APC Cache
CLANG_MEMCACHED='n' # Memcached menu option 10 routine
Expand Down
1 change: 1 addition & 0 deletions example/custom_config.inc
Expand Up @@ -18,6 +18,7 @@ ENABLEMOTD_LINKSMSG='y' # motd centminmod.com links bookmark alert display

# Clang & GCC Compilers
CLANG='y' # Nginx and LibreSSL
CLANG_FOUR='n' # Clang 4.0+ optional support https://community.centminmod.com/posts/44039/
CLANG_PHP='n' # PHP
CLANG_APC='n' # APC Cache
CLANG_MEMCACHED='n' # Memcached menu option 10 routine
Expand Down
33 changes: 32 additions & 1 deletion inc/nginx_configure.inc
Expand Up @@ -2008,7 +2008,36 @@ if [[ "$CLANG" = [yY] ]]; then
# ccache compiler has some initial overhead for compiles but speeds up subsequent
# recompiles. however on initial install ccache has no benefits, so for initial
# centmin mod install disabling ccache will in theory speed up first time installs
if [[ "$INITIALINSTALL" != [yY] ]]; then

if [[ "CENTOS_SEVEN" = '7' && "$CLANG_FOUR" = [yY] && -f /opt/sbin/llvm/bin/clang ]]; then
############################
if [[ "$INITIALINSTALL" != [yY] ]]; then
export CC="ccache /opt/sbin/llvm/bin/clang -ferror-limit=0${CCTOOLSET}"
export CXX="ccache /opt/sbin/llvm/bin/clang++ -ferror-limit=0"
export CCACHE_CPP2=yes
CLANG_CCOPT=' -Wno-sign-compare -Wno-string-plus-int -Wno-deprecated-declarations -Wno-unused-parameter -Wno-unused-const-variable -Wno-conditional-uninitialized -Wno-mismatched-tags -Wno-sometimes-uninitialized -Wno-parentheses-equality -Wno-tautological-compare -Wno-self-assign -Wno-deprecated-register -Wno-deprecated -Wno-invalid-source-encoding -Wno-pointer-sign -Wno-parentheses -Wno-enum-conversion -Wno-c++11-compat-deprecated-writable-strings -Wno-write-strings'
echo "
export CC=\"ccache /opt/sbin/llvm/bin/clang -ferror-limit=0${CCTOOLSET}\"
export CXX=\"ccache /opt/sbin/llvm/bin/clang++ -ferror-limit=0\"
export CCACHE_CPP2=yes
CLANG_CCOPT=' -Wno-sign-compare -Wno-string-plus-int -Wno-deprecated-declarations -Wno-unused-parameter -Wno-unused-const-variable -Wno-conditional-uninitialized -Wno-mismatched-tags -Wno-sometimes-uninitialized -Wno-parentheses-equality -Wno-tautological-compare -Wno-self-assign -Wno-deprecated-register -Wno-deprecated -Wno-invalid-source-encoding -Wno-pointer-sign -Wno-parentheses -Wno-enum-conversion -Wno-c++11-compat-deprecated-writable-strings -Wno-write-strings'"
else
export CC="/opt/sbin/llvm/bin/clang -ferror-limit=0${CCTOOLSET}"
export CXX="/opt/sbin/llvm/bin/clang++ -ferror-limit=0"
# export CCACHE_CPP2=yes
CLANG_CCOPT=' -Wno-sign-compare -Wno-string-plus-int -Wno-deprecated-declarations -Wno-unused-parameter -Wno-unused-const-variable -Wno-conditional-uninitialized -Wno-mismatched-tags -Wno-sometimes-uninitialized -Wno-parentheses-equality -Wno-tautological-compare -Wno-self-assign -Wno-deprecated-register -Wno-deprecated -Wno-invalid-source-encoding -Wno-pointer-sign -Wno-parentheses -Wno-enum-conversion -Wno-c++11-compat-deprecated-writable-strings -Wno-write-strings'
echo "
export CC=\"/opt/sbin/llvm/bin/clang -ferror-limit=0${CCTOOLSET}\"
export CXX=\"/opt/sbin/llvm/bin/clang++ -ferror-limit=0\"
# export CCACHE_CPP2=yes
CLANG_CCOPT=' -Wno-sign-compare -Wno-string-plus-int -Wno-deprecated-declarations -Wno-unused-parameter -Wno-unused-const-variable -Wno-conditional-uninitialized -Wno-mismatched-tags -Wno-sometimes-uninitialized -Wno-parentheses-equality -Wno-tautological-compare -Wno-self-assign -Wno-deprecated-register -Wno-deprecated -Wno-invalid-source-encoding -Wno-pointer-sign -Wno-parentheses -Wno-enum-conversion -Wno-c++11-compat-deprecated-writable-strings -Wno-write-strings'"
fi
############################
## clang 4.0 else
else
## clang 4.0 else
############################
if [[ "$INITIALINSTALL" != [yY] ]]; then
export CC="ccache /usr/bin/clang -ferror-limit=0${CCTOOLSET}"
export CXX="ccache /usr/bin/clang++ -ferror-limit=0"
export CCACHE_CPP2=yes
Expand All @@ -2029,6 +2058,8 @@ export CXX=\"/usr/bin/clang++ -ferror-limit=0\"
# export CCACHE_CPP2=yes
CLANG_CCOPT=' -Wno-sign-compare -Wno-string-plus-int -Wno-deprecated-declarations -Wno-unused-parameter -Wno-unused-const-variable -Wno-conditional-uninitialized -Wno-mismatched-tags -Wno-sometimes-uninitialized -Wno-parentheses-equality -Wno-tautological-compare -Wno-self-assign -Wno-deprecated-register -Wno-deprecated -Wno-invalid-source-encoding -Wno-pointer-sign -Wno-parentheses -Wno-enum-conversion -Wno-c++11-compat-deprecated-writable-strings -Wno-write-strings'"
fi
############################
fi # clang 4.0
else
CLANG_CCOPT=""
echo "CLANG_CCOPT=\"\""
Expand Down

0 comments on commit 773c426

Please sign in to comment.