Skip to content

Commit

Permalink
build: abstract out shared library suffix
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Stewart Addison authored and Myles Borins committed Nov 18, 2016
1 parent 0138b4d commit e97723b
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 e97723b

Please sign in to comment.