Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: correctly detect clang version #5553

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -454,14 +454,20 @@ def get_llvm_version(cc):
'''
sys.exit()

match = re.search(r"(^clang version|based on LLVM) ([3-9]\.[0-9]+)",
proc.communicate()[1])
match = re.search(regexp, proc.communicate()[1])

if match:
return match.group(2)
else:
return 0

def get_llvm_version(cc):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Long line.

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:
Expand Down Expand Up @@ -516,6 +522,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)

Expand Down
1 change: 1 addition & 0 deletions deps/openssl/openssl.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
'gcc_version': 0,
'openssl_no_asm%': 0,
'llvm_version%': 0,
'xcode_version%': 0,
'gas_version%': 0,
'openssl_fips%': 'false',
},
Expand Down
2 changes: 1 addition & 1 deletion deps/openssl/openssl.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -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)',
Expand Down