Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
build: always use strings for compiler version in gyp files
If GYP finds a string variable that can be converted to an integer,
it will do it when the variable is expanded. Use "0.0" instead of "0"
to force strings and be able to use comparison operations such as
`gas_version >= "2.26"` in Python 3.
  • Loading branch information
targos committed Oct 11, 2019
commit ca10dff0cb23342ba512ae2495291e6457a54edb
12 changes: 6 additions & 6 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ def get_version_helper(cc, regexp):
if match:
return match.group(2)
else:
return '0'
return '0.0'

def get_nasm_version(asm):
try:
Expand All @@ -714,15 +714,15 @@ def get_nasm_version(asm):
warn('''No acceptable ASM compiler found!
Please make sure you have installed NASM from https://www.nasm.us
and refer BUILDING.md.''')
return '0'
return '0.0'

match = re.match(r"NASM version ([2-9]\.[0-9][0-9]+)",
to_utf8(proc.communicate()[0]))

if match:
return match.group(1)
else:
return '0'
return '0.0'

def get_llvm_version(cc):
return get_version_helper(
Expand Down Expand Up @@ -755,7 +755,7 @@ def get_gas_version(cc):
return match.group(1)
else:
warn('Could not recognize `gas`: ' + gas_ret)
return '0'
return '0.0'

# Note: Apple clang self-reports as clang 4.2.0 and gcc 4.2.1. It passes
# the version check more by accident than anything else but a more rigorous
Expand All @@ -766,7 +766,7 @@ def check_compiler(o):
if not options.openssl_no_asm and options.dest_cpu in ('x86', 'x64'):
nasm_version = get_nasm_version('nasm')
o['variables']['nasm_version'] = nasm_version
if nasm_version == 0:
if nasm_version == '0.0':
o['variables']['openssl_no_asm'] = 1
return

Expand All @@ -785,7 +785,7 @@ def check_compiler(o):
# to a version that is not completely ancient.
warn('C compiler too old, need gcc 4.2 or clang 3.2 (CC=%s)' % CC)

o['variables']['llvm_version'] = get_llvm_version(CC) if is_clang else 0
o['variables']['llvm_version'] = get_llvm_version(CC) if is_clang else '0.0'

# Need xcode_version or gas_version when openssl asm files are compiled.
if options.without_ssl or options.openssl_no_asm or options.shared_openssl:
Expand Down
6 changes: 3 additions & 3 deletions deps/openssl/openssl.gyp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
'variables': {
'gas_version%': 0,
'llvm_version%': 0,
'nasm_version%': 0,
'gas_version%': '0.0',
'llvm_version%': '0.0',
'nasm_version%': '0.0',
},
'targets': [
{
Expand Down
2 changes: 1 addition & 1 deletion deps/openssl/openssl_common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
'TERMIOS',
],
'conditions': [
[ 'llvm_version==0', {
[ 'llvm_version=="0.0"', {
'cflags': ['-Wno-old-style-declaration',],
}],
],
Expand Down
2 changes: 1 addition & 1 deletion node.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@
'-Wl,-bnoerrmsg',
],
}],
['(OS=="linux" or OS=="mac") and llvm_version!=0', {
['OS in ("linux", "mac") and llvm_version != "0.0"', {
'libraries': ['-latomic'],
}],
],
Expand Down