1# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- 2# vim: set filetype=python: 3# This Source Code Form is subject to the terms of the Mozilla Public 4# License, v. 2.0. If a copy of the MPL was not distributed with this 5# file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 7with Files("**"): 8 BUG_COMPONENT = ("Core", "Security: PSM") 9 10with Files("generate*.py"): 11 BUG_COMPONENT = ("Core", "Build Config") 12 13with Files("nss/**"): 14 BUG_COMPONENT = ("NSS", "Libraries") 15 16with Files("nss.symbols"): 17 BUG_COMPONENT = ("NSS", "Libraries") 18 19if CONFIG['MOZ_SYSTEM_NSS']: 20 Library('nss') 21 OS_LIBS += CONFIG['NSS_LIBS'] 22else: 23 include('/build/gyp_base.mozbuild') 24 if CONFIG['MOZ_FOLD_LIBS']: 25 GeckoSharedLibrary('nss', linkage=None) 26 # TODO: The library name can be changed when bug 845217 is fixed. 27 SHARED_LIBRARY_NAME = 'nss3' 28 29 USE_LIBS += [ 30 'nspr4', 31 'nss3_static', 32 'nssutil', 33 'plc4', 34 'plds4', 35 'smime3_static', 36 'ssl', 37 ] 38 39 OS_LIBS += CONFIG['REALTIME_LIBS'] 40 41 SYMBOLS_FILE = 'nss.symbols' 42 # This changes the default targets in the NSS build, among 43 # other things. 44 gyp_vars['moz_fold_libs'] = 1 45 # Some things in NSS need to link against nssutil, which 46 # gets folded, so this tells them what to link against. 47 gyp_vars['moz_folded_library_name'] = 'nss' 48 # Force things in NSS that want to link against NSPR to link 49 # against the folded library. 50 gyp_vars['nspr_libs'] = 'nss' 51 else: 52 Library('nss') 53 USE_LIBS += [ 54 'nss3', 55 'nssutil3', 56 'smime3', 57 'sqlite', 58 'ssl3', 59 ] 60 gyp_vars['nspr_libs'] = 'nspr4 plc4 plds4' 61 62 # This disables building some NSS tools. 63 gyp_vars['mozilla_client'] = 1 64 # We run shlibsign as part of packaging, not build. 65 gyp_vars['sign_libs'] = 0 66 gyp_vars['python'] = CONFIG['PYTHON'] 67 # The NSS gyp files do not have a default for this. 68 gyp_vars['nss_dist_dir'] = '$PRODUCT_DIR/dist' 69 # NSS wants to put public headers in $nss_dist_dir/public/nss by default, 70 # which would wind up being mapped to dist/include/public/nss (by 71 # gyp_reader's `handle_copies`). 72 # This forces it to put them in dist/include/nss. 73 gyp_vars['nss_public_dist_dir'] = '$PRODUCT_DIR/dist' 74 gyp_vars['nss_dist_obj_dir'] = '$PRODUCT_DIR/dist/bin' 75 # We don't currently build NSS tests. 76 gyp_vars['disable_tests'] = 1 77 if CONFIG['NSS_DISABLE_DBM']: 78 gyp_vars['disable_dbm'] = 1 79 gyp_vars['disable_libpkix'] = 1 80 # pkg-config won't reliably find zlib on our builders, so just force it. 81 # System zlib is only used for modutil and signtool unless 82 # SSL zlib is enabled, which we are disabling immediately below this. 83 gyp_vars['zlib_libs'] = '-lz' 84 gyp_vars['ssl_enable_zlib'] = 0 85 # System sqlite here is the in-tree mozsqlite. 86 gyp_vars['use_system_sqlite'] = 1 87 gyp_vars['sqlite_libs'] = 'sqlite' 88 gyp_vars['nspr_include_dir'] = CONFIG['NSPR_INCLUDE_DIR'] 89 gyp_vars['nspr_lib_dir'] = CONFIG['NSPR_LIB_DIR'] 90 # The Python scripts that detect clang need it to be set as CC 91 # in the environment, which isn't true here. I don't know that 92 # setting that would be harmful, but we already have this information 93 # anyway. 94 if CONFIG['CC_TYPE'] in ('clang', 'clang-cl'): 95 gyp_vars['cc_is_clang'] = 1 96 if CONFIG['GCC_USE_GNU_LD']: 97 gyp_vars['cc_use_gnu_ld'] = 1 98 99 GYP_DIRS += ['nss'] 100 GYP_DIRS['nss'].input = 'nss/nss.gyp' 101 GYP_DIRS['nss'].variables = gyp_vars 102 103 sandbox_vars = { 104 # NSS explicitly exports its public symbols 105 # with linker scripts. 106 'COMPILE_FLAGS': { 107 'VISIBILITY': [], 108 # XXX: We should fix these warnings. 109 'WARNINGS_AS_ERRORS': [], 110 }, 111 # NSS' build system doesn't currently build NSS with PGO. 112 # We could probably do so, but not without a lot of 113 # careful consideration. 114 'NO_PGO': True, 115 } 116 if CONFIG['OS_TARGET'] == 'WINNT': 117 if CONFIG['CPU_ARCH'] == 'x86': 118 # This should really be the default. 119 sandbox_vars['ASFLAGS'] = ['-safeseh'] 120 if CONFIG['MOZ_FOLD_LIBS_FLAGS']: 121 sandbox_vars['CFLAGS'] = CONFIG['MOZ_FOLD_LIBS_FLAGS'] 122 if CONFIG['OS_TARGET'] == 'Android': 123 sandbox_vars['CFLAGS'] = [ 124 '-include', TOPSRCDIR + '/security/manager/android_stub.h', 125 # Setting sandbox_vars['DEFINES'] is broken currently. 126 '-DCHECK_FORK_GETPID', 127 ] 128 if CONFIG['ANDROID_VERSION']: 129 sandbox_vars['CFLAGS'] += ['-DANDROID_VERSION=' + CONFIG['ANDROID_VERSION']] 130 GYP_DIRS['nss'].sandbox_vars = sandbox_vars 131 GYP_DIRS['nss'].no_chromium = True 132 GYP_DIRS['nss'].no_unified = True 133 # This maps action names from gyp files to 134 # Python scripts that can be used in moz.build GENERATED_FILES. 135 GYP_DIRS['nss'].action_overrides = { 136 'generate_certdata_c': 'generate_certdata.py', 137 'generate_mapfile': 'generate_mapfile.py', 138 } 139 140if CONFIG['NSS_EXTRA_SYMBOLS_FILE']: 141 DEFINES['NSS_EXTRA_SYMBOLS_FILE'] = CONFIG['NSS_EXTRA_SYMBOLS_FILE'] 142