diff options
-rwxr-xr-x | build.sh | 2 | ||||
-rw-r--r-- | coreconf/config.gypi | 125 | ||||
-rw-r--r-- | coreconf/nspr.sh | 7 |
3 files changed, 93 insertions, 41 deletions
@@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # This script builds NSS with gyp and ninja. # # This build system is still under development. It does not yet support all diff --git a/coreconf/config.gypi b/coreconf/config.gypi index c48143158..11c1c68b9 100644 --- a/coreconf/config.gypi +++ b/coreconf/config.gypi @@ -24,6 +24,22 @@ # 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%': ['libnspr4.lib', 'libplc4.lib', 'libplds4.lib'], @@ -33,30 +49,20 @@ '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 +87,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, @@ -115,9 +122,13 @@ '<(nss_dist_dir)/private/<(module)', ], 'conditions': [ - [ 'OS=="linux"', { + [ 'OS!="android" and OS!="mac" and OS!="win"', { 'libraries': [ '-lpthread', + ], + }], + [ 'OS=="linux"', { + 'libraries': [ '-ldl', '-lc', ], @@ -148,7 +159,7 @@ ], }, 'conditions': [ - [ 'OS=="linux" or OS=="android"', { + [ 'cc_use_gnu_ld==1', { 'ldflags': [ '-Wl,--version-script,<(INTERMEDIATE_DIR)/out.>(mapfile)', ], @@ -195,11 +206,19 @@ # 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': [ + ['OS=="dragonfly" or OS=="freebsd" or OS=="netbsd" or OS=="openbsd"', { + # Bug 1321317 - unix_rand.c:880: undefined reference to `environ' + 'ldflags': [ + '-Wl,--warn-unresolved-symbols', + ], + }], + ], }], ], 'xcode_settings': { @@ -251,10 +270,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', @@ -275,18 +320,23 @@ }], ], }], - [ 'use_pprof==1 and OS=="linux"', { - 'ldflags': [ '-lprofiler' ], - }], - [ 'use_pprof==1 and OS=="mac"', { - 'xcode_settings': { - 'OTHER_LDFLAGS': [ '-lprofiler' ], - }, - 'library_dirs': [ - '/usr/local/lib/', + [ '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)', ], @@ -376,9 +426,6 @@ [ 'OS=="mac"', { 'defines': [ 'DARWIN', - 'HAVE_STRERROR', - 'HAVE_BSD_FLOCK', - 'XP_UNIX', ], 'conditions': [ [ 'target_arch=="ia32"', { @@ -459,7 +506,7 @@ 'Debug': { 'inherit_from': ['Common'], 'conditions': [ - [ 'OS=="linux" or OS=="android"', { + [ 'OS!="mac" and OS!="win"', { 'cflags': [ '-g', '<(moz_debug_flags)', @@ -524,9 +571,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"', { diff --git a/coreconf/nspr.sh b/coreconf/nspr.sh index ff5e38363..33671c37c 100644 --- a/coreconf/nspr.sh +++ b/coreconf/nspr.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # This script builds NSPR for NSS. # # This build system is still under development. It does not yet support all @@ -10,6 +10,11 @@ nspr_cflags= nspr_cxxflags= nspr_ldflags= +# Try to avoid bmake on OS X and BSD systems +if hash gmake 2>/dev/null; then + make() { command gmake "$@"; } +fi + nspr_sanitizer() { nspr_cflags="$nspr_cflags $(python $cwd/coreconf/sanitizers.py $1 $2)" |