Skip to content

Commit 6a322f9

Browse files
author
Christopher Jones
committed
Increase binary build portability (issue #1129)
1 parent c03c135 commit 6a322f9

File tree

3 files changed

+39
-31
lines changed

3 files changed

+39
-31
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
- Fixed a compilation warning seen on Windows.
2020

21+
- Improve portability of buildbinary.js, a package creation script. (#1129)
22+
2123
## node-oracledb v4.0.0 (25 Jul 2019)
2224

2325
- Refactored the node-oracledb implementation to use

package/README.md

Lines changed: 36 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,51 @@
11
# Overview
22

33
This directory is used for building the [node-oracledb npm
4-
package](https://www.npmjs.com/package/oracledb). The scripts can
5-
also be used to create custom packages for hosting on a local server.
4+
package](https://www.npmjs.com/package/oracledb). The scripts can also be used
5+
to create a custom package for hosting on a local server.
66

77
Most users do not need to use anything in this directory.
88

99
# Maintainers
1010

1111
In a clone or copy of the repository:
1212

13-
- `npm run buildbinary` calls `buildbinary.js` to create a
14-
node-oracledb binary for the current operating system.
13+
- Run `npm run buildbinary`. This calls `buildbinary.js` to create a
14+
node-oracledb binary for the current operating system. Depending how Node.js
15+
was installed, you may need to run `npm install node-gyp -g` first.
1516

16-
- `npm run buildpackage` calls `buildpackage.js` to make the
17-
node-oracledb package containing the node-oracledb JavaScript files,
18-
the available binaries, and a package.json that has an `install`
19-
script and a `prune` script. The package will be created in the top
20-
level directory.
17+
You can run `npm run buildbinary` on each operating system architecture that
18+
you want to include in your package. Copy the node-oracledb binaries and
19+
related build metadata information files to the `package/Staging` directory on
20+
one machine.
2121

22-
Before executing `npm run buildpackage`, all node-oracledb binaries
23-
and related build metadata information files from all operating
24-
systems should be placed in the `package/Staging` directory.
22+
- Run `npm run buildpackage`. This calls `buildpackage.js` to make the
23+
node-oracledb package containing the node-oracledb JavaScript files, the
24+
available binaries, and a `package.json` that has `install` and `prune` script
25+
targets. The package will be created in the top level directory. It can be
26+
uploaded to npmjs.com, or to your own local server, and then used as a
27+
dependency in your projects.
2528

2629
# Package Installation
2730

28-
- As part of an `npm install` that uses the created package, the
29-
`package.json` install script runs `install.js` to check a binary
30-
module for the current Node.js and operating system is available.
31-
32-
If a suitable binary is not available, installation will fail.
33-
Users must then compile node-oracledb using source code from GitHub.
34-
Alternatively a different version of node-oracledb, Node.js, or
35-
different operating system may have a suitable pre-built binary
36-
available.
37-
38-
- After install, space conscious users can run `npm run prune` which
39-
removes pre-built binaries for all other operating systems.
40-
41-
By default the top level `package.json` doesn't have an `install`
42-
script target. This means that node-gyp will be invoked to compile
43-
node-oracledb. This allows installation from [source
44-
code](https://oracle.github.io/node-oracledb/INSTALL.html#github) (via
45-
GitHub) when no suitable pre-built binary is available.
31+
- As part of an `npm install` that uses the created package, the `package.json`
32+
install script runs `install.js` to check the availability of a binary module
33+
for the current Node.js version and operating system architecture.
34+
35+
If a suitable binary is not available, installation will fail. Users must
36+
then compile node-oracledb using source code from GitHub. Alternatively a
37+
different version of node-oracledb, Node.js, or different operating system may
38+
have a suitable pre-built binary available. See
39+
https://github.com/oracle/node-oracledb/releases for information about Node.js
40+
versions and pre-built node-oracledb binaries.
41+
42+
- After install, space conscious users can run `npm run prune` which removes
43+
pre-built binaries for all other architectures.
44+
45+
The
46+
[`package.json`](https://github.com/oracle/node-oracledb/blob/master/package.json)
47+
in GitHub doesn't have an `install` script target by default. This means that
48+
node-gyp will be invoked to compile node-oracledb. This allows installation
49+
from GitHub [source
50+
code](https://oracle.github.io/node-oracledb/INSTALL.html#github) when no
51+
suitable pre-built binary is available.

package/buildbinary.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ function buildBinary() {
6666
fs.unlink(buildBinaryFile, function(err) {if (err && !err.message.match(/ENOENT/)) throw(err);});
6767
fs.unlink(binaryStagingFile, function(err) {if (err && !err.message.match(/ENOENT/)) throw(err);});
6868
fs.unlink(binaryStagingInfoFile, function(err) {if (err && !err.message.match(/ENOENT/)) throw(err);});
69-
execSync('npm install');
69+
execSync('node-gyp rebuild');
7070
fs.renameSync(buildBinaryFile, binaryStagingFile);
7171
fs.appendFileSync(binaryStagingInfoFile, buildInfo + "\n");
7272
} catch(err) {

0 commit comments

Comments
 (0)