Skip to content

Commit e97723b

Browse files
Stewart AddisonMyles Borins
Stewart Addison
authored and
Myles Borins
committed
build: abstract out shared library suffix
Originally part of 410296c abstracted out in backport PR-URL: #9385 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Myles Borins <[email protected]>
1 parent 0138b4d commit e97723b

File tree

4 files changed

+31
-5
lines changed

4 files changed

+31
-5
lines changed

configure

+1
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

+1-1
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@
243243
],
244244
'conditions': [
245245
[ 'node_module_version!="" and OS!="win"', {
246-
'product_extension': 'so.<(node_module_version)',
246+
'product_extension': '<(shlib_suffix)',
247247
}]
248248
],
249249
}],

tools/getmoduleversion.py

+24
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

+5-4
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)