Skip to content
Snippets Groups Projects
Unverified Commit 73dbda8c authored by Adam J. Stewart's avatar Adam J. Stewart Committed by GitHub
Browse files

node-js: add Python 3 support (#14242)

* node-js: add Python 3 support

* Update node-js, fix Python 3 support in v12
parent 3dd59c56
Branches
Tags
No related merge requests found
...@@ -13,8 +13,15 @@ class NodeJs(Package): ...@@ -13,8 +13,15 @@ class NodeJs(Package):
engine.""" engine."""
homepage = "https://nodejs.org/" homepage = "https://nodejs.org/"
url = "https://nodejs.org/download/release/v6.3.0/node-v6.3.0.tar.gz" url = "https://nodejs.org/dist/v13.5.0/node-v13.5.0.tar.gz"
list_url = "https://nodejs.org/dist/"
list_depth = 1
# Current (latest features)
version('13.5.0', sha256='4b8078d896a7550d7ed399c1b4ac9043e9f883be404d9b337185c8d8479f2db8')
# LTS (recommended for most users)
version('12.14.0', sha256='5c1939867228f3845c808ef84a89c8ee93cc35f857bf7587ecee1b5a6d9da67b', preferred=True)
version('11.1.0', sha256='3f53b5ac25b2d36ad538267083c0e603d9236867a936c22a9116d95fa10c60d5') version('11.1.0', sha256='3f53b5ac25b2d36ad538267083c0e603d9236867a936c22a9116d95fa10c60d5')
version('10.13.0', sha256='aa06825fff375ece7c0d881ae0de5d402a857e8cabff9b4a50f2f0b7b44906be') version('10.13.0', sha256='aa06825fff375ece7c0d881ae0de5d402a857e8cabff9b4a50f2f0b7b44906be')
version('8.9.1', sha256='32491b7fcc4696b2cdead45c47e52ad16bbed8f78885d32e873952fee0f971e1') version('8.9.1', sha256='32491b7fcc4696b2cdead45c47e52ad16bbed8f78885d32e873952fee0f971e1')
...@@ -22,30 +29,32 @@ class NodeJs(Package): ...@@ -22,30 +29,32 @@ class NodeJs(Package):
version('6.3.0', sha256='4ed7a99985f8afee337cc22d5fef61b495ab4238dfff3750ac9019e87fc6aae6') version('6.3.0', sha256='4ed7a99985f8afee337cc22d5fef61b495ab4238dfff3750ac9019e87fc6aae6')
version('6.2.2', sha256='b6baee57a0ede496c7c7765001f7495ad74c8dfe8c34f1a6fb2cd5d8d526ffce') version('6.2.2', sha256='b6baee57a0ede496c7c7765001f7495ad74c8dfe8c34f1a6fb2cd5d8d526ffce')
# variant('bash-completion', default=False, description='Build with bash-completion support for npm') # NOQA: ignore=E501
variant('debug', default=False, description='Include debugger support') variant('debug', default=False, description='Include debugger support')
variant('doc', default=False, description='Compile with documentation') variant('doc', default=False, description='Compile with documentation')
variant('icu4c', default=False, description='Build with support for all locales instead of just English') variant('icu4c', default=False, description='Build with support for all locales instead of just English')
variant('openssl', default=True, description='Build with Spacks OpenSSL instead of the bundled version') variant('openssl', default=True, description='Build with Spacks OpenSSL instead of the bundled version')
variant('zlib', default=True, description='Build with Spacks zlib instead of the bundled version') variant('zlib', default=True, description='Build with Spacks zlib instead of the bundled version')
# https://github.com/nodejs/node/blob/master/BUILDING.md#unix-and-macos
depends_on('gmake@3.81:', type='build')
depends_on('libtool', type='build', when=sys.platform != 'darwin') depends_on('libtool', type='build', when=sys.platform != 'darwin')
depends_on('pkgconfig', type='build') depends_on('pkgconfig', type='build')
depends_on('python@2.7:2.8', type='build') depends_on('python@2.7:2.8,3.5:', when='@12:', type='build')
depends_on('python@2.7:2.8', when='@:11', type='build')
# depends_on('bash-completion', when="+bash-completion") # depends_on('bash-completion', when="+bash-completion")
depends_on('icu4c', when='+icu4c') depends_on('icu4c', when='+icu4c')
depends_on('openssl@1.0.2d:1.0.99', when='@:9+openssl') depends_on('openssl@1.0.2d:1.0.99', when='@:9+openssl')
depends_on('openssl@1.1:', when='@10:+openssl') depends_on('openssl@1.1:', when='@10:+openssl')
depends_on('zlib', when='+zlib') depends_on('zlib', when='+zlib')
def install(self, spec, prefix): phases = ['configure', 'build', 'install']
options = []
options.extend(['--prefix={0}'.format(prefix)])
# Note: npm is updated more regularly than node.js, so we build the def setup_build_environment(self, env):
# package instead of using the bundled version # Force use of experimental Python 3 support
options.extend(['--without-npm']) env.set('PYTHON', self.spec['python'].command.path)
env.set('NODE_GYP_FORCE_PYTHON', self.spec['python'].command.path)
def configure_args(self):
# On OSX, the system libtool must be used # On OSX, the system libtool must be used
# So, we ensure that this is the case by... # So, we ensure that this is the case by...
if sys.platform == 'darwin': if sys.platform == 'darwin':
...@@ -60,37 +69,52 @@ def install(self, spec, prefix): ...@@ -60,37 +69,52 @@ def install(self, spec, prefix):
'(temporarily) remove \n %s or its link to libtool from' '(temporarily) remove \n %s or its link to libtool from'
'path') 'path')
# TODO: Add bash-completion args = [
'--prefix={0}'.format(self.prefix),
# Note: npm is updated more regularly than node.js, so we build
# the package instead of using the bundled version
'--without-npm'
]
if '+debug' in spec: if '+debug' in self.spec:
options.extend(['--debug']) args.append('--debug')
if '+openssl' in spec: if '+openssl' in self.spec:
options.extend([ args.extend([
'--shared-openssl', '--shared-openssl',
'--shared-openssl-includes=%s' % spec['openssl'].prefix.include, # NOQA: ignore=E501 '--shared-openssl-includes={0}'.format(
'--shared-openssl-libpath=%s' % spec['openssl'].prefix.lib, self.spec['openssl'].prefix.include),
'--shared-openssl-libpath={0}'.format(
self.spec['openssl'].prefix.lib),
]) ])
if '+zlib' in spec: if '+zlib' in self.spec:
options.extend([ args.extend([
'--shared-zlib', '--shared-zlib',
'--shared-zlib-includes=%s' % spec['zlib'].prefix.include, '--shared-zlib-includes={0}'.format(
'--shared-zlib-libpath=%s' % spec['zlib'].prefix.lib, self.spec['zlib'].prefix.include),
'--shared-zlib-libpath={0}'.format(
self.spec['zlib'].prefix.lib),
]) ])
if '+icu4c' in spec: if '+icu4c' in self.spec:
options.extend(['--with-intl=full-icu']) args.append('--with-intl=full-icu')
# else:
# options.extend(['--with-intl=system-icu'])
configure(*options) return args
if self.run_tests: def configure(self, spec, prefix):
make('test') python('configure.py', *self.configure_args())
make('test-addons')
def build(self, spec, prefix):
make()
if '+doc' in spec: if '+doc' in spec:
make('doc') make('doc')
@run_after('build')
@on_package_attributes(run_tests=True)
def test(self):
make('test')
make('test-addons')
def install(self, spec, prefix):
make('install') make('install')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment