Skip to content

Commit fc912e8

Browse files
author
Stewart Addison
committed
build: abstract out shared library suffix
WIP: Add soname & fix make install PR-URL: #6994 Ref: #9385 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Fedor Indutny <fedor@indutny.com> 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: #7687 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
1 parent aed1d67 commit fc912e8

File tree

4 files changed

+31
-5
lines changed

4 files changed

+31
-5
lines changed

configure

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import nodedownload
2626

2727
# imports in tools/
2828
sys.path.insert(0, os.path.join(root_dir, 'tools'))
29+
import getmoduleversion
2930

3031
# parse our options
3132
parser = optparse.OptionParser()

node.gyp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@
236236
],
237237
'conditions': [
238238
[ 'node_module_version!="" and OS!="win"', {
239-
'product_extension': 'so.<(node_module_version)',
239+
'product_extension': '<(shlib_suffix)',
240240
}]
241241
],
242242
}],

tools/getmoduleversion.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
from __future__ import print_function
2+
import os
3+
import re
4+
5+
def get_version():
6+
node_version_h = os.path.join(
7+
os.path.dirname(__file__),
8+
'..',
9+
'src',
10+
'node_version.h')
11+
12+
f = open(node_version_h)
13+
14+
regex = '^#define NODE_MODULE_VERSION [0-9]+'
15+
16+
for line in f:
17+
if re.match(regex, line):
18+
major = line.split()[2]
19+
return major
20+
21+
raise Exception('Could not find pattern matching %s' % regex)
22+
23+
if __name__ == '__main__':
24+
print(get_version())

tools/install.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,11 @@ def files(action):
133133
if is_windows:
134134
output_file += '.dll'
135135
else:
136-
# GYP will output to lib.target, this is hardcoded in its source,
137-
# see the _InstallablaeTargetInstallPath function.
138-
output_prefix += 'lib.target/'
139-
output_file = 'lib' + output_file + '.so'
136+
output_file = 'lib' + output_file + '.' + variables.get('shlib_suffix')
137+
# GYP will output to lib.target except on OS X, this is hardcoded
138+
# in its source - see the _InstallableTargetInstallPath function.
139+
if sys.platform != 'darwin':
140+
output_prefix += 'lib.target/'
140141

141142
action([output_prefix + output_file], 'bin/' + output_file)
142143

0 commit comments

Comments
 (0)