From b0a557eef79778e90b9eb694bd9d8af79f1b57b4 Mon Sep 17 00:00:00 2001 From: Stewart Addison Date: Tue, 12 Jul 2016 19:04:29 +0100 Subject: [PATCH] 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: https://github.com/nodejs/node/pull/7687 Reviewed-By: Ben Noordhuis Reviewed-By: James M Snell Reviewed-By: Michael Dawson Conflicts: node.gyp --- configure | 6 +++++- node.gyp | 2 +- tools/install.py | 9 +++++---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/configure b/configure index b23bfc36a2..d930194196 100755 --- a/configure +++ b/configure @@ -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 diff --git a/node.gyp b/node.gyp index 994de2b436..cbf957a8c7 100644 --- a/node.gyp +++ b/node.gyp @@ -248,7 +248,7 @@ ], 'conditions': [ [ 'node_module_version!=""', { - 'product_extension': 'so.<(node_module_version)', + 'product_extension': '<(shlib_suffix)', }] ], }], diff --git a/tools/install.py b/tools/install.py index a3986c5033..4f155376ea 100755 --- a/tools/install.py +++ b/tools/install.py @@ -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)