From 773c4265ffe273cb265fad8e1e382cac479c29a8 Mon Sep 17 00:00:00 2001 From: George Liu Date: Tue, 31 Jan 2017 11:02:52 +1000 Subject: [PATCH] add optional Clang 4.0 support for Nginx compiles in 123.09beta01 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/ --- centmin.sh | 1 + example/custom_config.inc | 1 + inc/nginx_configure.inc | 33 ++++++++++++++++++++++++++++++++- 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/centmin.sh b/centmin.sh index 3fdab8f68..3a73194dd 100755 --- a/centmin.sh +++ b/centmin.sh @@ -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 diff --git a/example/custom_config.inc b/example/custom_config.inc index e2d85f151..959cfcf33 100644 --- a/example/custom_config.inc +++ b/example/custom_config.inc @@ -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 diff --git a/inc/nginx_configure.inc b/inc/nginx_configure.inc index 4d11e85a6..0056f1949 100644 --- a/inc/nginx_configure.inc +++ b/inc/nginx_configure.inc @@ -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 @@ -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=\"\""