From 75709cce7e98e5984f521a0b9941651b52735baa Mon Sep 17 00:00:00 2001 From: Stefan Budeanu Date: Thu, 3 Mar 2016 16:38:24 -0500 Subject: [PATCH 1/2] build: correctly detect clang version Use the "Apple LLVM" version number since the banner has changed in newer versions of Mac OS X, resulting in the obsolete assembler path being used to compile OpenSSL. --- configure | 11 +++++++++-- deps/openssl/openssl.gyp | 1 + deps/openssl/openssl.gypi | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/configure b/configure index 989a5f0c0e9756..8efbd87a20dccc 100755 --- a/configure +++ b/configure @@ -441,7 +441,7 @@ def try_check_compiler(cc, lang): # Commands and regular expressions to obtain its version number are taken from # https://github.com/openssl/openssl/blob/OpenSSL_1_0_2-stable/crypto/sha/asm/sha512-x86_64.pl#L112-L129 # -def get_llvm_version(cc): +def get_version_helper(cc, regexp): try: proc = subprocess.Popen(shlex.split(cc) + ['-v'], stdin=subprocess.PIPE, stderr=subprocess.PIPE, stdout=subprocess.PIPE) @@ -454,7 +454,7 @@ def get_llvm_version(cc): ''' sys.exit() - match = re.search(r"(^clang version|based on LLVM) ([3-9]\.[0-9]+)", + match = re.search(regexp, proc.communicate()[1]) if match: @@ -462,6 +462,11 @@ def get_llvm_version(cc): else: return 0 +def get_llvm_version(cc): + return get_version_helper(cc, r"(^clang version|based on LLVM) ([3-9]\.[0-9]+)") + +def get_xcode_version(cc): + return get_version_helper(cc, r"(^Apple LLVM version) ([5-9]\.[0-9]+)") def get_gas_version(cc): try: @@ -516,6 +521,8 @@ def check_compiler(o): if is_clang: o['variables']['llvm_version'] = get_llvm_version(CC) + if sys.platform == 'darwin': + o['variables']['xcode_version'] = get_xcode_version(CC) else: o['variables']['gas_version'] = get_gas_version(CC) diff --git a/deps/openssl/openssl.gyp b/deps/openssl/openssl.gyp index 3a319d91f0df7a..db57033d54e20e 100644 --- a/deps/openssl/openssl.gyp +++ b/deps/openssl/openssl.gyp @@ -8,6 +8,7 @@ 'gcc_version': 0, 'openssl_no_asm%': 0, 'llvm_version%': 0, + 'xcode_version%': 0, 'gas_version%': 0, 'openssl_fips%': 'false', }, diff --git a/deps/openssl/openssl.gypi b/deps/openssl/openssl.gypi index e2e06d8333172c..c3824a632a0b81 100644 --- a/deps/openssl/openssl.gypi +++ b/deps/openssl/openssl.gypi @@ -1040,7 +1040,7 @@ # 'conditions': [ ['(OS=="win" and MSVS_VERSION>="2012") or ' - 'llvm_version>="3.3" or gas_version>="2.23"', { + 'llvm_version>="3.3" or xcode_version>="5.0" or gas_version>="2.23"', { 'openssl_sources_x64_win_masm': [ '<@(openssl_sources_asm_latest_x64_win_masm)', '<@(openssl_sources_common_x64_win_masm)', From a25fd93cdcb8e2b4f3cf5797f4e4ad519a9ae027 Mon Sep 17 00:00:00 2001 From: Stefan Budeanu Date: Fri, 4 Mar 2016 11:15:11 -0500 Subject: [PATCH 2/2] WIP: Stype per PEP-0008 --- configure | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 8efbd87a20dccc..2d767c77e3e819 100755 --- a/configure +++ b/configure @@ -454,8 +454,7 @@ def get_version_helper(cc, regexp): ''' sys.exit() - match = re.search(regexp, - proc.communicate()[1]) + match = re.search(regexp, proc.communicate()[1]) if match: return match.group(2) @@ -463,10 +462,12 @@ def get_version_helper(cc, regexp): return 0 def get_llvm_version(cc): - return get_version_helper(cc, r"(^clang version|based on LLVM) ([3-9]\.[0-9]+)") + return get_version_helper( + cc, r"(^clang version|based on LLVM) ([3-9]\.[0-9]+)") def get_xcode_version(cc): - return get_version_helper(cc, r"(^Apple LLVM version) ([5-9]\.[0-9]+)") + return get_version_helper( + cc, r"(^Apple LLVM version) ([5-9]\.[0-9]+)") def get_gas_version(cc): try: