1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
12 # chromium uses pymod_do_main, but gyp doesn't set a sensible
13 # Python sys.path (gyp_chromium does).
14 'python%': '<(python)',
15 'host_arch%': '<!("<(python)" <(DEPTH)/coreconf/detect_host_arch.py)',
17 'python%': '<(python)',
18 'host_arch%': '<(host_arch)',
21 'target_arch%': 'arm',
23 'target_arch%': 'arm64',
25 # Default architecture we're building for is the architecture we're
27 'target_arch%': '<(host_arch)',
31 'freebl_name': 'freeblpriv3',
33 'freebl_name': 'freebl3',
36 'use_system_sqlite%': 1,
38 'use_system_sqlite%': 0,
40 ['OS=="mac" or OS=="ios" or OS=="solaris" or OS=="win"', {
46 'use_system_zlib%': 0,
47 'nspr_libs%': ['libnspr4.lib', 'libplc4.lib', 'libplds4.lib'],
50 'moz_debug_flags%': '',
54 'use_system_zlib%': 1,
55 'nspr_libs%': ['-lplds4', '-lplc4', '-lnspr4'],
56 'zlib_libs%': ['-lz'],
59 ['OS=="mac" or OS=="ios"', {
60 'moz_debug_flags%': '-gdwarf-2 -gfull',
61 'dll_suffix': 'dylib',
63 'moz_debug_flags%': '-gdwarf-2',
68 ['"<(GENERATOR)"=="ninja"', {
69 'cc_is_clang%': '<!("<(python)" <(DEPTH)/coreconf/check_cc.py clang)',
73 ['"<(GENERATOR)"=="ninja"', {
74 'cc_is_gcc%': '<!("<(python)" <(DEPTH)/coreconf/check_cc.py gcc)',
78 ['"<(GENERATOR)"=="ninja"', {
79 'cc_is_cc%': '<!("<(python)" <(DEPTH)/coreconf/check_cc.py cc)',
85 # Copy conditionally-set variables out one scope.
86 'python%': '<(python)',
87 'host_arch%': '<(host_arch)',
88 'target_arch%': '<(target_arch)',
89 'use_system_zlib%': '<(use_system_zlib)',
90 'zlib_libs%': ['<@(zlib_libs)'],
91 'moz_debug_flags%': '<(moz_debug_flags)',
92 'nspr_libs%': ['<@(nspr_libs)'],
93 'nspr_lib_dir%': '<(nspr_lib_dir)',
94 'nspr_include_dir%': '<(nspr_include_dir)',
95 'use_system_sqlite%': '<(use_system_sqlite)',
96 'sqlite_libs%': ['-lsqlite3'],
97 'dll_prefix': '<(dll_prefix)',
98 'dll_suffix': '<(dll_suffix)',
99 'freebl_name': '<(freebl_name)',
100 'cc_is_clang%': '<(cc_is_clang)',
101 'cc_is_gcc%': '<(cc_is_gcc)',
102 'cc_use_gnu_ld%': '<(cc_use_gnu_ld)',
104 'disable_arm_hw_aes%': 0,
105 'disable_arm_hw_sha1%': 0,
106 'disable_arm_hw_sha2%': 0,
107 'disable_intel_hw_sha%': 0,
109 'disable_chachapoly%': 0,
110 'disable_deprecated_seed%': 0,
111 'disable_deprecated_rc2%': 0,
113 'disable_libpkix%': 1,
114 'disable_werror%': 0,
115 'disable_altivec%': 0,
116 'disable_crypto_vsx%': 0,
117 'disable_arm32_neon%': 0,
118 'mozilla_client%': 0,
121 'moz_folded_library_name%': '',
122 'sanitizer_flags%': 0,
132 'nss_public_dist_dir%': '<(nss_dist_dir)/public',
133 'nss_private_dist_dir%': '<(nss_dist_dir)/private',
134 # This is only needed when building with --mozpkix-only and might not work
136 'nss_include_dir%': '/usr/include/nss',
137 'only_dev_random%': 1,
139 'fips_module_id%': '',
141 'mozilla_central%': 0,
143 'softfp_cflags%': '',
144 'enable_draft_hpke%': 0,
145 'force_integrated_as%': 0,
150 # Settings specific to targets should go here.
151 # This is mostly for linking to libraries.
155 'debug_optimization_level%': '0',
156 'release_optimization_level%': '2',
158 'standalone_static_library': 0,
160 '<(nspr_include_dir)',
161 '<(nss_dist_dir)/private/<(module)',
164 [ 'mozpkix_only==1 and OS=="linux"', {
166 '<(nss_include_dir)',
169 [ 'disable_fips==0', {
171 'NSS_ENABLE_FIPS_INDICATORS',
174 [ 'disable_fips==1', {
177 'NSS_NO_INIT_SUPPORT',
180 [ 'fips_module_id!=""', {
182 'NSS_FIPS_MODULE_ID="<(fips_module_id)"'
185 [ 'OS!="android" and OS!="mac" and OS!="ios" and OS!="win"', {
203 'debug_optimization_level%': '3',
206 [ 'target_arch=="ia32" or target_arch=="x64"', {
212 'VCCLCompilerTool': {
213 'PreprocessorDefinitions': [
219 [ 'target_arch=="ia32"', {
225 'VCCLCompilerTool': {
226 'PreprocessorDefinitions': [
232 [ 'target_arch=="arm64" or target_arch=="aarch64" or target_arch=="sparc64" or target_arch=="ppc64" or target_arch=="ppc64le" or target_arch=="s390x" or target_arch=="mips64" or target_arch=="e2k" or target_arch=="riscv64" or target_arch=="loongarch64"', {
237 [ 'target_arch=="x64"', {
244 'VCCLCompilerTool': {
245 'PreprocessorDefinitions': [
253 'target_conditions': [
254 # If we want to properly export a static library, and copy it to lib,
255 # we need to mark it as a 'standalone_static_library'. Otherwise,
256 # the relative paths in the thin archive will break linking.
257 [ '_type=="shared_library"', {
258 'product_dir': '<(nss_dist_obj_dir)/lib'
259 }, '_type=="executable"', {
260 'product_dir': '<(nss_dist_obj_dir)/bin'
261 }, 'static_libs==1 or _standalone_static_library==1', {
262 'product_dir': '<(nss_dist_obj_dir)/lib'
266 # Work around a gyp bug. Fixed upstream but not in Ubuntu packages:
267 # https://chromium.googlesource.com/external/gyp/+/b85ad3e578da830377dbc1843aa4fbc5af17a192%5E%21/
269 '<(DEPTH)/coreconf/empty.c',
273 '-exported_symbols_list',
274 '<(INTERMEDIATE_DIR)/out.>(mapfile)',
278 [ 'cc_use_gnu_ld==1', {
280 '-Wl,--version-script,<(INTERMEDIATE_DIR)/out.>(mapfile)',
283 [ 'cc_use_gnu_ld!=1 and OS=="win"', {
284 # On Windows, .def files are used directly as sources.
289 # On other platforms, .def files need processing.
291 '<(INTERMEDIATE_DIR)/out.>(mapfile)',
294 'action_name': 'generate_mapfile',
299 '<(INTERMEDIATE_DIR)/out.>(mapfile)',
301 'action': ['<@(process_map_file)'],
305 }, 'static_libs==1 and _type=="shared_library"', {
306 # When linking a shared lib against a static one, XCode doesn't
307 # export the latter's symbols by default. -all_load fixes that.
314 [ '_type=="shared_library" or _type=="executable"', {
322 # Shared library specific settings.
323 [ '_type=="shared_library"', {
325 [ 'cc_use_gnu_ld==1', {
339 'DYLIB_INSTALL_NAME_BASE': '@executable_path',
340 'DYLIB_COMPATIBILITY_VERSION': '1',
341 'DYLIB_CURRENT_VERSION': '1',
343 '-headerpad_max_install_names',
352 [ '_type=="static_library" and static_libs==1', {
353 'standalone_static_library': 1,
356 'default_configuration': 'Debug',
358 # Common settings for Debug+Release should go here.
363 'NO_NSPR_10_SUPPORT',
364 'SSL_DISABLE_DEPRECATED_CIPHER_SUITE_NAMES',
366 'msvs_configuration_attributes': {
367 'OutputDirectory': '$(SolutionDir)$(ConfigurationName)',
368 'IntermediateDirectory': '$(OutDir)\\obj\\$(ProjectName)',
371 'VCCLCompilerTool': {
372 'AdditionalIncludeDirectories': ['<(nspr_include_dir)'],
376 'CLANG_CXX_LANGUAGE_STANDARD': 'c++0x',
384 [ 'OS=="linux" or OS=="android"', {
389 '_DEFAULT_SOURCE', # for <endian.h> functions, strdup, realpath, and getentropy
390 '_BSD_SOURCE', # for the above in glibc <= 2.19
391 '_POSIX_SOURCE', # for <signal.h>
392 'SDB_MEASURE_USE_TEMP_DIR', # use tmpdir for the access calls
395 [ 'OS=="dragonfly" or OS=="freebsd"', {
410 ['OS=="mac" or OS=="ios" or OS=="dragonfly" or OS=="freebsd" or OS=="netbsd" or OS=="openbsd"', {
422 [ 'OS!="mac" and OS!="ios" and OS!="solaris" and OS!="win"', {
427 [ 'OS!="mac" and OS!="ios" and OS!="win"', {
431 '-ffunction-sections',
441 [ 'target_arch=="ia32"', {
445 [ 'target_arch=="x64"', {
451 [ 'use_pprof==1 and OS!="android" and OS!="win"', {
453 [ 'OS=="mac" or OS=="ios"', {
455 'OTHER_LDFLAGS': [ '-lprofiler' ],
458 'ldflags': [ '-lprofiler' ],
467 [ 'disable_werror==0 and OS!="android" and OS!="win"', {
469 '<!@("<(python)" <(DEPTH)/coreconf/werror.py)',
473 '<!@("<(python)" <(DEPTH)/coreconf/werror.py)',
479 '-Wno-unused-function',
480 '-Wno-unused-variable',
484 '-Wno-unused-function',
485 '-Wno-unused-variable',
489 [ 'sanitizer_flags!=0', {
490 'cflags': ['<@(sanitizer_flags)'],
491 'ldflags': ['<@(sanitizer_flags)'],
493 'OTHER_CFLAGS': ['<@(sanitizer_flags)'],
494 # We want to pass -fsanitize=... to our final link call,
495 # but not to libtool. OTHER_LDFLAGS is passed to both.
496 # To trick GYP into doing what we want, we'll piggyback on
497 # LIBRARY_SEARCH_PATHS, producing "-L/usr/lib -fsanitize=...".
498 # The -L/usr/lib is redundant but innocuous: it's a default path.
499 'LIBRARY_SEARCH_PATHS': ['/usr/lib <(sanitizer_flags)'],
504 'ldflags': ['-flto', '-fuse-ld=gold', '-Wl,-plugin-opt=save-temps'],
506 [ 'OS=="android" and mozilla_client==0', {
513 [ 'OS=="mac" or OS=="ios"', {
518 [ 'target_arch=="ia32"', {
523 [ 'target_arch=="x64"', {
528 [ 'target_arch=="arm64"', {
537 'IPHONEOS_DEPLOYMENT_TARGET': '<(iphone_deployment_target)',
543 '_CRT_SECURE_NO_WARNINGS',
544 '_CRT_NONSTDC_NO_WARNINGS',
548 '-w44267', # Disable C4267: conversion from 'size_t' to 'type', possible loss of data
549 '-w44244', # Disable C4244: conversion from 'type1' to 'type2', possible loss of data
550 '-w44018', # Disable C4018: 'expression' : signed/unsigned mismatch
551 '-w44312', # Disable C4312: 'type cast': conversion from 'type1' to 'type2' of greater size
554 [ 'disable_werror==0', {
557 [ 'target_arch=="ia32"', {
558 'msvs_configuration_platform': 'Win32',
561 'MinimumRequiredVersion': '5.01', # XP.
562 'TargetMachine': '1',
563 'ImageHasSafeExceptionHandlers': 'false',
565 'VCCLCompilerTool': {
566 'PreprocessorDefinitions': [
569 'AdditionalOptions': [ '/EHsc' ],
573 [ 'target_arch=="x64"', {
574 'msvs_configuration_platform': 'x64',
577 'TargetMachine': '17', # x86-64
579 'VCCLCompilerTool': {
580 'PreprocessorDefinitions': [
584 'AdditionalOptions': [ '/EHsc' ],
590 [ 'disable_dbm==1', {
595 [ 'disable_libpkix==1', {
597 'NSS_DISABLE_LIBPKIX',
600 [ 'disable_deprecated_seed==1', {
602 'NSS_DISABLE_DEPRECATED_SEED',
605 [ 'disable_deprecated_rc2==1', {
607 'NSS_DISABLE_DEPRECATED_RC2',
612 # Common settings for debug should go here.
614 'inherit_from': ['Common'],
616 [ 'OS!="mac" and OS!="ios" and OS!="win"', {
619 '<(moz_debug_flags)',
624 'defines': ['DEBUG'],
625 'cflags': [ '-O<(debug_optimization_level)' ],
627 'COPY_PHASE_STRIP': 'NO',
628 'GCC_OPTIMIZATION_LEVEL': '<(debug_optimization_level)',
629 'GCC_GENERATE_DEBUGGING_SYMBOLS': 'YES',
632 'VCCLCompilerTool': {
633 'Optimization': '<(debug_optimization_level)',
634 'BasicRuntimeChecks': '3',
635 'RuntimeLibrary': '2', # /MD
636 'DebugInformationFormat': '3',
639 'LinkIncremental': '1',
640 'GenerateDebugInformation' : 'true',
642 'VCResourceCompilerTool': {
643 'PreprocessorDefinitions': ['DEBUG'],
647 # Common settings for release should go here.
649 'inherit_from': ['Common'],
650 'defines': ['NDEBUG'],
651 'cflags': [ '-O<(release_optimization_level)' ],
653 'DEAD_CODE_STRIPPING': 'YES', # -Wl,-dead_strip
654 'GCC_OPTIMIZATION_LEVEL': '<(release_optimization_level)',
657 'VCCLCompilerTool': {
658 'Optimization': '<(release_optimization_level)',
659 'RuntimeLibrary': '2', # /MD
662 'LinkIncremental': '1',
668 # The gyp ninja backend requires these.
669 # TODO: either we should support building both 32/64-bit as
670 # configurations from the same gyp build, or we should fix
671 # upstream gyp to not require these.
673 'inherit_from': ['Debug'],
676 'inherit_from': ['Release'],
683 [ 'cc_use_gnu_ld==1 or OS=="solaris"', {
685 'process_map_file': ['/bin/sh', '-c', '/usr/bin/env grep -v ";-" >(mapfile) | sed -e "s,;+,," -e "s; DATA ;;" -e "s,;;,," -e "s,;.*,;," > >@(_outputs)'],
688 [ 'OS=="mac" or OS=="ios"', {
690 'process_map_file': ['/bin/sh', '-c', '/usr/bin/grep -v ";+" >(mapfile) | grep -v ";-" | sed -e "s; DATA ;;" -e "s,;;,," -e "s,;.*,," -e "s,^,_," > >@(_outputs)'],