2012-08-02 01:06:31 +02:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
2018-12-03 12:28:31 +01:00
|
|
|
from __future__ import print_function
|
2019-04-14 00:09:45 +02:00
|
|
|
|
2018-04-30 14:08:28 +02:00
|
|
|
import ast
|
2012-08-02 01:06:31 +02:00
|
|
|
import errno
|
|
|
|
import os
|
|
|
|
import shutil
|
|
|
|
import sys
|
2022-03-08 19:20:20 +01:00
|
|
|
import re
|
2012-08-02 01:06:31 +02:00
|
|
|
|
|
|
|
# set at init time
|
2013-04-23 20:17:09 +02:00
|
|
|
node_prefix = '/usr/local' # PREFIX variable from Makefile
|
2019-04-14 00:09:45 +02:00
|
|
|
install_path = '' # base target directory (DESTDIR + PREFIX from Makefile)
|
2012-08-02 01:06:31 +02:00
|
|
|
target_defaults = None
|
|
|
|
variables = None
|
|
|
|
|
|
|
|
def abspath(*args):
|
|
|
|
path = os.path.join(*args)
|
|
|
|
return os.path.abspath(path)
|
|
|
|
|
|
|
|
def load_config():
|
2020-12-25 14:05:28 +01:00
|
|
|
with open('config.gypi') as f:
|
|
|
|
return ast.literal_eval(f.read())
|
2012-08-02 01:06:31 +02:00
|
|
|
|
|
|
|
def try_unlink(path):
|
|
|
|
try:
|
|
|
|
os.unlink(path)
|
2018-12-03 12:28:31 +01:00
|
|
|
except OSError as e:
|
2012-08-02 01:06:31 +02:00
|
|
|
if e.errno != errno.ENOENT: raise
|
|
|
|
|
|
|
|
def try_symlink(source_path, link_path):
|
2018-12-03 12:28:31 +01:00
|
|
|
print('symlinking %s -> %s' % (source_path, link_path))
|
2012-08-02 01:06:31 +02:00
|
|
|
try_unlink(link_path)
|
2017-10-24 13:01:50 +02:00
|
|
|
try_mkdir_r(os.path.dirname(link_path))
|
2012-08-02 01:06:31 +02:00
|
|
|
os.symlink(source_path, link_path)
|
|
|
|
|
|
|
|
def try_mkdir_r(path):
|
|
|
|
try:
|
|
|
|
os.makedirs(path)
|
2018-12-03 12:28:31 +01:00
|
|
|
except OSError as e:
|
2012-08-02 01:06:31 +02:00
|
|
|
if e.errno != errno.EEXIST: raise
|
|
|
|
|
|
|
|
def try_rmdir_r(path):
|
|
|
|
path = abspath(path)
|
2013-04-23 20:17:09 +02:00
|
|
|
while path.startswith(install_path):
|
2012-08-02 01:06:31 +02:00
|
|
|
try:
|
|
|
|
os.rmdir(path)
|
2018-12-03 12:28:31 +01:00
|
|
|
except OSError as e:
|
2012-08-02 01:06:31 +02:00
|
|
|
if e.errno == errno.ENOTEMPTY: return
|
|
|
|
if e.errno == errno.ENOENT: return
|
|
|
|
raise
|
|
|
|
path = abspath(path, '..')
|
|
|
|
|
|
|
|
def mkpaths(path, dst):
|
|
|
|
if dst.endswith('/'):
|
2013-04-23 20:17:09 +02:00
|
|
|
target_path = abspath(install_path, dst, os.path.basename(path))
|
2012-08-02 01:06:31 +02:00
|
|
|
else:
|
2013-04-23 20:17:09 +02:00
|
|
|
target_path = abspath(install_path, dst)
|
2012-08-02 01:06:31 +02:00
|
|
|
return path, target_path
|
|
|
|
|
|
|
|
def try_copy(path, dst):
|
|
|
|
source_path, target_path = mkpaths(path, dst)
|
2018-12-03 12:28:31 +01:00
|
|
|
print('installing %s' % target_path)
|
2012-08-02 01:06:31 +02:00
|
|
|
try_mkdir_r(os.path.dirname(target_path))
|
2012-08-04 02:41:32 +02:00
|
|
|
try_unlink(target_path) # prevent ETXTBSY errors
|
2012-08-02 01:06:31 +02:00
|
|
|
return shutil.copy2(source_path, target_path)
|
|
|
|
|
|
|
|
def try_remove(path, dst):
|
|
|
|
source_path, target_path = mkpaths(path, dst)
|
2018-12-03 12:28:31 +01:00
|
|
|
print('removing %s' % target_path)
|
2012-08-02 01:06:31 +02:00
|
|
|
try_unlink(target_path)
|
|
|
|
try_rmdir_r(os.path.dirname(target_path))
|
|
|
|
|
2019-01-19 11:07:54 +01:00
|
|
|
def install(paths, dst):
|
|
|
|
for path in paths:
|
|
|
|
try_copy(path, dst)
|
|
|
|
|
|
|
|
def uninstall(paths, dst):
|
|
|
|
for path in paths:
|
|
|
|
try_remove(path, dst)
|
2012-08-02 01:06:31 +02:00
|
|
|
|
2020-09-28 17:35:09 +02:00
|
|
|
def package_files(action, name, bins):
|
|
|
|
target_path = 'lib/node_modules/' + name + '/'
|
2012-08-02 01:06:31 +02:00
|
|
|
|
|
|
|
# don't install npm if the target path is a symlink, it probably means
|
|
|
|
# that a dev version of npm is installed there
|
2013-04-23 20:17:09 +02:00
|
|
|
if os.path.islink(abspath(install_path, target_path)): return
|
2012-08-02 01:06:31 +02:00
|
|
|
|
|
|
|
# npm has a *lot* of files and it'd be a pain to maintain a fixed list here
|
|
|
|
# so we walk its source directory instead...
|
2020-09-28 17:35:09 +02:00
|
|
|
root = 'deps/' + name
|
|
|
|
for dirname, subdirs, basenames in os.walk(root, topdown=True):
|
2019-01-19 11:07:54 +01:00
|
|
|
subdirs[:] = [subdir for subdir in subdirs if subdir != 'test']
|
2012-08-02 01:06:31 +02:00
|
|
|
paths = [os.path.join(dirname, basename) for basename in basenames]
|
2020-09-28 17:35:09 +02:00
|
|
|
action(paths, target_path + dirname[len(root) + 1:] + '/')
|
|
|
|
|
|
|
|
# create/remove symlinks
|
|
|
|
for bin_name, bin_target in bins.items():
|
|
|
|
link_path = abspath(install_path, 'bin/' + bin_name)
|
|
|
|
if action == uninstall:
|
|
|
|
action([link_path], 'bin/' + bin_name)
|
|
|
|
elif action == install:
|
|
|
|
try_symlink('../lib/node_modules/' + name + '/' + bin_target, link_path)
|
|
|
|
else:
|
|
|
|
assert 0 # unhandled action type
|
|
|
|
|
|
|
|
def npm_files(action):
|
|
|
|
package_files(action, 'npm', {
|
|
|
|
'npm': 'bin/npm-cli.js',
|
|
|
|
'npx': 'bin/npx-cli.js',
|
|
|
|
})
|
|
|
|
|
|
|
|
def corepack_files(action):
|
|
|
|
package_files(action, 'corepack', {
|
|
|
|
'corepack': 'dist/corepack.js',
|
|
|
|
# Not the default just yet:
|
|
|
|
# 'yarn': 'dist/yarn.js',
|
|
|
|
# 'yarnpkg': 'dist/yarn.js',
|
|
|
|
# 'pnpm': 'dist/pnpm.js',
|
|
|
|
# 'pnpx': 'dist/pnpx.js',
|
|
|
|
})
|
2017-07-11 03:53:58 +02:00
|
|
|
|
2022-03-08 19:20:20 +01:00
|
|
|
# On z/OS, we install node-gyp for convenience, as some vendors don't have
|
|
|
|
# external access and may want to build native addons.
|
|
|
|
if sys.platform == 'zos':
|
|
|
|
link_path = abspath(install_path, 'bin/node-gyp')
|
|
|
|
if action == uninstall:
|
|
|
|
action([link_path], 'bin/node-gyp')
|
|
|
|
elif action == install:
|
|
|
|
try_symlink('../lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js', link_path)
|
|
|
|
else:
|
|
|
|
assert 0 # unhandled action type
|
|
|
|
|
2013-10-10 23:42:41 +02:00
|
|
|
def subdir_files(path, dest, action):
|
|
|
|
ret = {}
|
|
|
|
for dirpath, dirnames, filenames in os.walk(path):
|
2019-04-14 00:09:45 +02:00
|
|
|
files_in_path = [dirpath + '/' + f for f in filenames if f.endswith('.h')]
|
|
|
|
ret[dest + dirpath.replace(path, '')] = files_in_path
|
|
|
|
for subdir, files_in_path in ret.items():
|
|
|
|
action(files_in_path, subdir + '/')
|
2013-10-10 23:42:41 +02:00
|
|
|
|
2012-08-02 01:06:31 +02:00
|
|
|
def files(action):
|
2015-01-08 14:21:26 +01:00
|
|
|
is_windows = sys.platform == 'win32'
|
2016-03-27 01:17:55 +01:00
|
|
|
output_file = 'node'
|
|
|
|
output_prefix = 'out/Release/'
|
2015-01-08 14:21:26 +01:00
|
|
|
|
build: fix various shared library build issues
Node.js unofficially supports a shared library variant where the
main node executable is a thin wrapper around node.dll/libnode.so.
The key benefit of this is to support embedding Node.js in other
applications.
Since Node.js 12 there have been a number of issues preventing the
shared library build from working correctly, primarily on Windows:
* A number of functions used executables such as `mksnapshot` are
not exported from `libnode.dll` using a `NODE_EXTERN` attribute
* A dependency on the `Winmm` system library is missing
* Incorrect defines on executable targets leads to `node.exe`
claiming to export a number of functions that are actually in
`libnode.dll`
* Because `node.exe` attempts to export symbols, `node.lib` gets
generated causing native extensions to try to link against
`node.exe` not `libnode.dll`.
* Similarly, because `node.dll` was renamed to `libnode.dll`,
native extensions don't know to look for `libnode.lib` rather
than `node.lib`.
* On macOS an RPATH is added to find `libnode.dylib` relative to
`node` in the same folder. This works fine from the
`out/Release` folder but not from an installed prefix, where
`node` will be in `bin/` and `libnode.dylib` will be in `lib/`.
* Similarly on Linux, no RPATH is added so LD_LIBRARY_PATH needs
setting correctly for `bin/node` to find `lib/libnode.so`.
For the `libnode.lib` vs `node.lib` issue there are two possible
options:
1. Ensure `node.lib` from `node.exe` does not get generated, and
instead copy `libnode.lib` to `node.lib`. This means addons
compiled when referencing the correct `node.lib` file will
correctly depend on `libnode.dll`. The down side is that
native addons compiled with stock Node.js will still try to
resolve symbols against node.exe rather than libnode.dll.
2. After building `libnode.dll`, dump the exports using `dumpbin`,
and process this to generate a `node.def` file to be linked into
`node.exe` with the `/DEF:node.def` flag. The export entries
in `node.def` will all read
```
my_symbol=libnode.my_symbol
```
so that `node.exe` will redirect all exported symbols back to
`libnode.dll`. This has the benefit that addons compiled with
stock Node.js will load correctly into `node.exe` from a shared
library build, but means that every embedding executable also
needs to perform this same trick.
I went with the first option as it is the cleaner of the two
solutions in my opinion. Projects wishing to generate a shared
library variant of Node.js can now, for example,
```
.\vcbuild dll package vs
```
to generate a full node installation including `libnode.dll`,
`Release\node.lib`, and all the necessary headers. Native addons
can then be built against the shared library build easily by
specifying the correct `nodedir` option.
For example
```
>npx node-gyp configure --nodedir
C:\Users\User\node\Release\node-v18.0.0-win-x64
...
>npx node-gyp build
...
>dumpbin /dependents build\Release\binding.node
Microsoft (R) COFF/PE Dumper Version 14.29.30136.0
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file build\Release\binding.node
File Type: DLL
Image has the following dependencies:
KERNEL32.dll
libnode.dll
VCRUNTIME140.dll
api-ms-win-crt-string-l1-1-0.dll
api-ms-win-crt-stdio-l1-1-0.dll
api-ms-win-crt-runtime-l1-1-0.dll
...
```
PR-URL: https://github.com/nodejs/node/pull/41850
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Beth Griggs <bgriggs@redhat.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
2022-02-04 11:12:57 +01:00
|
|
|
if is_windows:
|
|
|
|
output_file += '.exe'
|
|
|
|
action([output_prefix + output_file], 'bin/' + output_file)
|
|
|
|
|
|
|
|
if 'true' == variables.get('node_shared'):
|
2016-03-27 01:17:55 +01:00
|
|
|
if is_windows:
|
build: fix various shared library build issues
Node.js unofficially supports a shared library variant where the
main node executable is a thin wrapper around node.dll/libnode.so.
The key benefit of this is to support embedding Node.js in other
applications.
Since Node.js 12 there have been a number of issues preventing the
shared library build from working correctly, primarily on Windows:
* A number of functions used executables such as `mksnapshot` are
not exported from `libnode.dll` using a `NODE_EXTERN` attribute
* A dependency on the `Winmm` system library is missing
* Incorrect defines on executable targets leads to `node.exe`
claiming to export a number of functions that are actually in
`libnode.dll`
* Because `node.exe` attempts to export symbols, `node.lib` gets
generated causing native extensions to try to link against
`node.exe` not `libnode.dll`.
* Similarly, because `node.dll` was renamed to `libnode.dll`,
native extensions don't know to look for `libnode.lib` rather
than `node.lib`.
* On macOS an RPATH is added to find `libnode.dylib` relative to
`node` in the same folder. This works fine from the
`out/Release` folder but not from an installed prefix, where
`node` will be in `bin/` and `libnode.dylib` will be in `lib/`.
* Similarly on Linux, no RPATH is added so LD_LIBRARY_PATH needs
setting correctly for `bin/node` to find `lib/libnode.so`.
For the `libnode.lib` vs `node.lib` issue there are two possible
options:
1. Ensure `node.lib` from `node.exe` does not get generated, and
instead copy `libnode.lib` to `node.lib`. This means addons
compiled when referencing the correct `node.lib` file will
correctly depend on `libnode.dll`. The down side is that
native addons compiled with stock Node.js will still try to
resolve symbols against node.exe rather than libnode.dll.
2. After building `libnode.dll`, dump the exports using `dumpbin`,
and process this to generate a `node.def` file to be linked into
`node.exe` with the `/DEF:node.def` flag. The export entries
in `node.def` will all read
```
my_symbol=libnode.my_symbol
```
so that `node.exe` will redirect all exported symbols back to
`libnode.dll`. This has the benefit that addons compiled with
stock Node.js will load correctly into `node.exe` from a shared
library build, but means that every embedding executable also
needs to perform this same trick.
I went with the first option as it is the cleaner of the two
solutions in my opinion. Projects wishing to generate a shared
library variant of Node.js can now, for example,
```
.\vcbuild dll package vs
```
to generate a full node installation including `libnode.dll`,
`Release\node.lib`, and all the necessary headers. Native addons
can then be built against the shared library build easily by
specifying the correct `nodedir` option.
For example
```
>npx node-gyp configure --nodedir
C:\Users\User\node\Release\node-v18.0.0-win-x64
...
>npx node-gyp build
...
>dumpbin /dependents build\Release\binding.node
Microsoft (R) COFF/PE Dumper Version 14.29.30136.0
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file build\Release\binding.node
File Type: DLL
Image has the following dependencies:
KERNEL32.dll
libnode.dll
VCRUNTIME140.dll
api-ms-win-crt-string-l1-1-0.dll
api-ms-win-crt-stdio-l1-1-0.dll
api-ms-win-crt-runtime-l1-1-0.dll
...
```
PR-URL: https://github.com/nodejs/node/pull/41850
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Beth Griggs <bgriggs@redhat.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
2022-02-04 11:12:57 +01:00
|
|
|
action([output_prefix + 'libnode.dll'], 'bin/libnode.dll')
|
|
|
|
action([output_prefix + 'libnode.lib'], 'lib/libnode.lib')
|
2022-03-08 19:20:20 +01:00
|
|
|
elif sys.platform == 'zos':
|
|
|
|
# GYP will output to lib.target; see _InstallableTargetInstallPath
|
|
|
|
# function in tools/gyp/pylib/gyp/generator/make.py
|
|
|
|
output_prefix += 'lib.target/'
|
|
|
|
|
|
|
|
output_lib = 'libnode.' + variables.get('shlib_suffix')
|
|
|
|
action([output_prefix + output_lib], 'lib/' + output_lib)
|
|
|
|
|
|
|
|
# create libnode.x that references libnode.so (C++ addons compat)
|
|
|
|
os.system(os.path.dirname(os.path.realpath(__file__)) +
|
|
|
|
'/zos/modifysidedeck.sh ' +
|
|
|
|
abspath(install_path, 'lib/' + output_lib) + ' ' +
|
|
|
|
abspath(install_path, 'lib/libnode.x') + ' libnode.so')
|
|
|
|
|
|
|
|
# install libnode.version.so
|
|
|
|
so_name = 'libnode.' + re.sub(r'\.x$', '.so', variables.get('shlib_suffix'))
|
2022-08-28 10:12:42 +02:00
|
|
|
action([output_prefix + so_name], variables.get('libdir') + '/' + so_name)
|
2022-03-08 19:20:20 +01:00
|
|
|
|
|
|
|
# create symlink of libnode.so -> libnode.version.so (C++ addons compat)
|
|
|
|
link_path = abspath(install_path, 'lib/libnode.so')
|
|
|
|
try_symlink(so_name, link_path)
|
2016-03-27 01:17:55 +01:00
|
|
|
else:
|
build: fix various shared library build issues
Node.js unofficially supports a shared library variant where the
main node executable is a thin wrapper around node.dll/libnode.so.
The key benefit of this is to support embedding Node.js in other
applications.
Since Node.js 12 there have been a number of issues preventing the
shared library build from working correctly, primarily on Windows:
* A number of functions used executables such as `mksnapshot` are
not exported from `libnode.dll` using a `NODE_EXTERN` attribute
* A dependency on the `Winmm` system library is missing
* Incorrect defines on executable targets leads to `node.exe`
claiming to export a number of functions that are actually in
`libnode.dll`
* Because `node.exe` attempts to export symbols, `node.lib` gets
generated causing native extensions to try to link against
`node.exe` not `libnode.dll`.
* Similarly, because `node.dll` was renamed to `libnode.dll`,
native extensions don't know to look for `libnode.lib` rather
than `node.lib`.
* On macOS an RPATH is added to find `libnode.dylib` relative to
`node` in the same folder. This works fine from the
`out/Release` folder but not from an installed prefix, where
`node` will be in `bin/` and `libnode.dylib` will be in `lib/`.
* Similarly on Linux, no RPATH is added so LD_LIBRARY_PATH needs
setting correctly for `bin/node` to find `lib/libnode.so`.
For the `libnode.lib` vs `node.lib` issue there are two possible
options:
1. Ensure `node.lib` from `node.exe` does not get generated, and
instead copy `libnode.lib` to `node.lib`. This means addons
compiled when referencing the correct `node.lib` file will
correctly depend on `libnode.dll`. The down side is that
native addons compiled with stock Node.js will still try to
resolve symbols against node.exe rather than libnode.dll.
2. After building `libnode.dll`, dump the exports using `dumpbin`,
and process this to generate a `node.def` file to be linked into
`node.exe` with the `/DEF:node.def` flag. The export entries
in `node.def` will all read
```
my_symbol=libnode.my_symbol
```
so that `node.exe` will redirect all exported symbols back to
`libnode.dll`. This has the benefit that addons compiled with
stock Node.js will load correctly into `node.exe` from a shared
library build, but means that every embedding executable also
needs to perform this same trick.
I went with the first option as it is the cleaner of the two
solutions in my opinion. Projects wishing to generate a shared
library variant of Node.js can now, for example,
```
.\vcbuild dll package vs
```
to generate a full node installation including `libnode.dll`,
`Release\node.lib`, and all the necessary headers. Native addons
can then be built against the shared library build easily by
specifying the correct `nodedir` option.
For example
```
>npx node-gyp configure --nodedir
C:\Users\User\node\Release\node-v18.0.0-win-x64
...
>npx node-gyp build
...
>dumpbin /dependents build\Release\binding.node
Microsoft (R) COFF/PE Dumper Version 14.29.30136.0
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file build\Release\binding.node
File Type: DLL
Image has the following dependencies:
KERNEL32.dll
libnode.dll
VCRUNTIME140.dll
api-ms-win-crt-string-l1-1-0.dll
api-ms-win-crt-stdio-l1-1-0.dll
api-ms-win-crt-runtime-l1-1-0.dll
...
```
PR-URL: https://github.com/nodejs/node/pull/41850
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Beth Griggs <bgriggs@redhat.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
2022-02-04 11:12:57 +01:00
|
|
|
output_lib = 'libnode.' + variables.get('shlib_suffix')
|
2022-08-28 10:12:42 +02:00
|
|
|
action([output_prefix + output_lib], variables.get('libdir') + '/' + output_lib)
|
2012-08-02 01:06:31 +02:00
|
|
|
|
2015-07-06 18:41:04 +02:00
|
|
|
action(['deps/v8/tools/gdbinit'], 'share/doc/node/')
|
2017-03-27 09:37:42 +02:00
|
|
|
action(['deps/v8/tools/lldb_commands.py'], 'share/doc/node/')
|
2015-07-06 18:41:04 +02:00
|
|
|
|
2012-12-17 12:05:14 +01:00
|
|
|
if 'freebsd' in sys.platform or 'openbsd' in sys.platform:
|
2015-08-13 18:14:34 +02:00
|
|
|
action(['doc/node.1'], 'man/man1/')
|
2012-12-02 02:54:14 +01:00
|
|
|
else:
|
2015-08-13 18:14:34 +02:00
|
|
|
action(['doc/node.1'], 'share/man/man1/')
|
2012-12-02 02:54:14 +01:00
|
|
|
|
2020-09-28 17:35:09 +02:00
|
|
|
if 'true' == variables.get('node_install_npm'):
|
|
|
|
npm_files(action)
|
2021-12-05 11:23:25 +01:00
|
|
|
|
|
|
|
if 'true' == variables.get('node_install_corepack'):
|
2020-09-28 17:35:09 +02:00
|
|
|
corepack_files(action)
|
2012-08-02 01:06:31 +02:00
|
|
|
|
2015-06-14 12:23:43 +02:00
|
|
|
headers(action)
|
|
|
|
|
|
|
|
def headers(action):
|
build: include minimal V8 headers in distribution
Because Node.js currently distributes all V8 headers, it is not clear
which ones are part of our API and ABI compatibility contract. V8 may
add, remove, or change headers at any time, preventing us sometimes
from updating because the change could affect addons which may depend
on them. Moreover, the `cppgc` library, included in V8, is exposed
even though it is still in active development and doesn't have a
stable API.
Node.js should choose exactly which headers are exposed and part of
our native API, so that it's easier to reason about changes during V8
updates and to prevent us from automatically increasing the API
surface when new headers are added by V8.
Instead of specifically excluding v8-inspector, only include `v8.h`,
`v8-platform.h` (used in `node.h`) and `v8-profiler.h`.
PR-URL: https://github.com/nodejs/node/pull/37570
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
Reviewed-By: Mary Marchini <oss@mmarchini.me>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
2021-03-02 14:44:49 +01:00
|
|
|
def wanted_v8_headers(files_arg, dest):
|
|
|
|
v8_headers = [
|
2023-08-11 02:43:51 +02:00
|
|
|
# The internal cppgc headers are depended on by the public
|
|
|
|
# ones, so they need to be included as well.
|
|
|
|
'deps/v8/include/cppgc/internal/api-constants.h',
|
|
|
|
'deps/v8/include/cppgc/internal/atomic-entry-flag.h',
|
|
|
|
'deps/v8/include/cppgc/internal/base-page-handle.h',
|
|
|
|
'deps/v8/include/cppgc/internal/caged-heap-local-data.h',
|
|
|
|
'deps/v8/include/cppgc/internal/caged-heap.h',
|
|
|
|
'deps/v8/include/cppgc/internal/compiler-specific.h',
|
|
|
|
'deps/v8/include/cppgc/internal/finalizer-trait.h',
|
|
|
|
'deps/v8/include/cppgc/internal/gc-info.h',
|
|
|
|
'deps/v8/include/cppgc/internal/logging.h',
|
|
|
|
'deps/v8/include/cppgc/internal/member-storage.h',
|
|
|
|
'deps/v8/include/cppgc/internal/name-trait.h',
|
|
|
|
'deps/v8/include/cppgc/internal/persistent-node.h',
|
|
|
|
'deps/v8/include/cppgc/internal/pointer-policies.h',
|
|
|
|
'deps/v8/include/cppgc/internal/write-barrier.h',
|
|
|
|
# cppgc headers
|
|
|
|
'deps/v8/include/cppgc/allocation.h',
|
build: include minimal V8 headers in distribution
Because Node.js currently distributes all V8 headers, it is not clear
which ones are part of our API and ABI compatibility contract. V8 may
add, remove, or change headers at any time, preventing us sometimes
from updating because the change could affect addons which may depend
on them. Moreover, the `cppgc` library, included in V8, is exposed
even though it is still in active development and doesn't have a
stable API.
Node.js should choose exactly which headers are exposed and part of
our native API, so that it's easier to reason about changes during V8
updates and to prevent us from automatically increasing the API
surface when new headers are added by V8.
Instead of specifically excluding v8-inspector, only include `v8.h`,
`v8-platform.h` (used in `node.h`) and `v8-profiler.h`.
PR-URL: https://github.com/nodejs/node/pull/37570
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
Reviewed-By: Mary Marchini <oss@mmarchini.me>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
2021-03-02 14:44:49 +01:00
|
|
|
'deps/v8/include/cppgc/common.h',
|
2023-08-11 02:43:51 +02:00
|
|
|
'deps/v8/include/cppgc/cross-thread-persistent.h',
|
|
|
|
'deps/v8/include/cppgc/custom-space.h',
|
|
|
|
'deps/v8/include/cppgc/default-platform.h',
|
|
|
|
'deps/v8/include/cppgc/ephemeron-pair.h',
|
|
|
|
'deps/v8/include/cppgc/explicit-management.h',
|
|
|
|
'deps/v8/include/cppgc/garbage-collected.h',
|
|
|
|
'deps/v8/include/cppgc/heap-consistency.h',
|
|
|
|
'deps/v8/include/cppgc/heap-handle.h',
|
|
|
|
'deps/v8/include/cppgc/heap-state.h',
|
|
|
|
'deps/v8/include/cppgc/heap-statistics.h',
|
|
|
|
'deps/v8/include/cppgc/heap.h',
|
|
|
|
'deps/v8/include/cppgc/liveness-broker.h',
|
|
|
|
'deps/v8/include/cppgc/macros.h',
|
|
|
|
'deps/v8/include/cppgc/member.h',
|
|
|
|
'deps/v8/include/cppgc/name-provider.h',
|
|
|
|
'deps/v8/include/cppgc/object-size-trait.h',
|
|
|
|
'deps/v8/include/cppgc/persistent.h',
|
|
|
|
'deps/v8/include/cppgc/platform.h',
|
|
|
|
'deps/v8/include/cppgc/prefinalizer.h',
|
|
|
|
'deps/v8/include/cppgc/process-heap-statistics.h',
|
|
|
|
'deps/v8/include/cppgc/sentinel-pointer.h',
|
|
|
|
'deps/v8/include/cppgc/source-location.h',
|
|
|
|
'deps/v8/include/cppgc/testing.h',
|
|
|
|
'deps/v8/include/cppgc/trace-trait.h',
|
|
|
|
'deps/v8/include/cppgc/type-traits.h',
|
|
|
|
'deps/v8/include/cppgc/visitor.h',
|
|
|
|
# libplatform headers
|
2021-07-06 16:09:25 +02:00
|
|
|
'deps/v8/include/libplatform/libplatform-export.h',
|
2023-08-11 02:43:51 +02:00
|
|
|
'deps/v8/include/libplatform/libplatform.h',
|
2021-07-06 16:09:25 +02:00
|
|
|
'deps/v8/include/libplatform/v8-tracing.h',
|
2023-08-11 02:43:51 +02:00
|
|
|
# v8 headers
|
2021-10-12 09:01:47 +02:00
|
|
|
'deps/v8/include/v8-array-buffer.h',
|
2021-10-19 22:50:35 +02:00
|
|
|
'deps/v8/include/v8-callbacks.h',
|
2021-10-12 09:01:47 +02:00
|
|
|
'deps/v8/include/v8-container.h',
|
|
|
|
'deps/v8/include/v8-context.h',
|
2023-08-11 02:43:51 +02:00
|
|
|
'deps/v8/include/v8-cppgc.h',
|
2021-10-12 09:01:47 +02:00
|
|
|
'deps/v8/include/v8-data.h',
|
|
|
|
'deps/v8/include/v8-date.h',
|
|
|
|
'deps/v8/include/v8-debug.h',
|
2021-10-19 22:50:35 +02:00
|
|
|
'deps/v8/include/v8-embedder-heap.h',
|
2022-01-20 12:00:44 +01:00
|
|
|
'deps/v8/include/v8-embedder-state-scope.h',
|
2021-10-12 09:01:47 +02:00
|
|
|
'deps/v8/include/v8-exception.h',
|
|
|
|
'deps/v8/include/v8-extension.h',
|
|
|
|
'deps/v8/include/v8-external.h',
|
2021-10-19 22:50:35 +02:00
|
|
|
'deps/v8/include/v8-forward.h',
|
|
|
|
'deps/v8/include/v8-function-callback.h',
|
2021-10-12 09:01:47 +02:00
|
|
|
'deps/v8/include/v8-function.h',
|
|
|
|
'deps/v8/include/v8-initialization.h',
|
build: include minimal V8 headers in distribution
Because Node.js currently distributes all V8 headers, it is not clear
which ones are part of our API and ABI compatibility contract. V8 may
add, remove, or change headers at any time, preventing us sometimes
from updating because the change could affect addons which may depend
on them. Moreover, the `cppgc` library, included in V8, is exposed
even though it is still in active development and doesn't have a
stable API.
Node.js should choose exactly which headers are exposed and part of
our native API, so that it's easier to reason about changes during V8
updates and to prevent us from automatically increasing the API
surface when new headers are added by V8.
Instead of specifically excluding v8-inspector, only include `v8.h`,
`v8-platform.h` (used in `node.h`) and `v8-profiler.h`.
PR-URL: https://github.com/nodejs/node/pull/37570
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
Reviewed-By: Mary Marchini <oss@mmarchini.me>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
2021-03-02 14:44:49 +01:00
|
|
|
'deps/v8/include/v8-internal.h',
|
2021-10-12 09:01:47 +02:00
|
|
|
'deps/v8/include/v8-isolate.h',
|
|
|
|
'deps/v8/include/v8-json.h',
|
|
|
|
'deps/v8/include/v8-local-handle.h',
|
|
|
|
'deps/v8/include/v8-locker.h',
|
|
|
|
'deps/v8/include/v8-maybe.h',
|
|
|
|
'deps/v8/include/v8-memory-span.h',
|
|
|
|
'deps/v8/include/v8-message.h',
|
|
|
|
'deps/v8/include/v8-microtask-queue.h',
|
|
|
|
'deps/v8/include/v8-microtask.h',
|
|
|
|
'deps/v8/include/v8-object.h',
|
|
|
|
'deps/v8/include/v8-persistent-handle.h',
|
build: include minimal V8 headers in distribution
Because Node.js currently distributes all V8 headers, it is not clear
which ones are part of our API and ABI compatibility contract. V8 may
add, remove, or change headers at any time, preventing us sometimes
from updating because the change could affect addons which may depend
on them. Moreover, the `cppgc` library, included in V8, is exposed
even though it is still in active development and doesn't have a
stable API.
Node.js should choose exactly which headers are exposed and part of
our native API, so that it's easier to reason about changes during V8
updates and to prevent us from automatically increasing the API
surface when new headers are added by V8.
Instead of specifically excluding v8-inspector, only include `v8.h`,
`v8-platform.h` (used in `node.h`) and `v8-profiler.h`.
PR-URL: https://github.com/nodejs/node/pull/37570
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
Reviewed-By: Mary Marchini <oss@mmarchini.me>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
2021-03-02 14:44:49 +01:00
|
|
|
'deps/v8/include/v8-platform.h',
|
2021-10-12 09:01:47 +02:00
|
|
|
'deps/v8/include/v8-primitive-object.h',
|
|
|
|
'deps/v8/include/v8-primitive.h',
|
build: include minimal V8 headers in distribution
Because Node.js currently distributes all V8 headers, it is not clear
which ones are part of our API and ABI compatibility contract. V8 may
add, remove, or change headers at any time, preventing us sometimes
from updating because the change could affect addons which may depend
on them. Moreover, the `cppgc` library, included in V8, is exposed
even though it is still in active development and doesn't have a
stable API.
Node.js should choose exactly which headers are exposed and part of
our native API, so that it's easier to reason about changes during V8
updates and to prevent us from automatically increasing the API
surface when new headers are added by V8.
Instead of specifically excluding v8-inspector, only include `v8.h`,
`v8-platform.h` (used in `node.h`) and `v8-profiler.h`.
PR-URL: https://github.com/nodejs/node/pull/37570
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
Reviewed-By: Mary Marchini <oss@mmarchini.me>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
2021-03-02 14:44:49 +01:00
|
|
|
'deps/v8/include/v8-profiler.h',
|
2021-10-12 09:01:47 +02:00
|
|
|
'deps/v8/include/v8-promise.h',
|
|
|
|
'deps/v8/include/v8-proxy.h',
|
|
|
|
'deps/v8/include/v8-regexp.h',
|
|
|
|
'deps/v8/include/v8-script.h',
|
|
|
|
'deps/v8/include/v8-snapshot.h',
|
|
|
|
'deps/v8/include/v8-statistics.h',
|
|
|
|
'deps/v8/include/v8-template.h',
|
|
|
|
'deps/v8/include/v8-traced-handle.h',
|
|
|
|
'deps/v8/include/v8-typed-array.h',
|
|
|
|
'deps/v8/include/v8-unwinder.h',
|
|
|
|
'deps/v8/include/v8-value-serializer.h',
|
|
|
|
'deps/v8/include/v8-value.h',
|
build: include minimal V8 headers in distribution
Because Node.js currently distributes all V8 headers, it is not clear
which ones are part of our API and ABI compatibility contract. V8 may
add, remove, or change headers at any time, preventing us sometimes
from updating because the change could affect addons which may depend
on them. Moreover, the `cppgc` library, included in V8, is exposed
even though it is still in active development and doesn't have a
stable API.
Node.js should choose exactly which headers are exposed and part of
our native API, so that it's easier to reason about changes during V8
updates and to prevent us from automatically increasing the API
surface when new headers are added by V8.
Instead of specifically excluding v8-inspector, only include `v8.h`,
`v8-platform.h` (used in `node.h`) and `v8-profiler.h`.
PR-URL: https://github.com/nodejs/node/pull/37570
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
Reviewed-By: Mary Marchini <oss@mmarchini.me>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
2021-03-02 14:44:49 +01:00
|
|
|
'deps/v8/include/v8-version.h',
|
2021-10-12 09:01:47 +02:00
|
|
|
'deps/v8/include/v8-wasm.h',
|
2021-10-19 22:50:35 +02:00
|
|
|
'deps/v8/include/v8-weak-callback-info.h',
|
2023-08-11 02:43:51 +02:00
|
|
|
'deps/v8/include/v8.h',
|
build: include minimal V8 headers in distribution
Because Node.js currently distributes all V8 headers, it is not clear
which ones are part of our API and ABI compatibility contract. V8 may
add, remove, or change headers at any time, preventing us sometimes
from updating because the change could affect addons which may depend
on them. Moreover, the `cppgc` library, included in V8, is exposed
even though it is still in active development and doesn't have a
stable API.
Node.js should choose exactly which headers are exposed and part of
our native API, so that it's easier to reason about changes during V8
updates and to prevent us from automatically increasing the API
surface when new headers are added by V8.
Instead of specifically excluding v8-inspector, only include `v8.h`,
`v8-platform.h` (used in `node.h`) and `v8-profiler.h`.
PR-URL: https://github.com/nodejs/node/pull/37570
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
Reviewed-By: Mary Marchini <oss@mmarchini.me>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
2021-03-02 14:44:49 +01:00
|
|
|
'deps/v8/include/v8config.h',
|
2018-08-29 18:31:25 +02:00
|
|
|
]
|
build: include minimal V8 headers in distribution
Because Node.js currently distributes all V8 headers, it is not clear
which ones are part of our API and ABI compatibility contract. V8 may
add, remove, or change headers at any time, preventing us sometimes
from updating because the change could affect addons which may depend
on them. Moreover, the `cppgc` library, included in V8, is exposed
even though it is still in active development and doesn't have a
stable API.
Node.js should choose exactly which headers are exposed and part of
our native API, so that it's easier to reason about changes during V8
updates and to prevent us from automatically increasing the API
surface when new headers are added by V8.
Instead of specifically excluding v8-inspector, only include `v8.h`,
`v8-platform.h` (used in `node.h`) and `v8-profiler.h`.
PR-URL: https://github.com/nodejs/node/pull/37570
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
Reviewed-By: Mary Marchini <oss@mmarchini.me>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
2021-03-02 14:44:49 +01:00
|
|
|
files_arg = [name for name in files_arg if name in v8_headers]
|
2019-04-14 00:09:45 +02:00
|
|
|
action(files_arg, dest)
|
2018-08-29 18:31:25 +02:00
|
|
|
|
2022-01-12 21:30:05 +01:00
|
|
|
def wanted_zoslib_headers(files_arg, dest):
|
|
|
|
import glob
|
|
|
|
zoslib_headers = glob.glob(zoslibinc + '/*.h')
|
|
|
|
files_arg = [name for name in files_arg if name in zoslib_headers]
|
|
|
|
action(files_arg, dest)
|
|
|
|
|
2013-10-10 23:42:41 +02:00
|
|
|
action([
|
2013-12-20 09:29:06 +01:00
|
|
|
'common.gypi',
|
2013-10-10 23:42:41 +02:00
|
|
|
'config.gypi',
|
|
|
|
'src/node.h',
|
2017-03-20 22:55:26 +01:00
|
|
|
'src/node_api.h',
|
2018-10-19 21:10:59 +02:00
|
|
|
'src/js_native_api.h',
|
|
|
|
'src/js_native_api_types.h',
|
2017-03-20 22:55:26 +01:00
|
|
|
'src/node_api_types.h',
|
2013-10-10 23:42:41 +02:00
|
|
|
'src/node_buffer.h',
|
|
|
|
'src/node_object_wrap.h',
|
|
|
|
'src/node_version.h',
|
|
|
|
], 'include/node/')
|
|
|
|
|
2015-09-29 16:22:00 +02:00
|
|
|
# Add the expfile that is created on AIX
|
2023-02-22 05:18:56 +01:00
|
|
|
if sys.platform.startswith('aix') or sys.platform == "os400":
|
2015-09-29 16:22:00 +02:00
|
|
|
action(['out/Release/node.exp'], 'include/node/')
|
|
|
|
|
build: include minimal V8 headers in distribution
Because Node.js currently distributes all V8 headers, it is not clear
which ones are part of our API and ABI compatibility contract. V8 may
add, remove, or change headers at any time, preventing us sometimes
from updating because the change could affect addons which may depend
on them. Moreover, the `cppgc` library, included in V8, is exposed
even though it is still in active development and doesn't have a
stable API.
Node.js should choose exactly which headers are exposed and part of
our native API, so that it's easier to reason about changes during V8
updates and to prevent us from automatically increasing the API
surface when new headers are added by V8.
Instead of specifically excluding v8-inspector, only include `v8.h`,
`v8-platform.h` (used in `node.h`) and `v8-profiler.h`.
PR-URL: https://github.com/nodejs/node/pull/37570
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
Reviewed-By: Mary Marchini <oss@mmarchini.me>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
2021-03-02 14:44:49 +01:00
|
|
|
subdir_files('deps/v8/include', 'include/node/', wanted_v8_headers)
|
2013-10-10 23:42:41 +02:00
|
|
|
|
|
|
|
if 'false' == variables.get('node_shared_libuv'):
|
|
|
|
subdir_files('deps/uv/include', 'include/node/', action)
|
|
|
|
|
2017-03-09 10:31:54 +01:00
|
|
|
if 'true' == variables.get('node_use_openssl') and \
|
|
|
|
'false' == variables.get('node_shared_openssl'):
|
2015-04-06 09:14:27 +02:00
|
|
|
subdir_files('deps/openssl/openssl/include/openssl', 'include/node/openssl/', action)
|
2015-04-08 10:56:52 +02:00
|
|
|
subdir_files('deps/openssl/config/archs', 'include/node/openssl/archs', action)
|
2018-03-14 03:25:48 +01:00
|
|
|
subdir_files('deps/openssl/config', 'include/node/openssl', action)
|
2013-10-10 23:42:41 +02:00
|
|
|
|
|
|
|
if 'false' == variables.get('node_shared_zlib'):
|
|
|
|
action([
|
|
|
|
'deps/zlib/zconf.h',
|
|
|
|
'deps/zlib/zlib.h',
|
|
|
|
], 'include/node/')
|
|
|
|
|
2022-01-12 21:30:05 +01:00
|
|
|
if sys.platform == 'zos':
|
|
|
|
zoslibinc = os.environ.get('ZOSLIB_INCLUDES')
|
|
|
|
if not zoslibinc:
|
|
|
|
raise RuntimeError('Environment variable ZOSLIB_INCLUDES is not set\n')
|
|
|
|
if not os.path.isfile(zoslibinc + '/zos-base.h'):
|
|
|
|
raise RuntimeError('ZOSLIB_INCLUDES is not set to a valid location\n')
|
|
|
|
subdir_files(zoslibinc, 'include/node/zoslib/', wanted_zoslib_headers)
|
|
|
|
|
2012-08-02 01:06:31 +02:00
|
|
|
def run(args):
|
2013-04-23 20:17:09 +02:00
|
|
|
global node_prefix, install_path, target_defaults, variables
|
2012-08-02 01:06:31 +02:00
|
|
|
|
|
|
|
# chdir to the project's top-level directory
|
|
|
|
os.chdir(abspath(os.path.dirname(__file__), '..'))
|
|
|
|
|
|
|
|
conf = load_config()
|
|
|
|
variables = conf['variables']
|
|
|
|
target_defaults = conf['target_defaults']
|
|
|
|
|
|
|
|
# argv[2] is a custom install prefix for packagers (think DESTDIR)
|
2013-04-23 20:17:09 +02:00
|
|
|
# argv[3] is a custom install prefix (think PREFIX)
|
|
|
|
# Difference is that dst_dir won't be included in shebang lines etc.
|
2015-05-05 19:23:56 +02:00
|
|
|
dst_dir = args[2] if len(args) > 2 else ''
|
|
|
|
|
2013-04-23 20:17:09 +02:00
|
|
|
if len(args) > 3:
|
|
|
|
node_prefix = args[3]
|
|
|
|
|
|
|
|
# install_path thus becomes the base target directory.
|
|
|
|
install_path = dst_dir + node_prefix + '/'
|
2012-08-02 01:06:31 +02:00
|
|
|
|
|
|
|
cmd = args[1] if len(args) > 1 else 'install'
|
2015-06-14 12:23:43 +02:00
|
|
|
|
|
|
|
if os.environ.get('HEADERS_ONLY'):
|
2020-12-25 14:05:28 +01:00
|
|
|
if cmd == 'install':
|
|
|
|
headers(install)
|
|
|
|
return
|
|
|
|
if cmd == 'uninstall':
|
|
|
|
headers(uninstall)
|
|
|
|
return
|
2015-06-14 12:23:43 +02:00
|
|
|
else:
|
2020-12-25 14:05:28 +01:00
|
|
|
if cmd == 'install':
|
|
|
|
files(install)
|
|
|
|
return
|
|
|
|
if cmd == 'uninstall':
|
|
|
|
files(uninstall)
|
|
|
|
return
|
2015-06-14 12:23:43 +02:00
|
|
|
|
2012-08-02 01:06:31 +02:00
|
|
|
raise RuntimeError('Bad command: %s\n' % cmd)
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
run(sys.argv[:])
|