Skip to content

Commit a722205

Browse files
Stewart Addisonmhdawson
Stewart Addison
authored andcommitted
build: add correct shared library naming on OS X
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 <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
1 parent e03a7b2 commit a722205

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

configure

+5-1
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,11 @@ def configure_node(o):
840840

841841
o['variables']['node_no_browser_globals'] = b(options.no_browser_globals)
842842
o['variables']['node_shared'] = b(options.shared)
843-
o['variables']['node_module_version'] = int(getmoduleversion.get_version())
843+
node_module_version = getmoduleversion.get_version()
844+
shlib_suffix = '%s.dylib' if sys.platform == 'darwin' else 'so.%s'
845+
shlib_suffix %= node_module_version
846+
o['variables']['node_module_version'] = int(node_module_version)
847+
o['variables']['shlib_suffix'] = shlib_suffix
844848

845849
if options.linked_module:
846850
o['variables']['library_files'] = options.linked_module

node.gyp

+1-1
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@
249249
],
250250
'conditions': [
251251
[ 'node_module_version!="" and OS!="win"', {
252-
'product_extension': 'so.<(node_module_version)',
252+
'product_extension': '<(shlib_suffix)',
253253
}]
254254
],
255255
}],

tools/install.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,11 @@ def files(action):
118118
if is_windows:
119119
output_file += '.dll'
120120
else:
121-
# GYP will output to lib.target, this is hardcoded in its source,
122-
# see the _InstallableTargetInstallPath function.
123-
output_prefix += 'lib.target/'
124-
output_file = 'lib' + output_file + '.so.' + get_version()
121+
output_file = 'lib' + output_file + '.' + variables.get('shlib_suffix')
122+
# GYP will output to lib.target except on OS X, this is hardcoded
123+
# in its source - see the _InstallableTargetInstallPath function.
124+
if sys.platform != 'darwin':
125+
output_prefix += 'lib.target/'
125126

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

0 commit comments

Comments
 (0)