File tree 4 files changed +37
-6
lines changed 4 files changed +37
-6
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ import nodedownload
26
26
27
27
# imports in tools/
28
28
sys .path .insert (0 , os .path .join (root_dir , 'tools' ))
29
+ import getmoduleversion
29
30
30
31
# parse our options
31
32
parser = optparse .OptionParser ()
@@ -795,6 +796,11 @@ def configure_node(o):
795
796
o ['variables' ]['node_shared' ] = b (options .shared )
796
797
o ['variables' ]['node_use_v8_platform' ] = b (not options .without_v8_platform )
797
798
o ['variables' ]['node_use_bundled_v8' ] = b (not options .without_bundled_v8 )
799
+ node_module_version = getmoduleversion .get_version ()
800
+ shlib_suffix = '%s.dylib' if sys .platform == 'darwin' else 'so.%s'
801
+ shlib_suffix %= node_module_version
802
+ o ['variables' ]['node_module_version' ] = int (node_module_version )
803
+ o ['variables' ]['shlib_suffix' ] = shlib_suffix
798
804
799
805
if options .linked_module :
800
806
o ['variables' ]['library_files' ] = options .linked_module
Original file line number Diff line number Diff line change 233
233
'NODE_SHARED_MODE' ,
234
234
],
235
235
'conditions' : [
236
- [ 'node_module_version!="" and OS!="win" ' , {
237
- 'product_extension' : 'so.<(node_module_version )' ,
236
+ [ 'node_module_version!=""' , {
237
+ 'product_extension' : '<(shlib_suffix )' ,
238
238
}]
239
239
],
240
240
}],
Original file line number Diff line number Diff line change
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 ())
Original file line number Diff line number Diff line change @@ -133,10 +133,11 @@ def files(action):
133
133
if is_windows :
134
134
output_file += '.dll'
135
135
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/'
140
141
141
142
action ([output_prefix + output_file ], 'bin/' + output_file )
142
143
You can’t perform that action at this time.
0 commit comments