Skip to content

Commit

Permalink
build: abstract out shared library suffix
Browse files Browse the repository at this point in the history
WIP: Add soname & fix make install

PR-URL: nodejs#6994
Ref: nodejs#9385
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Fedor Indutny <[email protected]>

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.dylib 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: nodejs#7687
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
  • Loading branch information
Stewart Addison committed Nov 18, 2016
1 parent d0078bc commit 28dc711
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 5 deletions.
1 change: 1 addition & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import nodedownload

# imports in tools/
sys.path.insert(0, os.path.join(root_dir, 'tools'))
import getmoduleversion

# parse our options
parser = optparse.OptionParser()
Expand Down
2 changes: 1 addition & 1 deletion node.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@
],
'conditions': [
[ 'node_module_version!="" and OS!="win"', {
'product_extension': 'so.<(node_module_version)',
'product_extension': '<(shlib_suffix)',
}]
],
}],
Expand Down
24 changes: 24 additions & 0 deletions tools/getmoduleversion.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from __future__ import print_function
import os
import re

def get_version():
node_version_h = os.path.join(
os.path.dirname(__file__),
'..',
'src',
'node_version.h')

f = open(node_version_h)

regex = '^#define NODE_MODULE_VERSION [0-9]+'

for line in f:
if re.match(regex, line):
major = line.split()[2]
return major

raise Exception('Could not find pattern matching %s' % regex)

if __name__ == '__main__':
print(get_version())
9 changes: 5 additions & 4 deletions tools/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,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 _InstallablaeTargetInstallPath function.
output_prefix += 'lib.target/'
output_file = 'lib' + output_file + '.so'
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 28dc711

Please sign in to comment.