mirror of
https://github.com/lovell/sharp.git
synced 2025-07-10 19:10:14 +02:00
Allow platform, arch and arm_version to be overridden (#581)
Aids cross-compilation
This commit is contained in:
parent
07d66da57b
commit
dcd1392a85
18
binding.js
18
binding.js
@ -17,6 +17,16 @@ var minimumLibvipsVersion = process.env.npm_package_config_libvips || require('.
|
|||||||
|
|
||||||
var vipsHeaderPath = path.join(__dirname, 'include', 'vips', 'vips.h');
|
var vipsHeaderPath = path.join(__dirname, 'include', 'vips', 'vips.h');
|
||||||
|
|
||||||
|
var platform = process.env.npm_config_platform || process.platform;
|
||||||
|
|
||||||
|
var arch = process.env.npm_config_arch || process.arch;
|
||||||
|
var arm_version = process.env.npm_config_armv || process.config.variables.arm_version;
|
||||||
|
|
||||||
|
if (arch === 'arch64' || arch === 'armhf') {
|
||||||
|
arch = 'arm';
|
||||||
|
if (arch === 'arch64') arm_version = '8';
|
||||||
|
}
|
||||||
|
|
||||||
// -- Helpers
|
// -- Helpers
|
||||||
|
|
||||||
// Does this file exist?
|
// Does this file exist?
|
||||||
@ -47,9 +57,9 @@ var unpack = function(tarPath, done) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var platformId = function() {
|
var platformId = function() {
|
||||||
var id = [process.platform, process.arch].join('-');
|
var id = [platform, arch].join('-');
|
||||||
if (process.arch === 'arm') {
|
if (arch === 'arm') {
|
||||||
switch(process.config.variables.arm_version) {
|
switch(arm_version) {
|
||||||
case '8':
|
case '8':
|
||||||
id = id + 'v8';
|
id = id + 'v8';
|
||||||
break;
|
break;
|
||||||
@ -79,7 +89,7 @@ module.exports.download_vips = function() {
|
|||||||
// Has vips been installed locally?
|
// Has vips been installed locally?
|
||||||
if (!isFile(vipsHeaderPath)) {
|
if (!isFile(vipsHeaderPath)) {
|
||||||
// Ensure Intel 64-bit or ARM
|
// Ensure Intel 64-bit or ARM
|
||||||
if (process.arch === 'ia32') {
|
if (arch === 'ia32') {
|
||||||
error('Intel Architecture 32-bit systems require manual installation - please see http://sharp.dimens.io/en/stable/install/');
|
error('Intel Architecture 32-bit systems require manual installation - please see http://sharp.dimens.io/en/stable/install/');
|
||||||
}
|
}
|
||||||
// Ensure glibc >= 2.15
|
// Ensure glibc >= 2.15
|
||||||
|
Loading…
x
Reference in New Issue
Block a user