Install: advanced option to force global libvips #4060

This commit is contained in:
Lovell Fuller
2024-04-10 09:25:53 +01:00
parent f67228e5ea
commit 579cf93030
5 changed files with 28 additions and 6 deletions

View File

@@ -162,15 +162,21 @@ const pkgConfigPath = () => {
}
};
const skipSearch = (status, reason) => {
log(`Detected ${reason}, skipping search for globally-installed libvips`);
return status;
};
const useGlobalLibvips = () => {
if (Boolean(process.env.SHARP_IGNORE_GLOBAL_LIBVIPS) === true) {
log('Detected SHARP_IGNORE_GLOBAL_LIBVIPS, skipping search for globally-installed libvips');
return false;
return skipSearch(false, 'SHARP_IGNORE_GLOBAL_LIBVIPS');
}
if (Boolean(process.env.SHARP_FORCE_GLOBAL_LIBVIPS) === true) {
return skipSearch(true, 'SHARP_FORCE_GLOBAL_LIBVIPS');
}
/* istanbul ignore next */
if (isRosetta()) {
log('Detected Rosetta, skipping search for globally-installed libvips');
return false;
return skipSearch(false, 'Rosetta');
}
const globalVipsVersion = globalLibvipsVersion();
return !!globalVipsVersion && /* istanbul ignore next */