Some linux distros allow headers to be installed through
tools like rpm. If the runtime sets
process.config.variables.use_prefix_to_find_headers, look
for matching headers based on the directory set for the
prefix in process.config.variables.prefix
Signed-off-by: Michael Dawson <midawson@redhat.com>
Co-authored-by: Luke Karrys <luke@lukekarrys.com>
* chore: misc test fixes
* Sort test runs by os first
* Use cross-env for test env var
* Try sorting matrix params
* Make FAST_TEST the default and rename to FULL_TEST
* Separate helper functions to not need to export test obj in files
BREAKING CHANGE: the `Gyp` class exported is now created using
ECMAScript classes and therefore might have small differences to classes
that were previously created with `util.inherits`.
BREAKING CHANGE: All internal functions have been coverted to return
promises and no longer accept callbacks. This is not a breaking change
for users but may be breaking to consumers of `node-gyp` if you are
requiring internal functions directly.
* fix: create Python symlink only during builds, and clean it up after
Previously in b9ddcd5bbd this was created
during configuration, and the symlink persisted indefinitely. This
causes problems with many tools that do not expect a codebase to include
symlinks to external absolute paths.
This PR largely reverts that commit, and instead writes the path to
link to into the config, and then creates the symlink only temporarily
during the build process, always deleting it afterwards.
* assert install_path == self.output, f"{install_path} != {self.output}"
---------
Co-authored-by: Christian Clauss <cclauss@me.com>
Python 3.9 on IBM i now properly returns "os400" for sys.platform
instead of claiming to be AIX as it did previously. While the IBM i PASE
environment is compatible with AIX, it is a subset and has numerous
differences which makes it beneficial to distinguish, however this means
that it now needs explicit support here.
Check if zos-base.h is in the directory identified by environment
variable ZOSLIB_INCLUDES if set; otherwise search for it from a set of
candidates under nodeRootDir. Then pass it as
-Dzoslib_include_dir=<path-found> to gyp_main.py for use in common.gypi
to set 'includes_dir' when compiling addons.
Co-authored-by: Gaby Baghdadi <baghdadi@ca.ibm.com>
Co-authored-by: Gaby Baghdadi <baghdadi@ca.ibm.com>
* lib: create a Python symlink and add it to PATH
Helps to ensure a version of Python validated by lib/find-python.js
is used to run various Python scripts generated by gyp.
Known to affect gyp-mac-tool, probably affects gyp-flock-tool as well.
These Python scripts (such as `gyp-mac-tool`) are invoked directly,
via the generated Makefile, so their shebang lines determine
which Python binary is used to run them.
The shebang lines of these scripts are all `#!/usr/bin/env python3`,
so the first `python3` on the user's PATH will be used.
By adding a symlink to the Python binary validated by find-python.js,
and putting this symlink first on the PATH, we can ensure we use
a compatible version of Python to run these scripts.
(Only on Unix/Unix-like OSes. Symlinks are tricky on Windows,
and Python isn't used at build-time anyhow on Windows,
so this intervention isn't useful or necessary on Windows.
A similar technique for Windows, no symlinks required,
would be to make batch scripts which execute the target binary,
much like what Node does for its bundled copy of npm on Windows.)
* test: update mocked graceful-fs for configure test
Add missing functions "unlink()" and "symlink()" to mocked module.
* lib: log any errors when creating Python symlink
Warn users about errors, but continue on in case the user does
happen to have new enough Python on their PATH.
(The symlinks are only meant to fix an issue in a corner case,
where the user told `node-gyp` where new enough Python is,
but it's not the first `python3` on their PATH.
We should not introduce a new potential failure mode to all users
when fixing this bug. So no hard errors during the symlink process.)
* lib: improve error formatting for Python symlink
Logging the entire error object shows the stack twice,
and all the other information is contained in the stack.
It also messes with the order of what is logged.
Rather than logging a bunch of redundant information in a messy way,
we can log only the stack. Logging it in a separate log.warn()
also gets rid of an extra space character at the beginning of the line.
* lib: restore err.errno to logs for symlink errors
This info (err.errno) is the only piece of information
in the error object that is not redundant to err.stack.
* lib: use log.verbose, not log.warn
These messages aren't important enough to be `log.warn`s.
Log as verbose only; they will also appear in full error output.
This bit of logging apparently expected to be given a boolean, but was
receiving either a path or undefined based on the result of fs.mkdir.
Now it prints either "Yes" or "No",
rather than printing either a path or "undefined", respectively.
In addition:
* moved module.exports to the bottom
* no single-line if statements
* no if statements without a {
* const for requires
* array declarations get spaces inside [ ]
* 'use strict' in all .js files
PR-URL: https://github.com/nodejs/node-gyp/pull/1794
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: João Reis <reis@janeasystems.com>
- Uses `.eslintrc.yaml` for configuration
- `npm run lint` is part of `npm test`
PR-URL: https://github.com/nodejs/node-gyp/pull/1497
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: João Reis <reis@janeasystems.com>
- Removes "module dependencies" comments and things that, IMHO, don't add
too much value. Happy to add back if helps some people when reading
through `node-gyp`.
- DRY up `lib/process-release.js`.
- Removes a bunch of extra blank lines, as well as random spaces.
PR-URL: https://github.com/nodejs/node-gyp/pull/1508
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
This is cleaner than filtering additional strings from
platform.python_version().
PR-URL: https://github.com/nodejs/node-gyp/pull/1504
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Rod Vagg <rod@vagg.org>
Node.js on z/OS uses shared dll (libnode.so). When linking native
addons, node-gyp needs to find the corresponding libnode.x during
the link step.
PR-URL: https://github.com/nodejs/node-gyp/pull/1451
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Initial work to add z/OS support to node-gyp.
PR-URL: https://github.com/nodejs/node-gyp/pull/1276
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Set path to node lib in `$(Configuration)` dir when `--nodedir` option
is supplied, otherwise use value of `target_arch` variable.
PR-URL: https://github.com/nodejs/node-gyp/pull/964
Reviewed-By: João Reis <reis@janeasystems.com>
Using `target_arch` in addon.gypi to link against Node.js library. This
variable was written into build/config.gypi on the `configure` stage.
Do not copy node.lib into node_root_dir/Release or node_root_dir/Debug
on Windows, link it from node_root_dir/target_arch directory.
PR-URL: https://github.com/nodejs/node-gyp/pull/964
Reviewed-By: João Reis <reis@janeasystems.com>
Work around a v0.10.x CI issue where path.resolve() on UNIX systems
prefixes Windows paths with the current working directory.
v0.12 and up are free of this issue because they use
path.win32.resolve() which does the right thing.
PR-URL: https://github.com/nodejs/node-gyp/pull/1172
Reviewed-By: João Reis <reis@janeasystems.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
PR-URL: https://github.com/nodejs/node-gyp/pull/1130
Reviewed-By: João Reis <reis@janeasystems.com>
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Rod Vagg <rod@vagg.org>
Microsoft's chakracore engine is dependent on Windows SDK, and build
tools should know the version installed on user machine. This change
adds those dependencies in node-gyp tools. Below is the summary:
* Configure msvs_windows_target_platform_version to use the right
Windows SDK.
* Configure msvs_use_library_dependency_inputs to export symbols
correctly (otherwise functions not used by node.exe but might be
needed by native addon modules could be optimized away by linker).
These changes were originally made in nodejs/node#4765, but as @shigeki
mentioned, it was more sensible to send these changes as PR to node-gyp
repo.
PR-URL: https://github.com/nodejs/node-gyp/pull/873
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Break up findPython() into pieces that can be tested in isolation and
add tests that do so.
PR-URL: https://github.com/nodejs/node-gyp/pull/992
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Using push instead of the original unshift makes the logic a little
cleaner to read here.
PR-URL: https://github.com/nodejs/node-gyp/pull/990
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This reverts commit ff88e5fd12.
Of the 5.5MB footprint of node-gyp, path-array makes up 3.6MB.
Removing this reduces the weight of npm (and thus node) appreciably.
PR-URL: https://github.com/nodejs/node-gyp/pull/990
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>