@nodenv/node-build 5.0.4 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -117,29 +117,30 @@ definitions.
117
117
 
118
118
  The build process may be configured through the following environment variables:
119
119
 
120
- | Variable | Function |
121
- | ------------------------ | -------------------------------------------------------------------------------------------------- |
122
- | `TMPDIR` | Where temporary files are stored. |
123
- | `NODE_BUILD_BUILD_PATH` | Where sources are downloaded and built. (Default: a timestamped subdirectory of `TMPDIR`) |
124
- | `NODE_BUILD_CACHE_PATH` | Where to cache downloaded package files. (Default: `~/.nodenv/cache` if invoked as nodenv plugin) |
125
- | `NODE_BUILD_HTTP_CLIENT` | One of `aria2c`, `curl`, or `wget` to use for downloading. (Default: first one found in PATH) |
126
- | `NODE_BUILD_ARIA2_OPTS` | Additional options to pass to `aria2c` for downloading. |
127
- | `NODE_BUILD_CURL_OPTS` | Additional options to pass to `curl` for downloading. |
128
- | `NODE_BUILD_WGET_OPTS` | Additional options to pass to `wget` for downloading. |
129
- | `NODE_BUILD_MIRROR_CMD` | A command to construct the package mirror URL. |
130
- | `NODE_BUILD_MIRROR_URL` | Custom mirror URL root. |
131
- | `NODE_BUILD_SKIP_MIRROR` | Bypass the download mirror and fetch all package files from their original URLs. |
132
- | `NODE_BUILD_ROOT` | Custom build definition directory. (Default: `share/node-build`) |
133
- | `NODE_BUILD_DEFINITIONS` | Additional paths to search for build definitions. (Colon-separated list) |
134
- | `CC` | Path to the C compiler. |
135
- | `NODE_CFLAGS` | Additional `CFLAGS` options (_e.g.,_ to override `-O3`). |
136
- | `CONFIGURE_OPTS` | Additional `./configure` options. |
137
- | `MAKE` | Custom `make` command (_e.g.,_ `gmake`). |
138
- | `MAKE_OPTS` / `MAKEOPTS` | Additional `make` options. |
139
- | `MAKE_INSTALL_OPTS` | Additional `make install` options. |
140
- | `NODE_CONFIGURE_OPTS` | Additional `./configure` options (applies only to Node source). |
141
- | `NODE_MAKE_OPTS` | Additional `make` options (applies only to Node source). |
142
- | `NODE_MAKE_INSTALL_OPTS` | Additional `make install` options (applies only to Node source). |
120
+ | Variable | Function |
121
+ | ------------------------------- | -------------------------------------------------------------------------------------------------- |
122
+ | `TMPDIR` | Where temporary files are stored. |
123
+ | `NODE_BUILD_BUILD_PATH` | Where sources are downloaded and built. (Default: a timestamped subdirectory of `TMPDIR`) |
124
+ | `NODE_BUILD_CACHE_PATH` | Where to cache downloaded package files. (Default: `~/.nodenv/cache` if invoked as nodenv plugin) |
125
+ | `NODE_BUILD_HTTP_CLIENT` | One of `aria2c`, `curl`, or `wget` to use for downloading. (Default: first one found in PATH) |
126
+ | `NODE_BUILD_ARIA2_OPTS` | Additional options to pass to `aria2c` for downloading. |
127
+ | `NODE_BUILD_CURL_OPTS` | Additional options to pass to `curl` for downloading. |
128
+ | `NODE_BUILD_WGET_OPTS` | Additional options to pass to `wget` for downloading. |
129
+ | `NODE_BUILD_MIRROR_CMD` | A command to construct the package mirror URL. |
130
+ | `NODE_BUILD_MIRROR_URL` | Custom mirror URL root. |
131
+ | `NODE_BUILD_MIRROR_PACKAGE_URL` | Custom complete mirror URL (e.g. http://mirror.example.com/package-1.0.0.tar.gz). |
132
+ | `NODE_BUILD_SKIP_MIRROR` | Bypass the download mirror and fetch all package files from their original URLs. |
133
+ | `NODE_BUILD_ROOT` | Custom build definition directory. (Default: `share/node-build`) |
134
+ | `NODE_BUILD_DEFINITIONS` | Additional paths to search for build definitions. (Colon-separated list) |
135
+ | `CC` | Path to the C compiler. |
136
+ | `NODE_CFLAGS` | Additional `CFLAGS` options (_e.g.,_ to override `-O3`). |
137
+ | `CONFIGURE_OPTS` | Additional `./configure` options. |
138
+ | `MAKE` | Custom `make` command (_e.g.,_ `gmake`). |
139
+ | `MAKE_OPTS` / `MAKEOPTS` | Additional `make` options. |
140
+ | `MAKE_INSTALL_OPTS` | Additional `make install` options. |
141
+ | `NODE_CONFIGURE_OPTS` | Additional `./configure` options (applies only to Node source). |
142
+ | `NODE_MAKE_OPTS` | Additional `make` options (applies only to Node source). |
143
+ | `NODE_MAKE_INSTALL_OPTS` | Additional `make install` options (applies only to Node source). |
143
144
 
144
145
  #### Applying Patches
145
146
 
@@ -169,21 +170,17 @@ definition. All definitions bundled with node-build include checksums.
169
170
 
170
171
  #### Package Mirrors
171
172
 
172
- By default, node-build downloads package files from the official URL specified in the definition file.
173
+ To speed up downloads, node-build can fetch package files from a mirror.
174
+ To benefit from this, the packages must specify their checksum:
173
175
 
174
176
  ```sh
175
177
  # example:
176
178
  install_package "node-v12.0.0" "https://nodejs.org/dist/v12.0.0/node-v12.0.0.tar.gz#<SHA2>"
177
179
  ```
178
180
 
179
- node-build will attempt to construct a mirror url by invoking `NODE_BUILD_MIRROR_CMD` with two arguments: `package_url` and `checksum`.
180
- The provided command should print the desired mirror's complete package URL.
181
- If `NODE_BUILD_MIRROR_CMD` is unset, package mirror URL construction defaults to replacing `https://nodejs.org/dist` with `NODE_BUILD_MIRROR_URL`.
182
-
183
181
  node-build will first try to fetch this package from `$NODE_BUILD_MIRROR_URL/<SHA2>`
184
- (note: this is the complete URL), where `<SHA2>` is the checksum for the file.
185
-
186
- It will fall back to downloading the package from the original location if:
182
+ (note: this is the complete URL), where `<SHA2>` is the checksum for the file. It
183
+ will fall back to downloading the package from the original location if:
187
184
  - the package was not found on the mirror;
188
185
  - the mirror is down;
189
186
  - the download is corrupt, i.e. the file's checksum doesn't match;
@@ -192,6 +189,15 @@ It will fall back to downloading the package from the original location if:
192
189
 
193
190
  You may specify a custom mirror by setting `NODE_BUILD_MIRROR_URL`.
194
191
 
192
+ If a mirror site doesn't conform to the above URL format, you can specify the
193
+ complete URL by setting `NODE_BUILD_MIRROR_PACKAGE_URL`. It behaves the same as
194
+ `NODE_BUILD_MIRROR_URL` except being a complete URL.
195
+
196
+ For more control over the construction of the mirror url, you can specify a command
197
+ by setting `NODE_BUILD_MIRROR_CMD`. node-build will invoke `NODE_BUILD_MIRROR_CMD`
198
+ with two arguments: `package_url` and `checksum`. The provided command should
199
+ print the desired mirror's complete package URL to `STDOUT`.
200
+
195
201
  #### Keeping the build directory after installation
196
202
 
197
203
  Both `node-build` and `nodenv install` accept the `-k` or `--keep` flag, which
package/bin/node-build CHANGED
@@ -15,13 +15,14 @@
15
15
  # --version Show version of node-build
16
16
  #
17
17
 
18
- NODE_BUILD_VERSION=5.0.4
18
+ NODE_BUILD_VERSION=5.1.0
19
19
 
20
20
  OLDIFS="$IFS"
21
21
 
22
22
  set -E
23
23
  exec 3<&2 # preserve original stderr at fd 3
24
24
 
25
+
25
26
  lib() {
26
27
  parse_options() {
27
28
  OPTIONS=()
@@ -213,7 +214,11 @@ mirror() {
213
214
  local package_url="$1"
214
215
  local checksum="$2"
215
216
 
216
- echo "${package_url/https:\/\/nodejs.org\/dist/$NODE_BUILD_MIRROR_URL}"
217
+ if [ -n "$NODE_BUILD_MIRROR_URL" ]; then
218
+ echo "${package_url/https:\/\/nodejs.org\/dist/$NODE_BUILD_MIRROR_URL}"
219
+ elif [ -n "$NODE_BUILD_MIRROR_PACKAGE_URL" ]; then
220
+ echo "$NODE_BUILD_MIRROR_PACKAGE_URL"
221
+ fi
217
222
  }
218
223
 
219
224
  try_binary(){
@@ -1011,7 +1016,7 @@ WGET_OPTS="${NODE_BUILD_WGET_OPTS} ${IPV4+--inet4-only} ${IPV6+--inet6-only}"
1011
1016
  NODE_BUILD_MIRROR_URL="${NODE_BUILD_MIRROR_URL%/}"
1012
1017
 
1013
1018
  if ! has_checksum_support compute_sha2 ||
1014
- { [ -z "$NODE_BUILD_MIRROR_URL" ] && [ -z "$NODE_BUILD_MIRROR_CMD" ]; } then
1019
+ [ -z "$NODE_BUILD_MIRROR_URL" -a -z "$NODE_BUILD_MIRROR_CMD" -a -z "$NODE_BUILD_MIRROR_PACKAGE_URL" ]; then
1015
1020
  NODE_BUILD_SKIP_MIRROR=true
1016
1021
  fi
1017
1022
 
@@ -89,7 +89,7 @@ for option in "${OPTIONS[@]}"; do
89
89
  {
90
90
  echo
91
91
  echo "Only latest stable releases for each Node implementation are shown."
92
- echo "Use 'nodenv install --list-all' to show all local versions."
92
+ echo "Use 'nodenv install --list-all / -L' to show all local versions."
93
93
  } 1>&2
94
94
  exit
95
95
  ;;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodenv/node-build",
3
- "version": "5.0.4",
3
+ "version": "5.1.0",
4
4
  "description": "Install NodeJS versions",
5
5
  "homepage": "https://github.com/nodenv/node-build#readme",
6
6
  "license": "MIT",
@@ -44,7 +44,7 @@
44
44
  "unmerged": "git for-each-ref refs/rbenv-tags --format='%(refname)' --no-merged"
45
45
  },
46
46
  "devDependencies": {
47
- "@nodenv/node-build-update-defs": "^2.11.0",
47
+ "@nodenv/node-build-update-defs": "^2.11.1",
48
48
  "bats": "^1.11.0",
49
49
  "bats-assert": "jasonkarns/bats-assert-1",
50
50
  "bats-mock": "^1",