mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 10:30:15 +02:00
Upgrade to modern detect-libc
This commit is contained in:
parent
f8340e1a82
commit
884947a069
@ -132,14 +132,16 @@ try {
|
||||
throw new Error(`BSD/SunOS systems require manual installation of libvips >= ${minimumLibvipsVersion}`);
|
||||
}
|
||||
// Linux libc version check
|
||||
if (detectLibc.family === detectLibc.GLIBC && detectLibc.version && minimumGlibcVersionByArch[arch]) {
|
||||
if (semverLessThan(`${detectLibc.version}.0`, `${minimumGlibcVersionByArch[arch]}.0`)) {
|
||||
handleError(new Error(`Use with glibc ${detectLibc.version} requires manual installation of libvips >= ${minimumLibvipsVersion}`));
|
||||
const libcFamily = detectLibc.familySync();
|
||||
const libcVersion = detectLibc.versionSync();
|
||||
if (libcFamily === detectLibc.GLIBC && libcVersion && minimumGlibcVersionByArch[arch]) {
|
||||
if (semverLessThan(`${libcVersion}.0`, `${minimumGlibcVersionByArch[arch]}.0`)) {
|
||||
handleError(new Error(`Use with glibc ${libcVersion} requires manual installation of libvips >= ${minimumLibvipsVersion}`));
|
||||
}
|
||||
}
|
||||
if (detectLibc.family === detectLibc.MUSL && detectLibc.version) {
|
||||
if (semverLessThan(detectLibc.version, '1.1.24')) {
|
||||
handleError(new Error(`Use with musl ${detectLibc.version} requires manual installation of libvips >= ${minimumLibvipsVersion}`));
|
||||
if (libcFamily === detectLibc.MUSL && libcVersion) {
|
||||
if (semverLessThan(libcVersion, '1.1.24')) {
|
||||
handleError(new Error(`Use with musl ${libcVersion} requires manual installation of libvips >= ${minimumLibvipsVersion}`));
|
||||
}
|
||||
}
|
||||
// Node.js minimum version check
|
||||
|
@ -8,7 +8,7 @@ module.exports = function () {
|
||||
const arch = env.npm_config_arch || process.arch;
|
||||
const platform = env.npm_config_platform || process.platform;
|
||||
/* istanbul ignore next */
|
||||
const libc = (platform === 'linux' && detectLibc.isNonGlibcLinux) ? detectLibc.family : '';
|
||||
const libc = (platform === 'linux' && detectLibc.isNonGlibcLinuxSync()) ? detectLibc.familySync() : '';
|
||||
|
||||
const platformId = [`${platform}${libc}`];
|
||||
|
||||
|
@ -128,7 +128,7 @@ function concurrency (concurrency) {
|
||||
return sharp.concurrency(is.integer(concurrency) ? concurrency : null);
|
||||
}
|
||||
/* istanbul ignore next */
|
||||
if (detectLibc.family === detectLibc.GLIBC && !sharp._isUsingJemalloc()) {
|
||||
if (detectLibc.familySync() === detectLibc.GLIBC && !sharp._isUsingJemalloc()) {
|
||||
// Reduce default concurrency to 1 when using glibc memory allocator
|
||||
sharp.concurrency(1);
|
||||
}
|
||||
|
@ -126,7 +126,7 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"color": "^4.2.0",
|
||||
"detect-libc": "^1.0.3",
|
||||
"detect-libc": "^2.0.0",
|
||||
"node-addon-api": "^4.2.0",
|
||||
"prebuild-install": "^7.0.0",
|
||||
"semver": "^7.3.5",
|
||||
|
@ -3,10 +3,11 @@
|
||||
const detectLibc = require('detect-libc');
|
||||
const sharp = require('../../');
|
||||
|
||||
const usingCache = detectLibc.family !== detectLibc.MUSL;
|
||||
const libcFamily = detectLibc.familySync();
|
||||
const usingCache = libcFamily !== detectLibc.MUSL;
|
||||
const usingSimd = !process.env.G_DEBUG;
|
||||
const concurrency =
|
||||
detectLibc.family === detectLibc.MUSL || process.arch === 'arm'
|
||||
libcFamily === detectLibc.MUSL || process.arch === 'arm'
|
||||
? 1
|
||||
: undefined;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user