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

Upgrade to openssl-1.0.2a (Part2: final) #1389

Closed
wants to merge 16 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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
90 changes: 72 additions & 18 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -357,11 +357,63 @@ def try_check_compiler(cc, lang):
return (True, is_clang, clang_version, gcc_version)


#
# The version of asm compiler is needed for building openssl asm files.
# See deps/openssl/openssl.gypi for detail.
# Commands and reglar expressions to obtain its version number is 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):
try:
proc = subprocess.Popen(shlex.split(cc) + ['-v'], stdin=subprocess.PIPE,
stderr=subprocess.PIPE, stdout=subprocess.PIPE)
except OSError:
print '''io.js configure error: No acceptable C compiler found!

Please make sure you have a C compiler installed on your system and/or
consider adjusting the CC environment variable if you installed
it in a non-standard prefix.
'''
sys.exit()

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

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


def get_gas_version(cc):
try:
proc = subprocess.Popen(shlex.split(cc) + ['-Wa,-v', '-c', '-o',
'/dev/null', '-x',
'assembler', '/dev/null'],
stdin=subprocess.PIPE, stderr=subprocess.PIPE,
stdout=subprocess.PIPE)
except OSError:
print '''io.js configure error: No acceptable C compiler found!

Please make sure you have a C compiler installed on your system and/or
consider adjusting the CC environment variable if you installed
it in a non-standard prefix.
'''
sys.exit()

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

if match:
return match.group(1)
else:
return 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
# check involves checking the build number against a whitelist. I'm not
# quite prepared to go that far yet.
def check_compiler():
def check_compiler(o):
if sys.platform == 'win32':
return

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

# Need llvm_version or gas_version when openssl asm files are compiled
if options.without_ssl or options.openssl_no_asm or options.shared_openssl:
return

if is_clang:
o['variables']['llvm_version'] = get_llvm_version(CC)
else:
o['variables']['gas_version'] = get_gas_version(CC)


def cc_macros():
"""Checks predefined macros using the CC command."""
Expand All @@ -390,7 +451,7 @@ def cc_macros():
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
except OSError:
print '''Node.js configure error: No acceptable C compiler found!
print '''io.js configure error: No acceptable C compiler found!

Please make sure you have a C compiler installed on your system and/or
consider adjusting the CC environment variable if you installed
Expand Down Expand Up @@ -533,13 +594,6 @@ def configure_node(o):

if target_arch == 'arm':
configure_arm(o)
elif (target_arch == 'arm64' and
not options.shared_openssl and
not options.without_ssl):
# FIXME(bnoordhuis) It's not possible to build the bundled openssl due to
# deps/openssl/asm/arm-elf-gas/modes/ghash-armv4.S, which is 32 bits only.
warn('not building openssl, arm64 not yet supported')
options.without_ssl = True
elif target_arch in ('mips', 'mipsel'):
configure_mips(o)

Expand Down Expand Up @@ -935,8 +989,16 @@ def configure_intl(o):
pprint.pformat(icu_config, indent=2) + '\n')
return # end of configure_intl

output = {
'variables': { 'python': sys.executable },
'include_dirs': [],
'libraries': [],
'defines': [],
'cflags': [],
}

# Print a warning when the compiler is too old.
check_compiler()
check_compiler(output)

# determine the "flavor" (operating system) we're building for,
# leveraging gyp's GetFlavor function
Expand All @@ -945,14 +1007,6 @@ if (options.dest_os):
flavor_params['flavor'] = options.dest_os
flavor = GetFlavor(flavor_params)

output = {
'variables': { 'python': sys.executable },
'include_dirs': [],
'libraries': [],
'defines': [],
'cflags': [],
}

configure_node(output)
configure_libz(output)
configure_http_parser(output)
Expand Down
Loading