mirror of
https://github.com/lovell/sharp.git
synced 2025-07-11 19:40:14 +02:00
Use detect-libc instead of ldd output parsing
This commit is contained in:
parent
b40e3fa1f1
commit
eb8773fe3e
@ -144,7 +144,7 @@
|
||||
}],
|
||||
['OS == "linux"', {
|
||||
'variables': {
|
||||
'download_vips': '<!(LDD_VERSION="<!(ldd --version 2>&1 || true)" node -e "require(\'./binding\').download_vips()")'
|
||||
'download_vips': '<!(node -e "require(\'./binding\').download_vips()")'
|
||||
},
|
||||
'defines': [
|
||||
'_GLIBCXX_USE_CXX11_ABI=0'
|
||||
|
21
binding.js
21
binding.js
@ -8,6 +8,7 @@ const caw = require('caw');
|
||||
const got = require('got');
|
||||
const semver = require('semver');
|
||||
const tar = require('tar');
|
||||
const detectLibc = require('detect-libc');
|
||||
|
||||
const distBaseUrl = process.env.SHARP_DIST_BASE_URL || 'https://dl.bintray.com/lovell/sharp/';
|
||||
|
||||
@ -68,19 +69,15 @@ module.exports.download_vips = function () {
|
||||
if (!isFile(vipsHeaderPath)) {
|
||||
// Ensure Intel 64-bit or ARM
|
||||
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 of libvips - please see http://sharp.dimens.io/page/install');
|
||||
}
|
||||
// Ensure glibc >= 2.15
|
||||
const lddVersion = process.env.LDD_VERSION;
|
||||
if (lddVersion) {
|
||||
if (/(glibc|gnu libc|gentoo|solus)/i.test(lddVersion)) {
|
||||
const glibcVersion = lddVersion ? lddVersion.split(/\n/)[0].split(' ').slice(-1)[0].trim() : '';
|
||||
if (glibcVersion && semver.lt(glibcVersion + '.0', '2.13.0')) {
|
||||
error('glibc version ' + glibcVersion + ' requires manual installation - please see http://sharp.dimens.io/en/stable/install/');
|
||||
}
|
||||
} else {
|
||||
error(lddVersion.split(/\n/)[0] + ' requires manual installation - please see http://sharp.dimens.io/en/stable/install/');
|
||||
}
|
||||
// Ensure glibc Linux
|
||||
if (detectLibc.isNonGlibcLinux) {
|
||||
error(`Use with ${detectLibc.family} libc requires manual installation of libvips - please see http://sharp.dimens.io/page/install`);
|
||||
}
|
||||
// Ensure glibc >= 2.13
|
||||
if (detectLibc.family === detectLibc.GLIBC && detectLibc.version && semver.lt(`${detectLibc.version}.0`, '2.13.0')) {
|
||||
error(`Use with glibc version ${detectLibc.version} requires manual installation of libvips - please see http://sharp.dimens.io/page/install`);
|
||||
}
|
||||
// Arch/platform-specific .tar.gz
|
||||
const tarFilename = ['libvips', minimumLibvipsVersion, platformId()].join('-') + '.tar.gz';
|
||||
|
@ -47,7 +47,7 @@ This allows the use of newer versions of libvips with older versions of sharp.
|
||||
For 32-bit Intel CPUs and older Linux-based operating systems such as Centos 6,
|
||||
it is recommended to install a system-wide installation of libvips from source:
|
||||
|
||||
https://github.com/jcupitt/libvips#building-libvips-from-a-source-tarball
|
||||
https://jcupitt.github.io/libvips/install.html#building-libvips-from-a-source-tarball
|
||||
|
||||
#### Alpine Linux
|
||||
|
||||
|
@ -69,6 +69,7 @@
|
||||
"dependencies": {
|
||||
"caw": "^2.0.0",
|
||||
"color": "^2.0.0",
|
||||
"detect-libc": "^0.2.0",
|
||||
"got": "^7.1.0",
|
||||
"nan": "^2.6.2",
|
||||
"semver": "^5.3.0",
|
||||
|
Loading…
x
Reference in New Issue
Block a user