From a7222052d4e4cc4d46cf22e5a33c4f6a18c2d7bf 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 --- configure | 6 +++++- node.gyp | 2 +- tools/install.py | 9 +++++---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/configure b/configure index c117486f99bcc8..5a1a29a1cb3184 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 87047080883c24..0f263d1346f1b5 100644 --- a/node.gyp +++ b/node.gyp @@ -249,7 +249,7 @@ ], 'conditions': [ [ 'node_module_version!="" and OS!="win"', { - 'product_extension': 'so.<(node_module_version)', + 'product_extension': '<(shlib_suffix)', }] ], }], diff --git a/tools/install.py b/tools/install.py index a3986c5033904d..4f155376eaf534 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)