File size: 882 Bytes
fea495a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*!
  Copyright 2013 Lovell Fuller and others.
  SPDX-License-Identifier: Apache-2.0
*/

const {
  useGlobalLibvips,
  globalLibvipsVersion,
  log,
  spawnRebuild,
} = require('../lib/libvips');

log('Attempting to build from source via node-gyp');
log('See https://sharp.pixelplumbing.com/install#building-from-source');

try {
  const addonApi = require('node-addon-api');
  log(`Found node-addon-api ${addonApi.version || ''}`);
} catch (_err) {
  log('Please add node-addon-api to your dependencies');
  process.exit(1);
}
try {
  const gyp = require('node-gyp');
  log(`Found node-gyp ${gyp().version}`);
} catch (_err) {
  log('Please add node-gyp to your dependencies');
  process.exit(1);
}

if (useGlobalLibvips(log)) {
  log(`Detected globally-installed libvips v${globalLibvipsVersion()}`);
}

const status = spawnRebuild();
if (status !== 0) {
  process.exit(status);
}