Skip to content

Commit

Permalink
deps: refactor openssl.gyp
Browse files Browse the repository at this point in the history
Updated gyp has "else if" syntax in condition. Use this for
target_arch and OS switches. Several defines, rules and libraries
variables moved to openssl.gypi
  • Loading branch information
Shigeki Ohtsu committed Feb 25, 2015
1 parent 8ed3053 commit fcb6a47
Show file tree
Hide file tree
Showing 2 changed files with 220 additions and 190 deletions.
268 changes: 78 additions & 190 deletions deps/openssl/openssl.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -13,93 +13,74 @@
{
'target_name': 'openssl',
'type': '<(library)',
'sources': [
'<@(openssl_sources)',
],
'sources': ['<@(openssl_sources)'],
'sources/': [
['exclude', 'md2/.*$'],
['exclude', 'store/.*$']
],
'conditions': [
['target_arch!="ia32" and target_arch!="x64" and target_arch!="arm" or openssl_no_asm!=0', {
['openssl_no_asm!=0', {
# Disable asm
'defines': [
'OPENSSL_NO_ASM'
],
'sources': [
'<@(openssl_sources_no_asm)',
'OPENSSL_NO_ASM',
],
'sources': ['<@(openssl_sources_no_asm)'],
}, {
# Enable asm
'defines': [
'AES_ASM',
'CPUID_ASM',
'OPENSSL_BN_ASM_MONT',
'OPENSSL_CPUID_OBJ',
'SHA1_ASM',
'SHA256_ASM',
'SHA512_ASM',
'GHASH_ASM',
],
# "else if" was supported in https://codereview.chromium.org/601353002
'conditions': [
# Extended assembly on non-arm platforms
['target_arch!="arm"', {
['target_arch=="arm"', {
'defines': ['<@(openssl_defines_asm)'],
'sources': ['<@(openssl_sources_arm_elf_gas)'],
}, 'target_arch=="ia32" and OS=="mac"', {
'defines': [
'VPAES_ASM',
'BN_ASM',
'BF_ASM',
'BNCO_ASM',
'DES_ASM',
'LIB_BN_ASM',
'MD5_ASM',
'OPENSSL_BN_ASM',
'RIP_ASM',
'RMD160_ASM',
'WHIRLPOOL_ASM',
'WP_ASM',
'<@(openssl_defines_asm)',
'<@(openssl_defines_x86_mac)',
],
}],
['OS!="win" and OS!="mac" and target_arch=="ia32"', {
'sources': [
'<@(openssl_sources_x86_elf_gas)',
]
}],
['OS!="win" and OS!="mac" and target_arch=="x64"', {
'sources': ['<@(openssl_sources_x86_macosx_gas)'],
}, 'target_arch=="ia32" and OS=="win"', {
'defines': [
'OPENSSL_BN_ASM_MONT5',
'OPENSSL_BN_ASM_GF2m',
'OPENSSL_IA32_SSE2',
'BSAES_ASM',
'<@(openssl_defines_asm)',
'<@(openssl_defines_x86_win)',
],
'sources': [
'<@(openssl_sources_x64_elf_gas)',
]
}],
['OS=="mac" and target_arch=="ia32"', {
'sources': [
'<@(openssl_sources_x86_macosx_gas)',
]
}],
['OS=="mac" and target_arch=="x64"', {
'sources': ['<@(openssl_sources_x86_win32_masm)'],
}, 'target_arch=="ia32"', {
# Linux or others
'defines': [
'OPENSSL_BN_ASM_MONT5',
'OPENSSL_BN_ASM_GF2m',
'OPENSSL_IA32_SSE2',
'BSAES_ASM',
'<@(openssl_defines_asm)',
'<@(openssl_defines_x86_elf)',
],
'sources': [
'<@(openssl_sources_x64_macosx_gas)',
]
}],
['target_arch=="arm"', {
'sources': [
'<@(openssl_sources_arm_elf_gas)',
]
}],
['OS=="win" and target_arch=="ia32"', {
'sources': [
'<@(openssl_sources_x86_win32_masm)',
'sources': ['<@(openssl_sources_x86_elf_gas)'],
}, 'target_arch=="x64" and OS=="mac"', {
'defines': [
'<@(openssl_defines_asm)',
'<@(openssl_defines_x64_mac)',
],
'sources': ['<@(openssl_sources_x64_macosx_gas)'],
}, 'target_arch=="x64" and OS=="win"', {
'defines': [
'<@(openssl_defines_asm)',
'<@(openssl_defines_x64_win)',
],
'sources': ['<@(openssl_sources_x64_win32_masm)'],
}, 'target_arch=="x64"', {
# Linux or others
'defines': [
'<@(openssl_defines_asm)',
'<@(openssl_defines_x64_elf)',
],
'sources': ['<@(openssl_sources_x64_elf_gas)'],
}, { # else other archtectures does not use asm
'defines': [
'OPENSSL_NO_ASM',
],
'sources': ['<@(openssl_sources_no_asm)'],
}],
],
}], # end of conditions of openssl_no_asm
['OS=="win"', {
'defines' : ['<@(openssl_defines_all_win)'],
'conditions': [
['target_arch=="ia32"', {
'rules': [
{
'rule_name': 'Assemble',
Expand All @@ -118,18 +99,8 @@
'process_outputs_as_sources': 0,
'message': 'Assembling <(RULE_INPUT_PATH) to <(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).obj.',
}
]
}],
['OS=="win" and target_arch=="x64"', {
'defines': [
'OPENSSL_BN_ASM_MONT5',
'OPENSSL_BN_ASM_GF2m',
'OPENSSL_IA32_SSE2',
'BSAES_ASM',
],
'sources': [
'<@(openssl_sources_x64_win32_masm)',
],
}, 'target_arch=="x64"', {
'rules': [
{
'rule_name': 'Assemble',
Expand All @@ -147,73 +118,36 @@
'process_outputs_as_sources': 0,
'message': 'Assembling <(RULE_INPUT_PATH) to <(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).obj.',
}
]
}]
]
}],
['OS=="win"', {
'link_settings': {
'libraries': [
'-lgdi32.lib',
'-luser32.lib',
]
},
'defines': [
'DSO_WIN32',
],
}],
],
}, {
'defines': [
'DSO_DLFCN',
'HAVE_DLFCN_H'
],
}],
],
'include_dirs': [
'.',
'openssl',
'openssl/crypto',
'openssl/crypto/asn1',
'openssl/crypto/evp',
'openssl/crypto/md2',
'openssl/crypto/modes',
'openssl/crypto/store',
'openssl/include',
'defines' : ['<@(openssl_defines_all_non_win)']
}]
],
'include_dirs': ['<@(openssl_include_dirs)'],
'direct_dependent_settings': {
'include_dirs': ['openssl/include'],
'include_dirs': [
'openssl/include'
],
},
},
{
'target_name': 'openssl-cli',
'type': 'executable',
'dependencies': [
'openssl',
],
'dependencies': ['openssl'],
'defines': [
'MONOLITH',
],
'sources': [
'<@(openssl_cli_sources)',
'MONOLITH'
],
'sources': ['<@(openssl_cli_sources)'],
'conditions': [
['OS=="solaris"', {
'libraries': [
'-lsocket',
'-lnsl',
]
}],
['OS=="win"', {
'libraries': ['<@(openssl_cli_libraries_solaris)']
}, 'OS=="win"', {
'link_settings': {
'libraries': [
'-lws2_32.lib',
'-lgdi32.lib',
'-ladvapi32.lib',
'-lcrypt32.lib',
'-luser32.lib',
],
'libraries': ['<@(openssl_cli_libraries_win)'],
},
}],
[ 'OS in "linux android"', {
}, 'OS in "linux android"', {
'link_settings': {
'libraries': [
'-ldl',
Expand All @@ -224,70 +158,24 @@
}
],
'target_defaults': {
'include_dirs': [
'.',
'openssl',
'openssl/crypto',
'openssl/crypto/asn1',
'openssl/crypto/evp',
'openssl/crypto/md2',
'openssl/crypto/modes',
'openssl/crypto/store',
'openssl/include',
],
'defines': [
# No clue what these are for.
'L_ENDIAN',
'PURIFY',
'_REENTRANT',

# SSLv2 is known broken and has been superseded by SSLv3 for almost
# twenty years now.
'OPENSSL_NO_SSL2',

# SSLv3 is susceptible to downgrade attacks (POODLE.)
'OPENSSL_NO_SSL3',

# Heartbeat is a TLS extension, that couldn't be turned off or
# asked to be not advertised. Unfortunately this is unacceptable for
# Microsoft's IIS, which seems to be ignoring whole ClientHello after
# seeing this extension.
'OPENSSL_NO_HEARTBEATS',
],
'include_dirs': ['<@(openssl_default_include_dirs)'],
'defines': ['<@(openssl_default_defines_all)'],
'conditions': [
['OS=="win"', {
'defines': [
'MK1MF_BUILD',
'WIN32_LEAN_AND_MEAN',
'OPENSSL_SYSNAME_WIN32',
],
'msvs_disabled_warnings': [
4244, # conversion from 'signed type', possible loss of data
4267, # conversion from 'unsigned type', possible loss of data
4996, # 'GetVersionExA': was declared deprecated
],
'defines': ['<@(openssl_default_defines_win)'],
'link_settings': {
'libraries': ['<@(openssl_default_libraries_win)'],
},
}, {
'defines': [
# ENGINESDIR must be defined if OPENSSLDIR is.
'ENGINESDIR="/dev/null"',
'TERMIOS',
'defines': ['<@(openssl_default_defines_not_win)'],
'cflags': [
'-Wno-missing-field-initializers',
],
'cflags': ['-Wno-missing-field-initializers'],
'conditions': [
['OS=="mac"', {
'defines': [
# Set to ubuntu default path for convenience. If necessary,
# override this at runtime with the SSL_CERT_DIR environment
# variable.
'OPENSSLDIR="/System/Library/OpenSSL/"',
],
'defines': ['<@(openssl_default_defines_mac)'],
}, {
'defines': [
# Set to ubuntu default path for convenience. If necessary,
# override this at runtime with the SSL_CERT_DIR environment
# variable.
'OPENSSLDIR="/etc/ssl"',
],
'defines': ['<@(openssl_default_defines_linux_others)'],
}],
]
}],
Expand Down
Loading

0 comments on commit fcb6a47

Please sign in to comment.