Add support for statically-linked dependencies (lovell/sharp-libvips#39) (#2223)

This commit is contained in:
Kleis Auke Wolthuizen
2020-06-28 22:17:15 +02:00
committed by GitHub
parent 85459e0ec6
commit 7c1c48327e
6 changed files with 62 additions and 77 deletions

View File

@@ -6,6 +6,8 @@ const path = require('path');
const libvips = require('../lib/libvips');
const npmLog = require('npmlog');
const minimumLibvipsVersion = libvips.minimumLibvipsVersion;
const platform = process.env.npm_config_platform || process.platform;
if (platform === 'win32') {
const buildDir = path.join(__dirname, '..', 'build');
@@ -15,7 +17,7 @@ if (platform === 'win32') {
libvips.mkdirSync(buildDir);
libvips.mkdirSync(buildReleaseDir);
} catch (err) {}
const vendorLibDir = path.join(__dirname, '..', 'vendor', 'lib');
const vendorLibDir = path.join(__dirname, '..', 'vendor', minimumLibvipsVersion, 'lib');
npmLog.info('sharp', `Copying DLLs from ${vendorLibDir} to ${buildReleaseDir}`);
try {
fs

View File

@@ -37,10 +37,12 @@ const fail = function (err) {
const extractTarball = function (tarPath) {
const vendorPath = path.join(__dirname, '..', 'vendor');
libvips.mkdirSync(vendorPath);
const versionedVendorPath = path.join(vendorPath, minimumLibvipsVersion);
libvips.mkdirSync(versionedVendorPath);
tar
.extract({
file: tarPath,
cwd: vendorPath,
cwd: versionedVendorPath,
strict: true
})
.catch(function (err) {