2012-08-01 23:06:31 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
2018-12-03 11:28:31 +00:00
|
|
|
from __future__ import print_function
|
2019-04-13 22:09:45 +00:00
|
|
|
|
2018-04-30 12:08:28 +00:00
|
|
|
import ast
|
2012-08-01 23:06:31 +00:00
|
|
|
import errno
|
|
|
|
import os
|
|
|
|
import shutil
|
|
|
|
import sys
|
|
|
|
|
|
|
|
# set at init time
|
2013-04-23 18:17:09 +00:00
|
|
|
node_prefix = '/usr/local' # PREFIX variable from Makefile
|
2019-04-13 22:09:45 +00:00
|
|
|
install_path = '' # base target directory (DESTDIR + PREFIX from Makefile)
|
2012-08-01 23:06:31 +00: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 13:05:28 +00:00
|
|
|
with open('config.gypi') as f:
|
|
|
|
return ast.literal_eval(f.read())
|
2012-08-01 23:06:31 +00:00
|
|
|
|
|
|
|
def try_unlink(path):
|
|
|
|
try:
|
|
|
|
os.unlink(path)
|
2018-12-03 11:28:31 +00:00
|
|
|
except OSError as e:
|
2012-08-01 23:06:31 +00:00
|
|
|
if e.errno != errno.ENOENT: raise
|
|
|
|
|
|
|
|
def try_symlink(source_path, link_path):
|
2018-12-03 11:28:31 +00:00
|
|
|
print('symlinking %s -> %s' % (source_path, link_path))
|
2012-08-01 23:06:31 +00:00
|
|
|
try_unlink(link_path)
|
2017-10-24 11:01:50 +00:00
|
|
|
try_mkdir_r(os.path.dirname(link_path))
|
2012-08-01 23:06:31 +00:00
|
|
|
os.symlink(source_path, link_path)
|
|
|
|
|
|
|
|
def try_mkdir_r(path):
|
|
|
|
try:
|
|
|
|
os.makedirs(path)
|
2018-12-03 11:28:31 +00:00
|
|
|
except OSError as e:
|
2012-08-01 23:06:31 +00:00
|
|
|
if e.errno != errno.EEXIST: raise
|
|
|
|
|
|
|
|
def try_rmdir_r(path):
|
|
|
|
path = abspath(path)
|
2013-04-23 18:17:09 +00:00
|
|
|
while path.startswith(install_path):
|
2012-08-01 23:06:31 +00:00
|
|
|
try:
|
|
|
|
os.rmdir(path)
|
2018-12-03 11:28:31 +00:00
|
|
|
except OSError as e:
|
2012-08-01 23:06:31 +00: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 18:17:09 +00:00
|
|
|
target_path = abspath(install_path, dst, os.path.basename(path))
|
2012-08-01 23:06:31 +00:00
|
|
|
else:
|
2013-04-23 18:17:09 +00:00
|
|
|
target_path = abspath(install_path, dst)
|
2012-08-01 23:06:31 +00:00
|
|
|
return path, target_path
|
|
|
|
|
|
|
|
def try_copy(path, dst):
|
|
|
|
source_path, target_path = mkpaths(path, dst)
|
2018-12-03 11:28:31 +00:00
|
|
|
print('installing %s' % target_path)
|
2012-08-01 23:06:31 +00:00
|
|
|
try_mkdir_r(os.path.dirname(target_path))
|
2012-08-04 00:41:32 +00:00
|
|
|
try_unlink(target_path) # prevent ETXTBSY errors
|
2012-08-01 23:06:31 +00:00
|
|
|
return shutil.copy2(source_path, target_path)
|
|
|
|
|
|
|
|
def try_remove(path, dst):
|
|
|
|
source_path, target_path = mkpaths(path, dst)
|
2018-12-03 11:28:31 +00:00
|
|
|
print('removing %s' % target_path)
|
2012-08-01 23:06:31 +00:00
|
|
|
try_unlink(target_path)
|
|
|
|
try_rmdir_r(os.path.dirname(target_path))
|
|
|
|
|
2019-01-19 10:07:54 +00: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-01 23:06:31 +00:00
|
|
|
|
2020-09-28 15:35:09 +00:00
|
|
|
def package_files(action, name, bins):
|
|
|
|
target_path = 'lib/node_modules/' + name + '/'
|
2012-08-01 23:06:31 +00: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 18:17:09 +00:00
|
|
|
if os.path.islink(abspath(install_path, target_path)): return
|
2012-08-01 23:06:31 +00: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 15:35:09 +00:00
|
|
|
root = 'deps/' + name
|
|
|
|
for dirname, subdirs, basenames in os.walk(root, topdown=True):
|
2019-01-19 10:07:54 +00:00
|
|
|
subdirs[:] = [subdir for subdir in subdirs if subdir != 'test']
|
2012-08-01 23:06:31 +00:00
|
|
|
paths = [os.path.join(dirname, basename) for basename in basenames]
|
2020-09-28 15:35:09 +00: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 01:53:58 +00:00
|
|
|
|
2013-10-10 21:42:41 +00:00
|
|
|
def subdir_files(path, dest, action):
|
|
|
|
ret = {}
|
|
|
|
for dirpath, dirnames, filenames in os.walk(path):
|
2019-04-13 22:09:45 +00: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 21:42:41 +00:00
|
|
|
|
2012-08-01 23:06:31 +00:00
|
|
|
def files(action):
|
2015-01-08 13:21:26 +00:00
|
|
|
is_windows = sys.platform == 'win32'
|
2016-03-27 00:17:55 +00:00
|
|
|
output_file = 'node'
|
|
|
|
output_prefix = 'out/Release/'
|
2015-01-08 13:21:26 +00: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 10:12:57 +00:00
|
|
|
if is_windows:
|
|
|
|
output_file += '.exe'
|
|
|
|
action([output_prefix + output_file], 'bin/' + output_file)
|
|
|
|
|
|
|
|
if 'true' == variables.get('node_shared'):
|
2016-03-27 00:17:55 +00: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 10:12:57 +00:00
|
|
|
action([output_prefix + 'libnode.dll'], 'bin/libnode.dll')
|
|
|
|
action([output_prefix + 'libnode.lib'], 'lib/libnode.lib')
|
2016-03-27 00:17:55 +00: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 10:12:57 +00:00
|
|
|
output_lib = 'libnode.' + variables.get('shlib_suffix')
|
|
|
|
action([output_prefix + output_lib], 'lib/' + output_lib)
|
2014-02-20 21:03:03 +00:00
|
|
|
if 'true' == variables.get('node_use_dtrace'):
|
|
|
|
action(['out/Release/node.d'], 'lib/dtrace/node.d')
|
2012-08-01 23:06:31 +00:00
|
|
|
|
2013-03-31 03:56:39 +00:00
|
|
|
# behave similarly for systemtap
|
|
|
|
action(['src/node.stp'], 'share/systemtap/tapset/')
|
|
|
|
|
2015-07-06 16:41:04 +00:00
|
|
|
action(['deps/v8/tools/gdbinit'], 'share/doc/node/')
|
2017-03-27 07:37:42 +00:00
|
|
|
action(['deps/v8/tools/lldb_commands.py'], 'share/doc/node/')
|
2015-07-06 16:41:04 +00:00
|
|
|
|
2012-12-17 11:05:14 +00:00
|
|
|
if 'freebsd' in sys.platform or 'openbsd' in sys.platform:
|
2015-08-13 16:14:34 +00:00
|
|
|
action(['doc/node.1'], 'man/man1/')
|
2012-12-02 01:54:14 +00:00
|
|
|
else:
|
2015-08-13 16:14:34 +00:00
|
|
|
action(['doc/node.1'], 'share/man/man1/')
|
2012-12-02 01:54:14 +00:00
|
|
|
|
2020-09-28 15:35:09 +00:00
|
|
|
if 'true' == variables.get('node_install_npm'):
|
|
|
|
npm_files(action)
|
2021-12-05 10:23:25 +00:00
|
|
|
|
|
|
|
if 'true' == variables.get('node_install_corepack'):
|
2020-09-28 15:35:09 +00:00
|
|
|
corepack_files(action)
|
2012-08-01 23:06:31 +00:00
|
|
|
|
2015-06-14 10:23:43 +00: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 13:44:49 +00:00
|
|
|
def wanted_v8_headers(files_arg, dest):
|
|
|
|
v8_headers = [
|
|
|
|
'deps/v8/include/cppgc/common.h',
|
2021-07-06 14:09:25 +00:00
|
|
|
'deps/v8/include/libplatform/libplatform.h',
|
|
|
|
'deps/v8/include/libplatform/libplatform-export.h',
|
|
|
|
'deps/v8/include/libplatform/v8-tracing.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 13:44:49 +00:00
|
|
|
'deps/v8/include/v8.h',
|
2021-10-12 07:01:47 +00:00
|
|
|
'deps/v8/include/v8-array-buffer.h',
|
2021-10-19 20:50:35 +00:00
|
|
|
'deps/v8/include/v8-callbacks.h',
|
2021-10-12 07:01:47 +00:00
|
|
|
'deps/v8/include/v8-container.h',
|
|
|
|
'deps/v8/include/v8-context.h',
|
|
|
|
'deps/v8/include/v8-data.h',
|
|
|
|
'deps/v8/include/v8-date.h',
|
|
|
|
'deps/v8/include/v8-debug.h',
|
2021-10-19 20:50:35 +00:00
|
|
|
'deps/v8/include/v8-embedder-heap.h',
|
2022-01-20 11:00:44 +00:00
|
|
|
'deps/v8/include/v8-embedder-state-scope.h',
|
2021-10-12 07:01:47 +00:00
|
|
|
'deps/v8/include/v8-exception.h',
|
|
|
|
'deps/v8/include/v8-extension.h',
|
|
|
|
'deps/v8/include/v8-external.h',
|
2021-10-19 20:50:35 +00:00
|
|
|
'deps/v8/include/v8-forward.h',
|
|
|
|
'deps/v8/include/v8-function-callback.h',
|
2021-10-12 07:01:47 +00: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 13:44:49 +00:00
|
|
|
'deps/v8/include/v8-internal.h',
|
2021-10-12 07:01:47 +00: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 13:44:49 +00:00
|
|
|
'deps/v8/include/v8-platform.h',
|
2021-10-12 07:01:47 +00: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 13:44:49 +00:00
|
|
|
'deps/v8/include/v8-profiler.h',
|
2021-10-12 07:01:47 +00: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 13:44:49 +00:00
|
|
|
'deps/v8/include/v8-version.h',
|
2021-10-12 07:01:47 +00:00
|
|
|
'deps/v8/include/v8-wasm.h',
|
2021-10-19 20:50:35 +00:00
|
|
|
'deps/v8/include/v8-weak-callback-info.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 13:44:49 +00:00
|
|
|
'deps/v8/include/v8config.h',
|
2018-08-29 16:31:25 +00: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 13:44:49 +00:00
|
|
|
files_arg = [name for name in files_arg if name in v8_headers]
|
2019-04-13 22:09:45 +00:00
|
|
|
action(files_arg, dest)
|
2018-08-29 16:31:25 +00:00
|
|
|
|
2022-01-12 20:30:05 +00: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 21:42:41 +00:00
|
|
|
action([
|
2013-12-20 08:29:06 +00:00
|
|
|
'common.gypi',
|
2013-10-10 21:42:41 +00:00
|
|
|
'config.gypi',
|
|
|
|
'src/node.h',
|
2017-03-20 21:55:26 +00:00
|
|
|
'src/node_api.h',
|
2018-10-19 19:10:59 +00:00
|
|
|
'src/js_native_api.h',
|
|
|
|
'src/js_native_api_types.h',
|
2017-03-20 21:55:26 +00:00
|
|
|
'src/node_api_types.h',
|
2013-10-10 21:42:41 +00:00
|
|
|
'src/node_buffer.h',
|
|
|
|
'src/node_object_wrap.h',
|
|
|
|
'src/node_version.h',
|
|
|
|
], 'include/node/')
|
|
|
|
|
2015-09-29 14:22:00 +00:00
|
|
|
# Add the expfile that is created on AIX
|
|
|
|
if sys.platform.startswith('aix'):
|
|
|
|
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 13:44:49 +00:00
|
|
|
subdir_files('deps/v8/include', 'include/node/', wanted_v8_headers)
|
2013-10-10 21:42:41 +00:00
|
|
|
|
|
|
|
if 'false' == variables.get('node_shared_libuv'):
|
|
|
|
subdir_files('deps/uv/include', 'include/node/', action)
|
|
|
|
|
2017-03-09 09:31:54 +00:00
|
|
|
if 'true' == variables.get('node_use_openssl') and \
|
|
|
|
'false' == variables.get('node_shared_openssl'):
|
2015-04-06 07:14:27 +00:00
|
|
|
subdir_files('deps/openssl/openssl/include/openssl', 'include/node/openssl/', action)
|
2015-04-08 08:56:52 +00:00
|
|
|
subdir_files('deps/openssl/config/archs', 'include/node/openssl/archs', action)
|
2018-03-14 02:25:48 +00:00
|
|
|
subdir_files('deps/openssl/config', 'include/node/openssl', action)
|
2013-10-10 21:42:41 +00:00
|
|
|
|
|
|
|
if 'false' == variables.get('node_shared_zlib'):
|
|
|
|
action([
|
|
|
|
'deps/zlib/zconf.h',
|
|
|
|
'deps/zlib/zlib.h',
|
|
|
|
], 'include/node/')
|
|
|
|
|
2022-01-12 20:30:05 +00: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-01 23:06:31 +00:00
|
|
|
def run(args):
|
2013-04-23 18:17:09 +00:00
|
|
|
global node_prefix, install_path, target_defaults, variables
|
2012-08-01 23:06:31 +00: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 18:17:09 +00: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 17:23:56 +00:00
|
|
|
dst_dir = args[2] if len(args) > 2 else ''
|
|
|
|
|
2013-04-23 18:17:09 +00: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-01 23:06:31 +00:00
|
|
|
|
|
|
|
cmd = args[1] if len(args) > 1 else 'install'
|
2015-06-14 10:23:43 +00:00
|
|
|
|
|
|
|
if os.environ.get('HEADERS_ONLY'):
|
2020-12-25 13:05:28 +00:00
|
|
|
if cmd == 'install':
|
|
|
|
headers(install)
|
|
|
|
return
|
|
|
|
if cmd == 'uninstall':
|
|
|
|
headers(uninstall)
|
|
|
|
return
|
2015-06-14 10:23:43 +00:00
|
|
|
else:
|
2020-12-25 13:05:28 +00:00
|
|
|
if cmd == 'install':
|
|
|
|
files(install)
|
|
|
|
return
|
|
|
|
if cmd == 'uninstall':
|
|
|
|
files(uninstall)
|
|
|
|
return
|
2015-06-14 10:23:43 +00:00
|
|
|
|
2012-08-01 23:06:31 +00:00
|
|
|
raise RuntimeError('Bad command: %s\n' % cmd)
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
run(sys.argv[:])
|