Skip to content

Commit

Permalink
build: add correct shared library naming on OS X
Browse files Browse the repository at this point in the history
The build system currently creates a shared library on OS X with the
same name as on Linux i.e.  libnode.so.48.  This is inconsistent with
the conventions on OS X which uses libnode.48.so This commit changes
the build process and install.py (used by make binary) to build with
the correct name on OS X when the --shared configure parameter is used.

PR-URL: #7687
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
  • Loading branch information
Stewart Addison authored and mhdawson committed Aug 9, 2016
1 parent e03a7b2 commit a722205
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
6 changes: 5 additions & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,11 @@ def configure_node(o):

o['variables']['node_no_browser_globals'] = b(options.no_browser_globals)
o['variables']['node_shared'] = b(options.shared)
o['variables']['node_module_version'] = int(getmoduleversion.get_version())
node_module_version = getmoduleversion.get_version()
shlib_suffix = '%s.dylib' if sys.platform == 'darwin' else 'so.%s'
shlib_suffix %= node_module_version
o['variables']['node_module_version'] = int(node_module_version)
o['variables']['shlib_suffix'] = shlib_suffix

if options.linked_module:
o['variables']['library_files'] = options.linked_module
Expand Down
2 changes: 1 addition & 1 deletion node.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@
],
'conditions': [
[ 'node_module_version!="" and OS!="win"', {
'product_extension': 'so.<(node_module_version)',
'product_extension': '<(shlib_suffix)',
}]
],
}],
Expand Down
9 changes: 5 additions & 4 deletions tools/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,11 @@ def files(action):
if is_windows:
output_file += '.dll'
else:
# GYP will output to lib.target, this is hardcoded in its source,
# see the _InstallableTargetInstallPath function.
output_prefix += 'lib.target/'
output_file = 'lib' + output_file + '.so.' + get_version()
output_file = 'lib' + output_file + '.' + variables.get('shlib_suffix')
# GYP will output to lib.target except on OS X, this is hardcoded
# in its source - see the _InstallableTargetInstallPath function.
if sys.platform != 'darwin':
output_prefix += 'lib.target/'

action([output_prefix + output_file], 'bin/' + output_file)

Expand Down

0 comments on commit a722205

Please sign in to comment.