Commit graph

89 commits

Author SHA1 Message Date
Felix Rieseberg
e25ec9e836 fix: Monkey-patch fs 2024-10-08 10:36:26 -04:00
Felix Rieseberg
f9f03db62f fix: Handle changed glob call 2024-10-04 13:21:54 -07:00
Toyo Li
6318d2b210
feat: support rebuild and build for cross-compiling Node-API module to wasm on Windows (#2974) 2024-06-28 15:36:30 +01:00
Luke Karrys
355622f4aa feat: convert all internal functions to async/await
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.
2023-10-28 08:59:57 -07:00
Luke Karrys
4bef1ecc75
deps: glob@10.3.10 (#2926) 2023-10-27 21:12:39 -07:00
Tim Perry
0f1f667b73
fix: create Python symlink only during builds, and clean it up after (#2721)
* 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>
2023-08-01 10:02:59 +02:00
Luke Karrys
192eec2aca
Sync deps and engines with npm (#2770)
* feat!: update `engines.node` to `^14.17.0 || ^16.13.0 || >=18.0.0`

* deps: nopt@^7.0.0

* feat: replace npmlog with proc-log

* deps: standard@17.0.0 and fix linting errors

* deps: which@3.0.0
- this also promiisifies the build command

* deps: glob@8.0.3

* feat: drop rimraf dependency

* fix: use fs/promises in favor of fs.promises
2023-06-20 15:44:18 +02:00
Kevin Adler
a26494fbb8 feat: Add proper support for IBM i
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.
2022-09-24 02:17:10 +01:00
DeeDeeG
b9ddcd5bbd
Add Python symlink to path (for non-Windows OSes only) (#2362)
* 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.
2022-06-10 14:11:23 +02:00
Halit Ogunc
cdc49ee3f6
bin: fix the usage instructions
PR-URL: https://github.com/nodejs/node-gyp/pull/1888
Reviewed-By: Rod Vagg <rod@vagg.org>
2019-09-26 11:59:04 +10:00
Rod Vagg
e40c99e283
src: implement standard.js linting
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>
2019-07-06 14:36:37 +10:00
João Reis
8f43f68275 win: detect all VS versions in node-gyp
PR-URL: https://github.com/nodejs/node-gyp/pull/1762
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Refael Ackermann <refack@gmail.com>
2019-06-04 16:39:49 +01:00
Bartosz Sosnowski
7a71d68bce
win: use msbuild from the configure stage
If node-gyp configure has set up MSBuild location use it instead the
one that happens to be first on the PATH.

PR-URL: https://github.com/nodejs/node-gyp/pull/1654
Fixes: https://github.com/nodejs/node-gyp/issues/1653
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: João Reis <reis@janeasystems.com>
2019-04-24 10:29:01 +10:00
Jon Kunkee
721dc7d314
Add ARM64 to MSBuild /Platform logic
PR-URL: https://github.com/nodejs/node-gyp/pull/1655
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: João Reis <reis@janeasystems.com>
2019-04-24 10:29:01 +10:00
Jon Moss
a5b7410497
Add ESLint no-unused-vars rule
- 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>
2019-04-24 10:27:29 +10:00
Jon Moss
9e46872ea3
bin,lib: remove extra comments/lines/spaces
- 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>
2019-04-24 10:27:29 +10:00
Natalie Wolfe
53d8cb967c Prefix build targets with /t: on Windows
Currently, on non-Windows platforms, it is possible to have
a multi-target native module and specify building just some
of the targets using `node-gyp build my_target`.

On Windows, however, specifying the targets to build requires the `/t:`
or `/target:` flag. Without this change you will get an `MSB1008` error
because MSBuild thinks you are trying to specify multiple solutions.

PR-URL: https://github.com/nodejs/node-gyp/pull/1164
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2018-06-08 17:09:27 +02:00
Liu Chao
72afdd62cd build: rename copyNodeLib() to doBuild()
PR-URL: https://github.com/nodejs/node-gyp/pull/1206
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: João Reis <reis@janeasystems.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
2017-05-27 17:23:52 -04:00
Pavel Medvedev
0913b2dd99 build, win: use target_arch to link with node.lib
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>
2017-05-15 23:04:18 +01:00
Refael Ackermann
ae141e1906 win: find and setup for VS2017
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>
2017-03-15 11:54:08 +00:00
Kunal Pathak
ec5fc36a80 Add support to build node.js with chakracore for ARM.
* Support building node.js with chakracore on Windows on ARM

* Building chakracore for ARM has a dependency on Windows SDK installed
  on the machine. Update python script to populate
  `WindowsSDKDesktopARMSupport` and `WindowsTargetPlatformVersion` for
  ARM builds. This will be using in node repo to build`chakracore.gyp`.

PR-URL: https://github.com/nodejs/node-gyp/pull/873
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2017-02-15 04:56:46 +01:00
Mateusz Jaworski
a4fa07b390 More verbose error on locating msbuild.exe failure.
PR-URL: https://github.com/nodejs/node-gyp/pull/930
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-06-02 14:55:55 +02:00
Michael Dawson
9bfa0876b4 Add support for AIX
For AIX we need to use gmake.

For AIX we need to set up the path to the exp file which contains the
symbols needed for linking.  The file will either be in one of the
following depeding on whether are are in installed or development
environment:

  - the include/node directory
  - the out/Release directory

PR-URL: https://github.com/nodejs/node-gyp/pull/753
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2015-11-18 18:23:36 +01:00
Jérémy Lal
101bed639b process.platform will never be kfreebsd
This platform value came from debian package, and now the value
from debian package is simply "freebsd", so this check is useless.

PR-URL: https://github.com/nodejs/node-gyp/pull/738
Reviewed-By: rvagg
Reviewed-By: bnoordhuis
Reviewed-By: jbergstroem
2015-09-23 13:39:52 +10:00
Rod Vagg
9e9df66a06 use process.release, make aware of io.js & node v4 differences
PR-URL: https://github.com/nodejs/node-gyp/pull/711
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-09-08 09:59:31 +10:00
Nathan Rajlich
5f4b1855a2 build: remove trailing semicolon 2015-05-24 15:03:52 -07:00
Keiichiro Ui
44cf85389f Fix for 'make' failure when process.env.JOBS is '0'
If you use the environment variable `JOBS` which are set '0' for other purpose,
`node-gpy rebuild` will fail to execute `make`.
Because the `-j` option of `make` require a non-zero positive integer.

Here is a simple repro:

```
$ JOBS=0 npm install nightmare
...
> weak@0.3.3 install /home/kui/tmp/nm/node_modules/nightmare/node_modules/phantom/node_modules/dnode/node_modules/weak
> node-gyp rebuild

make: the `-j' option requires a positive integral argument
Usage: make [options] [target] ...
Options:
  -b, -m                      Ignored for compatibility.
  -B, --always-make           Unconditionally make all targets.
  -C DIRECTORY, --directory=DIRECTORY
                              Change to DIRECTORY before doing anything.
  -d                          Print lots of debugging information.
..
```
2014-10-09 20:10:35 +09:00
Nathan Rajlich
f2bad1df68 build: whitespace 2013-10-19 23:05:52 -07:00
Jérémy Lal
7ec91d6487 kfreebsd is using make 2013-09-19 12:23:32 +02:00
Nathan Rajlich
0c5c28f9b2 build: remove dead symlinkNodeBinding() code 2013-06-05 14:09:06 -07:00
mscdex
23bd601d50 windows: better msbuild version/path parsing and query correct registry on 64-bit 2013-03-27 08:32:06 -04:00
Nathan Rajlich
3b3614009c build: don't crash on Windows when no "msbuilds" are detected
Closes #206.
2013-02-28 15:13:57 -08:00
Nathan Rajlich
feaad0892f build: fix the msbuild.exe registry lookup on XP 2013-01-25 15:09:53 -08:00
Brian White
47a36cb4e7 Make msbuild search more general 2012-10-29 22:37:28 -04:00
Nathan Rajlich
be66ecd99f Revert "build: fix MSVC MSB8012 warnings"
This reverts commit 9daf9ef4d8.

This now generates a new warning ever since
5c8116b52f.
2012-10-25 11:43:35 -07:00
Nathan Rajlich
6667bffd18 build: make "--jobs=8" work (as opposed to only env variable) 2012-10-02 11:32:15 -07:00
Brian White
85ca8736f4 Use environment variable to determine how many cores/cpus to use when compiling
Closes #143.
2012-10-02 11:12:02 -07:00
Nathan Rajlich
9daf9ef4d8 build: fix MSVC MSB8012 warnings 2012-08-16 15:34:54 -07:00
Nathan Rajlich
154d740f8c build: move comment 2012-08-16 15:34:04 -07:00
Nathan Rajlich
136862351b build: disable symlink behavior once again
Still not ready. We need to fallback to a "copy" on Windows.
2012-07-11 15:36:35 -07:00
Nathan Rajlich
a6adf9f886 build: add silly logging 2012-07-11 15:26:32 -07:00
Nathan Rajlich
d8cba0a1d5 build: workaround a node-glob bug on Windows
needs Unix slashes, not Windows slashes... weird...
2012-07-11 15:26:00 -07:00
Nathan Rajlich
0f7c316c3c build: make the symlink/junction behavior work on Windows 2012-07-11 15:20:53 -07:00
Nathan Rajlich
372dd9677f build: fix logging 2012-07-11 15:20:41 -07:00
Nathan Rajlich
981bc54666 build: allow for the make command to be overwritten with --make=gmake or MAKE=gmake 2012-07-04 16:46:07 -07:00
Ben Noordhuis
05f4ded154 build: use gmake on the BSDs 2012-07-04 16:39:39 -07:00
Nathan Rajlich
b441561f28 disable symlink behavior for now 2012-06-27 11:13:53 -07:00
Nathan Rajlich
08f0d4f01d initial attempt at symlinking resulting files into the "build" dir 2012-06-21 20:50:45 -07:00
Nathan Rajlich
47d19b9ade fix logging 2012-06-13 13:34:01 -07:00
Nathan Rajlich
86634c2817 more logging 2012-06-13 13:31:49 -07:00