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>

Conflicts:
	node.gyp
  • Loading branch information
Stewart Addison authored and cjihrig committed Aug 10, 2016
1 parent 6ed4ea8 commit b0a557e
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 @@ -248,7 +248,7 @@
],
'conditions': [
[ 'node_module_version!=""', {
'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 b0a557e

Please sign in to comment.