Browse Source

build: abstract out shared library suffix

Originally part of 410296c abstracted out in backport

PR-URL: https://github.com/nodejs/node/pull/9385
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
v4.x
Stewart Addison 9 years ago
committed by Myles Borins
parent
commit
e97723b18c
  1. 1
      configure
  2. 2
      node.gyp
  3. 24
      tools/getmoduleversion.py
  4. 9
      tools/install.py

1
configure

@ -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()

2
node.gyp

@ -243,7 +243,7 @@
],
'conditions': [
[ 'node_module_version!="" and OS!="win"', {
'product_extension': 'so.<(node_module_version)',
'product_extension': '<(shlib_suffix)',
}]
],
}],

24
tools/getmoduleversion.py

@ -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
tools/install.py

@ -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)

Loading…
Cancel
Save