Skip to content

Commit

Permalink
Bug 1311615 - Building with gyp should copy headers, libs, executable…
Browse files Browse the repository at this point in the history
…s to the right directory r=franziskus

Differential Revision: https://nss-dev.phacility.com/D104

--HG--
extra : amend_source : ff8c11eba755fd19dadc7e02970319bbb964c781
  • Loading branch information
Tim Taubert committed Oct 21, 2016
1 parent 9a34a87 commit 4826162
Show file tree
Hide file tree
Showing 42 changed files with 128 additions and 131 deletions.
6 changes: 0 additions & 6 deletions build.sh
Expand Up @@ -50,12 +50,6 @@ else
fi
$NINJA -C "$TARGET_DIR"

# Copy files over to the right directory.
mkdir -p "$DIST_DIR/bin" "$DIST_DIR/lib"
find "$TARGET_DIR" -maxdepth 1 -type f -executable -exec ln -sft "$DIST_DIR/bin" {} \+
find "$TARGET_DIR/lib" -maxdepth 1 -type f -exec ln -sft "$DIST_DIR/lib" {} \+
find "$TARGET_DIR" -name '*.a' -exec ln -sft "$DIST_DIR/lib" {} \+

# Sign libs. TODO: get ninja to do this
echo >"$TARGET_DIR/shlibsign.log"
for lib in freebl3 freeblpriv3 nssdbm3 softokn3; do
Expand Down
4 changes: 2 additions & 2 deletions cmd/lib/exports.gyp
Expand Up @@ -16,12 +16,12 @@
'pk11table.h',
'secutil.h'
],
'destination': '<(PRODUCT_DIR)/dist/<(module)/private'
'destination': '<(nss_dist_dir)/private/<(module)'
}
]
}
],
'variables': {
'module': 'nss'
}
}
}
4 changes: 2 additions & 2 deletions cmd/modutil/modutil.gyp
Expand Up @@ -29,8 +29,8 @@
],
'target_defaults': {
'include_dirs': [
'<(PRODUCT_DIR)/dist/nss/private',
'<(PRODUCT_DIR)/dist/dbm/private'
'<(nss_dist_dir)/private/nss',
'<(nss_dist_dir)/private/dbm'
],
'defines': [
'NSPR20',
Expand Down
23 changes: 18 additions & 5 deletions coreconf/config.gypi
Expand Up @@ -30,20 +30,23 @@
#XXX: gyp breaks if these are empty!
'nspr_lib_dir%': ' ',
'nspr_include_dir%': ' ',
'nss_dist_obj_dir%': ' ',
'nss_dist_dir%': ' ',
'zlib_libs%': [],
#TODO
'moz_debug_flags%': '',
'dll_prefix': '',
'dll_suffix': 'dll',
}, {
# On non-windows, default to a system NSPR.
'nspr_libs%': ['-lplds4', '-lplc4', '-lnspr4'],
'nspr_lib_dir%': '<!(<(python) <(DEPTH)/coreconf/nspr_lib_dir.py)',
'nspr_include_dir%': '<!(<(python) <(DEPTH)/coreconf/nspr_include_dir.py)',
'nspr_lib_dir%': '<!(<(python) <(DEPTH)/coreconf/pkg_config.py . --libs nspr)',
'nspr_include_dir%': '<!(<(python) <(DEPTH)/coreconf/pkg_config.py . --cflags nspr)',
'nss_dist_obj_dir%': '<!(<(python) <(DEPTH)/coreconf/pkg_config.py ../.. --cflags nspr)',
'nss_dist_dir%': '<!(<(python) <(DEPTH)/coreconf/pkg_config.py ../../.. --cflags nspr)',
'use_system_zlib%': 1,
}],
['OS=="linux" or OS=="android"', {
'zlib_libs%': ['<!@(<(python) <(DEPTH)/coreconf/pkg_config.py --libs zlib)'],
'zlib_libs%': ['<!@(<(python) <(DEPTH)/coreconf/pkg_config.py raw --libs zlib)'],
'moz_debug_flags%': '-gdwarf-2',
'optimize_flags%': '-O2',
'dll_prefix': 'lib',
Expand Down Expand Up @@ -76,6 +79,8 @@
'nspr_libs%': ['<@(nspr_libs)'],
'nspr_lib_dir%': '<(nspr_lib_dir)',
'nspr_include_dir%': '<(nspr_include_dir)',
'nss_dist_obj_dir%': '<(nss_dist_obj_dir)',
'nss_dist_dir%': '<(nss_dist_dir)',
'use_system_sqlite%': '<(use_system_sqlite)',
'sqlite_libs%': ['-lsqlite3'],
'dll_prefix': '<(dll_prefix)',
Expand All @@ -99,7 +104,7 @@
},
'include_dirs': [
'<(nspr_include_dir)',
'<(PRODUCT_DIR)/dist/<(module)/private',
'<(nss_dist_dir)/private/<(module)',
],
'conditions': [
[ 'OS=="linux"', {
Expand All @@ -111,6 +116,14 @@
}],
],
'target_conditions': [
# If we ever want to properly export a static library, and copy it to lib,
# we will need to mark it as a 'standalone_static_library'. Otherwise,
# the relative paths in the thin archive will break linking.
[ '_type=="shared_library"', {
'product_dir': '<(nss_dist_obj_dir)/lib'
}, '_type=="executable"', {
'product_dir': '<(nss_dist_obj_dir)/bin'
}],
# mapfile handling
[ 'mapfile!=""', {
# Work around a gyp bug. Fixed upstream but not in Ubuntu packages:
Expand Down
17 changes: 0 additions & 17 deletions coreconf/nspr_include_dir.py

This file was deleted.

17 changes: 0 additions & 17 deletions coreconf/nspr_lib_dir.py

This file was deleted.

28 changes: 26 additions & 2 deletions coreconf/pkg_config.py
@@ -1,15 +1,39 @@
#!/usr/bin/env python
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

import os
import subprocess
import sys

def main():
is_raw = sys.argv[1] == 'raw'
stdout = None if is_raw else subprocess.PIPE

if sys.argv[2] == '--libs':
part_prefix = '-L'
elif sys.argv[2] == '--cflags':
part_prefix = '-I'
else:
raise 'Specify either --libs or --cflags as the second argument.'

try:
subprocess.Popen(['pkg-config'] + sys.argv[1:], stderr=open(os.devnull, 'wb')).wait()
process = subprocess.Popen(['pkg-config'] + sys.argv[2:], stdout=stdout, stderr=open(os.devnull, 'wb'))

except OSError:
# pkg-config is probably not installed
pass
return

if is_raw:
process.wait()
return

for part in process.communicate()[0].strip().split():
if part.startswith(part_prefix):
print os.path.realpath(os.path.join(part[2:], sys.argv[1]))
return

if __name__ == '__main__':
main()
4 changes: 2 additions & 2 deletions exports.gyp
Expand Up @@ -11,7 +11,7 @@
'type': 'none',
'direct_dependent_settings': {
'include_dirs': [
'<(PRODUCT_DIR)/dist/nss/public'
'<(nss_dist_dir)/public/nss'
]
},
'dependencies': [
Expand Down Expand Up @@ -64,7 +64,7 @@
['disable_dbm==0', {
'direct_dependent_settings': {
'include_dirs': [
'<(PRODUCT_DIR)/dist/dbm/public'
'<(nss_dist_dir)/public/dbm'
]
},
'dependencies': [
Expand Down
6 changes: 3 additions & 3 deletions lib/base/exports.gyp
Expand Up @@ -15,19 +15,19 @@
'nssbase.h',
'nssbaset.h'
],
'destination': '<(PRODUCT_DIR)/dist/<(module)/public'
'destination': '<(nss_dist_dir)/public/<(module)'
},
{
'files': [
'base.h',
'baset.h'
],
'destination': '<(PRODUCT_DIR)/dist/<(module)/private'
'destination': '<(nss_dist_dir)/private/<(module)'
}
]
}
],
'variables': {
'module': 'nss'
}
}
}
6 changes: 3 additions & 3 deletions lib/certdb/exports.gyp
Expand Up @@ -16,7 +16,7 @@
'certdb.h',
'certt.h'
],
'destination': '<(PRODUCT_DIR)/dist/<(module)/public'
'destination': '<(nss_dist_dir)/public/<(module)'
},
{
'files': [
Expand All @@ -25,12 +25,12 @@
'genname.h',
'xconst.h'
],
'destination': '<(PRODUCT_DIR)/dist/<(module)/private'
'destination': '<(nss_dist_dir)/private/<(module)'
}
]
}
],
'variables': {
'module': 'nss'
}
}
}
6 changes: 3 additions & 3 deletions lib/certhigh/exports.gyp
Expand Up @@ -15,19 +15,19 @@
'ocsp.h',
'ocspt.h'
],
'destination': '<(PRODUCT_DIR)/dist/<(module)/public'
'destination': '<(nss_dist_dir)/public/<(module)'
},
{
'files': [
'ocspi.h',
'ocspti.h'
],
'destination': '<(PRODUCT_DIR)/dist/<(module)/private'
'destination': '<(nss_dist_dir)/private/<(module)'
}
]
}
],
'variables': {
'module': 'nss'
}
}
}
4 changes: 2 additions & 2 deletions lib/ckfw/builtins/exports.gyp
Expand Up @@ -14,12 +14,12 @@
'files': [
'nssckbi.h'
],
'destination': '<(PRODUCT_DIR)/dist/<(module)/public'
'destination': '<(nss_dist_dir)/public/<(module)'
}
]
}
],
'variables': {
'module': 'nss'
}
}
}
6 changes: 3 additions & 3 deletions lib/ckfw/exports.gyp
Expand Up @@ -22,7 +22,7 @@
'nssckmdt.h',
'nssckt.h'
],
'destination': '<(PRODUCT_DIR)/dist/<(module)/public'
'destination': '<(nss_dist_dir)/public/<(module)'
},
{
'files': [
Expand All @@ -33,12 +33,12 @@
'ckmd.h',
'ckt.h'
],
'destination': '<(PRODUCT_DIR)/dist/<(module)/private'
'destination': '<(nss_dist_dir)/private/<(module)'
}
]
}
],
'variables': {
'module': 'nss'
}
}
}
6 changes: 3 additions & 3 deletions lib/crmf/exports.gyp
Expand Up @@ -17,7 +17,7 @@
'crmf.h',
'crmft.h'
],
'destination': '<(PRODUCT_DIR)/dist/<(module)/public'
'destination': '<(nss_dist_dir)/public/<(module)'
},
{
'files': [
Expand All @@ -26,12 +26,12 @@
'crmfi.h',
'crmfit.h'
],
'destination': '<(PRODUCT_DIR)/dist/<(module)/private'
'destination': '<(nss_dist_dir)/private/<(module)'
}
]
}
],
'variables': {
'module': 'nss'
}
}
}
4 changes: 2 additions & 2 deletions lib/cryptohi/exports.gyp
Expand Up @@ -23,13 +23,13 @@
'keythi.h',
'sechash.h'
],
'destination': '<(PRODUCT_DIR)/dist/<(module)/public'
'destination': '<(nss_dist_dir)/public/<(module)'
},
{
'files': [
'keyi.h',
],
'destination': '<(PRODUCT_DIR)/dist/<(module)/private'
'destination': '<(nss_dist_dir)/private/<(module)'
}
]
}
Expand Down
6 changes: 3 additions & 3 deletions lib/dbm/include/exports.gyp
Expand Up @@ -16,7 +16,7 @@
'ncompat.h',
'winfile.h'
],
'destination': '<(PRODUCT_DIR)/dist/<(module)/public'
'destination': '<(nss_dist_dir)/public/<(module)'
},
{
'files': [
Expand All @@ -27,12 +27,12 @@
'queue.h',
'search.h'
],
'destination': '<(PRODUCT_DIR)/dist/<(module)/private'
'destination': '<(nss_dist_dir)/private/<(module)'
}
]
}
],
'variables': {
'module': 'dbm'
}
}
}
4 changes: 2 additions & 2 deletions lib/dev/exports.gyp
Expand Up @@ -20,12 +20,12 @@
'nssdev.h',
'nssdevt.h'
],
'destination': '<(PRODUCT_DIR)/dist/<(module)/private'
'destination': '<(nss_dist_dir)/private/<(module)'
}
]
}
],
'variables': {
'module': 'nss'
}
}
}

0 comments on commit 4826162

Please sign in to comment.