summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/node-gyp/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/node_modules/node-gyp/README.md')
-rw-r--r--deps/npm/node_modules/node-gyp/README.md41
1 files changed, 28 insertions, 13 deletions
diff --git a/deps/npm/node_modules/node-gyp/README.md b/deps/npm/node_modules/node-gyp/README.md
index b0900028d7..d3930a253d 100644
--- a/deps/npm/node_modules/node-gyp/README.md
+++ b/deps/npm/node_modules/node-gyp/README.md
@@ -1,9 +1,12 @@
# `node-gyp` - Node.js native addon build tool
-`node-gyp` is a cross-platform command-line tool written in Node.js for compiling
-native addon modules for Node.js. It bundles the [gyp](https://gyp.gsrc.io)
-project used by the Chromium team and takes away the pain of dealing with the
-various differences in build platforms.
+`node-gyp` is a cross-platform command-line tool written in Node.js for
+compiling native addon modules for Node.js. It contains a fork of the
+[gyp](https://gyp.gsrc.io) project that was previously used by the Chromium
+team and takes away the pain of dealing with the various differences in build
+platforms.
+
+Note that `node-gyp` is _not_ used to build Node.js itself.
Multiple target versions of Node.js are supported (i.e. `0.8`, ..., `4`, `5`, `6`,
etc.), regardless of what version of Node.js is actually installed on your system
@@ -25,21 +28,26 @@ $ npm install -g node-gyp
You will also need to install:
+NOTE: node-gyp is compatible with Python v2.7, v3.5, v3.6, or v3.7. If the
+Python to use is not explicitly configured (see "Configuring Python Dependency"
+below) it will attempt to find a compatible Python executable.
+
### On Unix
- * `python` (`v2.7` recommended, `v3.x.x` is __*not*__ supported)
+ * Python v2.7, v3.5, v3.6, or v3.7
* `make`
* A proper C/C++ compiler toolchain, like [GCC](https://gcc.gnu.org)
### On macOS
- * `python` (`v2.7` recommended, `v3.x.x` is __*not*__ supported) (already installed on macOS)
+ * Python v2.7, v3.5, v3.6, or v3.7
* [Xcode](https://developer.apple.com/xcode/download/)
- * You also need to install the `Command Line Tools` via Xcode. You can find this under the menu `Xcode -> Preferences -> Locations` (or by running `xcode-select --install` in your Terminal)
- * This step will install `gcc` and the related toolchain containing `make`
+ * You also need to install the `XCode Command Line Tools` by running `xcode-select --install`. Alternatively, if you already have the full Xcode installed, you can find them under the menu `Xcode -> Open Developer Tool -> More Developer Tools...`. This step will install `clang`, `clang++`, and `make`.
### On Windows
+Install the current version of Python from the [Microsoft Store package](https://docs.python.org/3/using/windows.html#the-microsoft-store-package).
+
#### Option 1
Install all the required tools and configurations using Microsoft's [windows-build-tools](https://github.com/felixrieseberg/windows-build-tools) using `npm install --global --production windows-build-tools` from an elevated PowerShell or CMD.exe (run as Administrator).
@@ -50,7 +58,6 @@ Install tools and configuration manually:
* Install Visual C++ Build Environment: [Visual Studio Build Tools](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=BuildTools)
(using "Visual C++ build tools" workload) or [Visual Studio 2017 Community](https://visualstudio.microsoft.com/pl/thank-you-downloading-visual-studio/?sku=Community)
(using the "Desktop development with C++" workload)
- * Install [Python 2.7](https://www.python.org/downloads/) (`v3.x.x` is not supported), and run `npm config set python python2.7` (or see below for further instructions on specifying the proper Python version and path.)
* Launch cmd, `npm config set msvs_version 2017`
If the above steps didn't work for you, please visit [Microsoft's Node.js Guidelines for Windows](https://github.com/Microsoft/nodejs-guidelines/blob/master/windows-environment.md#compiling-native-addon-modules) for additional tips.
@@ -63,7 +70,7 @@ If you have multiple Python versions installed, you can identify which Python
version `node-gyp` uses by setting the `--python` variable:
``` bash
-$ node-gyp --python /path/to/python2.7
+$ node-gyp <command> --python /path/to/executable/python
```
If `node-gyp` is called by way of `npm`, *and* you have multiple versions of
@@ -71,9 +78,17 @@ Python installed, then you can set `npm`'s 'python' config key to the appropriat
value:
``` bash
-$ npm config set python /path/to/executable/python2.7
+$ npm config set python /path/to/executable/python
```
+If the `PYTHON` environment variable is set to the path of a Python executable,
+it will be used if it is a compatible Python.
+
+If the `NODE_GYP_FORCE_PYTHON` environment variable is set to the path of a
+Python executable, it will be used instead of any of the other configured or
+builtin Python search paths. If its not a compatible Python, no further
+searching will be done.
+
## How to Use
To compile your native addon, first go to its root directory:
@@ -120,7 +135,7 @@ JSON-like format. This file gets placed in the root of your package, alongside
A barebones `gyp` file appropriate for building a Node.js addon could look like:
-``` python
+```python
{
"targets": [
{
@@ -180,7 +195,7 @@ Some additional resources for addons and writing `gyp` files:
| `--proxy=$url` | Set HTTP proxy for downloading header tarball
| `--cafile=$cafile` | Override default CA chain (to download tarball)
| `--nodedir=$path` | Set the path to the node source code
-| `--python=$path` | Set path to the Python 2 binary
+| `--python=$path` | Set path to the Python binary
| `--msvs_version=$version` | Set Visual Studio version (Windows only)
| `--solution=$solution` | Set Visual Studio Solution version (Windows only)