diff options
author | Moonchild <mcwerewolf@gmail.com> | 2018-02-06 12:02:47 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-06 12:02:47 +0100 |
commit | 389c60da5e01761f4a11ef539ffa26e4c1b17875 (patch) | |
tree | c6033924a0de9be1ab140596e305898c651bf57e /security/nss/coreconf/config.gypi | |
parent | 7c9b585349c985df0cf6ace83da5dadba8b5c677 (diff) | |
parent | f017b749ea9f1586d2308504553d40bf4cc5439d (diff) | |
download | UXP-389c60da5e01761f4a11ef539ffa26e4c1b17875.tar UXP-389c60da5e01761f4a11ef539ffa26e4c1b17875.tar.gz UXP-389c60da5e01761f4a11ef539ffa26e4c1b17875.tar.lz UXP-389c60da5e01761f4a11ef539ffa26e4c1b17875.tar.xz UXP-389c60da5e01761f4a11ef539ffa26e4c1b17875.zip |
Merge pull request #13 from MoonchildProductions/ported-upstream
Ported upstream
Diffstat (limited to 'security/nss/coreconf/config.gypi')
-rw-r--r-- | security/nss/coreconf/config.gypi | 288 |
1 files changed, 177 insertions, 111 deletions
diff --git a/security/nss/coreconf/config.gypi b/security/nss/coreconf/config.gypi index fe9b55329..9ea528ae4 100644 --- a/security/nss/coreconf/config.gypi +++ b/security/nss/coreconf/config.gypi @@ -24,39 +24,44 @@ # building on. 'target_arch%': '<(host_arch)', }], + ['OS=="linux"', { + # FIPS-140 LOWHASH + 'freebl_name': 'freeblpriv3', + }, { + 'freebl_name': 'freebl3', + }], + ['OS=="mac"', { + 'use_system_sqlite%': 1, + },{ + 'use_system_sqlite%': 0, + }], + ['OS=="mac" or OS=="win"', { + 'cc_use_gnu_ld%': 0, + }, { + 'cc_use_gnu_ld%': 1, + }], ['OS=="win"', { 'use_system_zlib%': 0, - 'nspr_libs%': ['nspr4.lib', 'plc4.lib', 'plds4.lib'], + 'nspr_libs%': ['libnspr4.lib', 'libplc4.lib', 'libplds4.lib'], 'zlib_libs%': [], #TODO 'moz_debug_flags%': '', 'dll_prefix': '', 'dll_suffix': 'dll', }, { - 'nspr_libs%': ['-lplds4', '-lplc4', '-lnspr4'], 'use_system_zlib%': 1, - }], - ['OS=="linux" or OS=="android"', { - 'zlib_libs%': ['-lz'], - 'moz_debug_flags%': '-gdwarf-2', - 'optimize_flags%': '-O2', - 'dll_prefix': 'lib', - 'dll_suffix': 'so', - }], - ['OS=="linux"', { - 'freebl_name': 'freeblpriv3', - }, { - 'freebl_name': 'freebl3', - }], - ['OS=="mac"', { + 'nspr_libs%': ['-lplds4', '-lplc4', '-lnspr4'], 'zlib_libs%': ['-lz'], - 'use_system_sqlite%': 1, - 'moz_debug_flags%': '-gdwarf-2 -gfull', - 'optimize_flags%': '-O2', 'dll_prefix': 'lib', - 'dll_suffix': 'dylib', - }, { - 'use_system_sqlite%': 0, + 'conditions': [ + ['OS=="mac"', { + 'moz_debug_flags%': '-gdwarf-2 -gfull', + 'dll_suffix': 'dylib', + }, { + 'moz_debug_flags%': '-gdwarf-2', + 'dll_suffix': 'so', + }], + ], }], ['"<(GENERATOR)"=="ninja"', { 'cc_is_clang%': '<!(<(python) <(DEPTH)/coreconf/check_cc_clang.py)', @@ -81,6 +86,7 @@ 'dll_suffix': '<(dll_suffix)', 'freebl_name': '<(freebl_name)', 'cc_is_clang%': '<(cc_is_clang)', + 'cc_use_gnu_ld%': '<(cc_use_gnu_ld)', # Some defaults 'disable_tests%': 0, 'disable_chachapoly%': 0, @@ -91,16 +97,18 @@ 'moz_fold_libs%': 0, 'moz_folded_library_name%': '', 'ssl_enable_zlib%': 1, - 'use_asan%': 0, - 'use_ubsan%': 0, - 'use_msan%': 0, - 'use_sancov%': 0, + 'sanitizer_flags%': 0, 'test_build%': 0, + 'no_zdefs%': 0, 'fuzz%': 0, + 'fuzz_tls%': 0, + 'fuzz_oss%': 0, 'sign_libs%': 1, 'use_pprof%': 0, + 'ct_verif%': 0, 'nss_public_dist_dir%': '<(nss_dist_dir)/public', 'nss_private_dist_dir%': '<(nss_dist_dir)/private', + 'only_dev_random%': 1, }, 'target_defaults': { # Settings specific to targets should go here. @@ -108,6 +116,8 @@ 'variables': { 'mapfile%': '', 'test_build%': 0, + 'debug_optimization_level%': '0', + 'release_optimization_level%': '2', }, 'standalone_static_library': 0, 'include_dirs': [ @@ -115,13 +125,68 @@ '<(nss_dist_dir)/private/<(module)', ], 'conditions': [ - [ 'OS=="linux"', { + [ 'OS!="android" and OS!="mac" and OS!="win"', { 'libraries': [ '-lpthread', + ], + }], + [ 'OS=="linux"', { + 'libraries': [ '-ldl', '-lc', ], }], + [ 'fuzz==1', { + 'variables': { + 'debug_optimization_level%': '1', + }, + }], + [ 'target_arch=="ia32" or target_arch=="x64"', { + 'defines': [ + 'NSS_X86_OR_X64', + ], + # For Windows. + 'msvs_settings': { + 'VCCLCompilerTool': { + 'PreprocessorDefinitions': [ + 'NSS_X86_OR_X64', + ], + }, + }, + }], + [ 'target_arch=="ia32"', { + 'defines': [ + 'NSS_X86', + ], + # For Windows. + 'msvs_settings': { + 'VCCLCompilerTool': { + 'PreprocessorDefinitions': [ + 'NSS_X86', + ], + }, + }, + }], + [ 'target_arch=="arm64" or target_arch=="aarch64"', { + 'defines': [ + 'NSS_USE_64', + ], + }], + [ 'target_arch=="x64"', { + 'defines': [ + 'NSS_X64', + 'NSS_USE_64', + ], + # For Windows. + 'msvs_settings': { + 'VCCLCompilerTool': { + 'PreprocessorDefinitions': [ + 'NSS_X64', + 'NSS_USE_64', + ], + }, + }, + }], ], 'target_conditions': [ # If we want to properly export a static library, and copy it to lib, @@ -135,7 +200,7 @@ 'product_dir': '<(nss_dist_obj_dir)/lib' }], # mapfile handling - [ 'test_build==0 and mapfile!=""', { + [ 'mapfile!=""', { # Work around a gyp bug. Fixed upstream but not in Ubuntu packages: # https://chromium.googlesource.com/external/gyp/+/b85ad3e578da830377dbc1843aa4fbc5af17a192%5E%21/ 'sources': [ @@ -148,12 +213,12 @@ ], }, 'conditions': [ - [ 'OS=="linux" or OS=="android"', { + [ 'cc_use_gnu_ld==1', { 'ldflags': [ '-Wl,--version-script,<(INTERMEDIATE_DIR)/out.>(mapfile)', ], }], - [ 'OS=="win"', { + [ 'cc_use_gnu_ld!=1 and OS=="win"', { # On Windows, .def files are used directly as sources. 'sources': [ '>(mapfile)', @@ -195,10 +260,16 @@ # Shared library specific settings. [ '_type=="shared_library"', { 'conditions': [ - [ 'OS=="linux" or OS=="android"', { + [ 'cc_use_gnu_ld==1', { 'ldflags': [ '-Wl,--gc-sections', - '-Wl,-z,defs', + ], + 'conditions': [ + ['no_zdefs==0', { + 'ldflags': [ + '-Wl,-z,defs', + ], + }], ], }], ], @@ -251,10 +322,36 @@ 'LINUX2_1', 'LINUX', 'linux', + ], + }], + [ 'OS=="dragonfly" or OS=="freebsd"', { + 'defines': [ + 'FREEBSD', + ], + }], + [ 'OS=="netbsd"', { + 'defines': [ + 'NETBSD', + ], + }], + [ 'OS=="openbsd"', { + 'defines': [ + 'OPENBSD', + ], + }], + ['OS=="mac" or OS=="dragonfly" or OS=="freebsd" or OS=="netbsd" or OS=="openbsd"', { + 'defines': [ + 'HAVE_BSD_FLOCK', + ], + }], + [ 'OS!="win"', { + 'defines': [ 'HAVE_STRERROR', 'XP_UNIX', '_REENTRANT', ], + }], + [ 'OS!="mac" and OS!="win"', { 'cflags': [ '-fPIC', '-pipe', @@ -264,6 +361,9 @@ 'cflags_cc': [ '-std=c++0x', ], + 'ldflags': [ + '-z', 'noexecstack', + ], 'conditions': [ [ 'target_arch=="ia32"', { 'cflags': ['-m32'], @@ -273,89 +373,57 @@ 'cflags': ['-m64'], 'ldflags': ['-m64'], }], - [ 'use_pprof==1' , { + ], + }], + [ 'use_pprof==1 and OS!="android" and OS!="win"', { + 'conditions': [ + [ 'OS=="mac"', { + 'xcode_settings': { + 'OTHER_LDFLAGS': [ '-lprofiler' ], + }, + }, { 'ldflags': [ '-lprofiler' ], }], + [ 'OS!="linux"', { + 'library_dirs': [ + '/usr/local/lib/', + ], + }], ], }], - [ 'disable_werror==0 and (OS=="linux" or OS=="mac")', { + [ 'disable_werror==0 and OS!="android" and OS!="win"', { 'cflags': [ '<!@(<(python) <(DEPTH)/coreconf/werror.py)', ], + 'xcode_settings': { + 'OTHER_CFLAGS': [ + '<!@(<(python) <(DEPTH)/coreconf/werror.py)', + ], + }, }], - [ 'fuzz==1', { + [ 'fuzz_tls==1', { 'cflags': [ '-Wno-unused-function', - ] - }], - [ 'use_asan==1 or use_ubsan==1', { - 'cflags': ['-O1'], + '-Wno-unused-variable', + ], 'xcode_settings': { - 'GCC_OPTIMIZATION_LEVEL': '1', # -O1 - } - }], - [ 'use_asan==1', { - 'variables': { - 'asan_flags': '<!(<(python) <(DEPTH)/coreconf/sanitizers.py asan)', - 'no_ldflags': '<!(<(python) <(DEPTH)/coreconf/sanitizers.py ld)', + 'OTHER_CFLAGS': [ + '-Wno-unused-function', + '-Wno-unused-variable', + ], }, - 'cflags': ['<@(asan_flags)'], - 'ldflags': ['<@(asan_flags)'], - 'ldflags!': ['<@(no_ldflags)'], + }], + [ 'sanitizer_flags!=0', { + 'cflags': ['<@(sanitizer_flags)'], + 'ldflags': ['<@(sanitizer_flags)'], 'xcode_settings': { - 'OTHER_CFLAGS': ['<@(asan_flags)'], - 'OTHER_LDFLAGS!': ['<@(no_ldflags)'], + 'OTHER_CFLAGS': ['<@(sanitizer_flags)'], # We want to pass -fsanitize=... to our final link call, # but not to libtool. OTHER_LDFLAGS is passed to both. # To trick GYP into doing what we want, we'll piggyback on # LIBRARY_SEARCH_PATHS, producing "-L/usr/lib -fsanitize=...". # The -L/usr/lib is redundant but innocuous: it's a default path. - 'LIBRARY_SEARCH_PATHS': ['/usr/lib <(asan_flags)'], - }, - }], - [ 'use_ubsan==1', { - 'variables': { - 'ubsan_flags': '<!(<(python) <(DEPTH)/coreconf/sanitizers.py ubsan)', - 'no_ldflags': '<!(<(python) <(DEPTH)/coreconf/sanitizers.py ld)', - }, - 'cflags': ['<@(ubsan_flags)'], - 'ldflags': ['<@(ubsan_flags)'], - 'ldflags!': ['<@(no_ldflags)'], - 'xcode_settings': { - 'OTHER_CFLAGS': ['<@(ubsan_flags)'], - 'OTHER_LDFLAGS!': ['<@(no_ldflags)'], - # See comment above. - 'LIBRARY_SEARCH_PATHS': ['/usr/lib <(ubsan_flags)'], - }, - }], - [ 'use_msan==1', { - 'variables': { - 'msan_flags': '<!(<(python) <(DEPTH)/coreconf/sanitizers.py msan)', - 'no_ldflags': '<!(<(python) <(DEPTH)/coreconf/sanitizers.py ld)', - }, - 'cflags': ['<@(msan_flags)'], - 'ldflags': ['<@(msan_flags)'], - 'ldflags!': ['<@(no_ldflags)'], - 'xcode_settings': { - 'OTHER_CFLAGS': ['<@(msan_flags)'], - 'OTHER_LDFLAGS!': ['<@(no_ldflags)'], - # See comment above. - 'LIBRARY_SEARCH_PATHS': ['/usr/lib <(msan_flags)'], - }, - }], - [ 'use_sancov!=0', { - 'variables': { - 'sancov_flags': '<!(<(python) <(DEPTH)/coreconf/sanitizers.py sancov <(use_sancov))', - 'no_ldflags': '<!(<(python) <(DEPTH)/coreconf/sanitizers.py ld)', - }, - 'cflags': ['<@(sancov_flags)'], - 'ldflags': ['<@(sancov_flags)'], - 'ldflags!': ['<@(no_ldflags)'], - 'xcode_settings': { - 'OTHER_CFLAGS': ['<@(sancov_flags)'], - 'OTHER_LDFLAGS!': ['<@(no_ldflags)'], - # See comment above. - 'LIBRARY_SEARCH_PATHS': ['/usr/lib <(sancov_flags)'], + 'LIBRARY_SEARCH_PATHS': ['/usr/lib <(sanitizer_flags)'], }, }], [ 'OS=="android" and mozilla_client==0', { @@ -368,9 +436,6 @@ [ 'OS=="mac"', { 'defines': [ 'DARWIN', - 'HAVE_STRERROR', - 'HAVE_BSD_FLOCK', - 'XP_UNIX', ], 'conditions': [ [ 'target_arch=="ia32"', { @@ -415,9 +480,9 @@ 'PreprocessorDefinitions': [ 'WIN32', ], + 'AdditionalOptions': [ '/EHsc' ], }, }, - }], [ 'target_arch=="x64"', { 'msvs_configuration_platform': 'x64', @@ -430,6 +495,7 @@ 'WIN64', '_AMD64_', ], + 'AdditionalOptions': [ '/EHsc' ], }, }, }], @@ -451,7 +517,7 @@ 'Debug': { 'inherit_from': ['Common'], 'conditions': [ - [ 'OS=="linux" or OS=="android"', { + [ 'OS!="mac" and OS!="win"', { 'cflags': [ '-g', '<(moz_debug_flags)', @@ -460,14 +526,15 @@ ], #TODO: DEBUG_$USER 'defines': ['DEBUG'], + 'cflags': [ '-O<(debug_optimization_level)' ], 'xcode_settings': { 'COPY_PHASE_STRIP': 'NO', - 'GCC_OPTIMIZATION_LEVEL': '0', + 'GCC_OPTIMIZATION_LEVEL': '<(debug_optimization_level)', 'GCC_GENERATE_DEBUGGING_SYMBOLS': 'YES', }, 'msvs_settings': { 'VCCLCompilerTool': { - 'Optimization': '0', + 'Optimization': '<(debug_optimization_level)', 'BasicRuntimeChecks': '3', 'RuntimeLibrary': '2', # /MD }, @@ -482,16 +549,15 @@ # Common settings for release should go here. 'Release': { 'inherit_from': ['Common'], - 'defines': [ - 'NDEBUG', - ], + 'defines': ['NDEBUG'], + 'cflags': [ '-O<(release_optimization_level)' ], 'xcode_settings': { 'DEAD_CODE_STRIPPING': 'YES', # -Wl,-dead_strip - 'GCC_OPTIMIZATION_LEVEL': '2', # -O2 + 'GCC_OPTIMIZATION_LEVEL': '<(release_optimization_level)', }, 'msvs_settings': { 'VCCLCompilerTool': { - 'Optimization': '2', # /Os + 'Optimization': '<(release_optimization_level)', 'RuntimeLibrary': '2', # /MD }, 'VCLinkerTool': { @@ -516,9 +582,9 @@ }, }, 'conditions': [ - [ 'OS=="linux" or OS=="android"', { + [ 'cc_use_gnu_ld==1', { 'variables': { - 'process_map_file': ['/bin/sh', '-c', '/bin/grep -v ";-" >(mapfile) | sed -e "s,;+,," -e "s; DATA ;;" -e "s,;;,," -e "s,;.*,;," > >@(_outputs)'], + 'process_map_file': ['/bin/sh', '-c', '/usr/bin/env grep -v ";-" >(mapfile) | sed -e "s,;+,," -e "s; DATA ;;" -e "s,;;,," -e "s,;.*,;," > >@(_outputs)'], }, }], [ 'OS=="mac"', { |