Skip to content

Commit

Permalink
Bug 1311619 - Add support for BSDs to GYP build. r=ted,franziskus f=g…
Browse files Browse the repository at this point in the history
…aston

--HG--
extra : amend_source : 305dd188d43570e257203c798446dfa9baa6f1a2
  • Loading branch information
jbeich committed Dec 3, 2016
1 parent ca66491 commit 8660f57
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 41 deletions.
2 changes: 1 addition & 1 deletion build.sh
@@ -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
Expand Down
125 changes: 86 additions & 39 deletions coreconf/config.gypi
Expand Up @@ -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'],
Expand All @@ -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)',
Expand All @@ -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,
Expand Down Expand Up @@ -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',
],
Expand Down Expand Up @@ -148,7 +159,7 @@
],
},
'conditions': [
[ 'OS=="linux" or OS=="android"', {
[ 'cc_use_gnu_ld==1', {
'ldflags': [
'-Wl,--version-script,<(INTERMEDIATE_DIR)/out.>(mapfile)',
],
Expand Down Expand Up @@ -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': {
Expand Down Expand Up @@ -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',
Expand All @@ -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)',
],
Expand Down Expand Up @@ -376,9 +426,6 @@
[ 'OS=="mac"', {
'defines': [
'DARWIN',
'HAVE_STRERROR',
'HAVE_BSD_FLOCK',
'XP_UNIX',
],
'conditions': [
[ 'target_arch=="ia32"', {
Expand Down Expand Up @@ -459,7 +506,7 @@
'Debug': {
'inherit_from': ['Common'],
'conditions': [
[ 'OS=="linux" or OS=="android"', {
[ 'OS!="mac" and OS!="win"', {
'cflags': [
'-g',
'<(moz_debug_flags)',
Expand Down Expand Up @@ -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"', {
Expand Down
7 changes: 6 additions & 1 deletion 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
Expand 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)"
Expand Down

0 comments on commit 8660f57

Please sign in to comment.