|
10 | 10 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
11 | 11 | // sell copies of the Software, and to permit persons to whom the Software is
|
12 | 12 | // furnished to do so, subject to the following conditions:
|
13 |
| -// |
| 13 | +// |
14 | 14 | // The above copyright notice and this permission notice shall be included in
|
15 | 15 | // all copies or substantial portions of the Software.
|
16 |
| -// |
| 16 | +// |
17 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18 | 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19 | 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
@@ -50,7 +50,13 @@ if (!{ia32: true, x64: true, arm: true}.hasOwnProperty(arch)) {
|
50 | 50 |
|
51 | 51 | // Test for pre-built library
|
52 | 52 | var modPath = platform+ '-'+ arch+ '-v8-'+ v8;
|
53 |
| -if (!force) { |
| 53 | +var installDir = path.join(__dirname, 'bin', modPath); |
| 54 | +var installPath = path.join(installDir, 'capnp.node'); |
| 55 | + |
| 56 | +if('PREBUILT_NODE_CAPNP_BINARY' in process.env) { |
| 57 | + fs.mkdirSync(installDir, {recursive: true}); |
| 58 | + fs.copyFileSync(process.env.PREBUILT_NODE_CAPNP_BINARY, installPath); |
| 59 | +} else if (!force) { |
54 | 60 | try {
|
55 | 61 | fs.statSync(path.join(__dirname, 'bin', modPath, 'capnp.node'));
|
56 | 62 | console.log('`'+ modPath+ '` exists; testing');
|
@@ -99,7 +105,6 @@ function build() {
|
99 | 105 | // Move it to expected location
|
100 | 106 | function afterBuild() {
|
101 | 107 | var targetPath = path.join(__dirname, 'build', debug ? 'Debug' : 'Release', 'capnp.node');
|
102 |
| - var installPath = path.join(__dirname, 'bin', modPath, 'capnp.node'); |
103 | 108 |
|
104 | 109 | try {
|
105 | 110 | fs.mkdirSync(path.join(__dirname, 'bin', modPath));
|
|
0 commit comments