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/.
8 BUG_COMPONENT = ("Core", "Security: PSM")
10 with Files("generate*.py"):
11 BUG_COMPONENT = ("Firefox Build System", "General")
14 BUG_COMPONENT = ("NSS", "Libraries")
16 with Files("nss.symbols"):
17 BUG_COMPONENT = ("NSS", "Libraries")
19 if CONFIG["MOZ_SYSTEM_NSS"]:
21 OS_LIBS += CONFIG["NSS_LIBS"]
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"
39 OS_LIBS += CONFIG["REALTIME_LIBS"]
41 SYMBOLS_FILE = "nss.symbols"
42 # This changes the default targets in the NSS build, among
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 elif not CONFIG["MOZ_SYSTEM_NSS"]:
60 gyp_vars["nspr_libs"] = "nspr"
62 # Build mozpkix and mozpkix-test only
63 gyp_vars["nspr_libs"] = "nspr"
64 gyp_vars["mozpkix_only"] = 1
66 # This disables building some NSS tools.
67 gyp_vars["mozilla_client"] = 1
69 # This builds NSS tools in COMM applications that Firefox doesn't build.
70 if CONFIG["MOZ_BUILD_APP"].startswith("comm/"):
71 gyp_vars["comm_client"] = 1
73 # We run shlibsign as part of packaging, not build.
74 gyp_vars["sign_libs"] = 0
75 gyp_vars["python"] = CONFIG["PYTHON3"]
76 # The NSS gyp files do not have a default for this.
77 gyp_vars["nss_dist_dir"] = "$PRODUCT_DIR/dist"
78 # NSS wants to put public headers in $nss_dist_dir/public/nss by default,
79 # which would wind up being mapped to dist/include/public/nss (by
80 # gyp_reader's `handle_copies`).
81 # This forces it to put them in dist/include/nss.
82 gyp_vars["nss_public_dist_dir"] = "$PRODUCT_DIR/dist"
83 gyp_vars["nss_dist_obj_dir"] = "$PRODUCT_DIR/dist/bin"
84 # We don't currently build NSS tests.
85 gyp_vars["disable_tests"] = 1
86 gyp_vars["disable_dbm"] = 1
87 gyp_vars["disable_libpkix"] = 1
88 gyp_vars["enable_sslkeylogfile"] = 1
89 # pkg-config won't reliably find zlib on our builders, so just force it.
90 # System zlib is only used for modutil and signtool unless
91 # SSL zlib is enabled, which we are disabling immediately below this.
92 gyp_vars["zlib_libs"] = "-lz"
93 gyp_vars["ssl_enable_zlib"] = 0
94 # System sqlite here is the in-tree mozsqlite.
95 gyp_vars["use_system_sqlite"] = 1
96 gyp_vars["sqlite_libs"] = "sqlite"
97 gyp_vars["enable_draft_hpke"] = 1
100 if CONFIG["MOZ_SYSTEM_NSPR"]:
101 gyp_vars["nspr_include_dir"] = "%" + CONFIG["NSPR_INCLUDE_DIR"]
102 gyp_vars["nspr_lib_dir"] = "%" + CONFIG["NSPR_LIB_DIR"]
104 gyp_vars["nspr_include_dir"] = "!/dist/include/nspr"
105 gyp_vars["nspr_lib_dir"] = "" # gyp wants a value, but we don't need
108 # The Python scripts that detect clang need it to be set as CC
109 # in the environment, which isn't true here. I don't know that
110 # setting that would be harmful, but we already have this information
112 if CONFIG["CC_TYPE"] in ("clang", "clang-cl"):
113 gyp_vars["cc_is_clang"] = 1
114 if CONFIG["GCC_USE_GNU_LD"]:
115 gyp_vars["cc_use_gnu_ld"] = 1
118 GYP_DIRS["nss"].input = "nss/nss.gyp"
119 GYP_DIRS["nss"].variables = gyp_vars
122 # NSS explicitly exports its public symbols
123 # with linker scripts.
126 # XXX: We should fix these warnings.
127 "WARNINGS_AS_ERRORS": [],
129 # NSS' build system doesn't currently build NSS with PGO.
130 # We could probably do so, but not without a lot of
131 # careful consideration.
134 if CONFIG["OS_TARGET"] == "WINNT":
135 # We want to remove XP_WIN32 eventually. See bug 1535219 for details.
136 sandbox_vars["CFLAGS"] = ["-DXP_WIN32"]
137 if CONFIG["CPU_ARCH"] == "x86":
138 # This should really be the default.
139 sandbox_vars["ASFLAGS"] = ["-safeseh"]
140 if CONFIG["OS_TARGET"] == "Android":
141 sandbox_vars["CFLAGS"] = [
143 TOPSRCDIR + "/security/manager/android_stub.h",
145 if CONFIG["ANDROID_VERSION"]:
146 sandbox_vars["CFLAGS"] += ["-DANDROID_VERSION=" + CONFIG["ANDROID_VERSION"]]
147 if CONFIG["MOZ_SYSTEM_NSS"]:
148 sandbox_vars["CXXFLAGS"] = CONFIG["NSS_CFLAGS"]
149 GYP_DIRS["nss"].sandbox_vars = sandbox_vars
150 GYP_DIRS["nss"].no_chromium = True
151 GYP_DIRS["nss"].no_unified = True
152 # This maps action names from gyp files to
153 # Python scripts that can be used in moz.build GENERATED_FILES.
154 GYP_DIRS["nss"].action_overrides = {
155 "generate_certdata_c": "generate_certdata.py",
156 "generate_mapfile": "generate_mapfile.py",
159 if CONFIG["NSS_EXTRA_SYMBOLS_FILE"]:
160 DEFINES["NSS_EXTRA_SYMBOLS_FILE"] = CONFIG["NSS_EXTRA_SYMBOLS_FILE"]