mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 02:30:12 +02:00
Ignore global libvips during install via SHARP_IGNORE_GLOBAL_LIBVIPS (#1165)
This commit is contained in:
parent
8dac256096
commit
0d7c3fc4d8
@ -54,7 +54,7 @@ To use a globally-installed version of libvips instead of the provided binaries,
|
||||
make sure it is at least the version listed under `config.libvips` in the `package.json` file
|
||||
and that it can be located using `pkg-config --modversion vips-cpp`.
|
||||
|
||||
If you are using non-stadard paths (anything other than `/usr` or `/usr/local`),
|
||||
If you are using non-standard paths (anything other than `/usr` or `/usr/local`),
|
||||
you might need to set `PKG_CONFIG_PATH` during `npm install`
|
||||
and `LD_LIBRARY_PATH` at runtime.
|
||||
|
||||
@ -211,10 +211,17 @@ to the directory containing the `policy.xml` file.
|
||||
|
||||
### Pre-compiled libvips binaries
|
||||
|
||||
If a global installation of libvips that meets the
|
||||
minimum version requirement cannot be found,
|
||||
this module will attempt to download a pre-compiled bundle of libvips
|
||||
and its dependencies on Linux and Windows machines.
|
||||
This module will attempt to download a pre-compiled bundle of libvips
|
||||
and its dependencies on Linux and Windows machines under either of these
|
||||
conditions:
|
||||
|
||||
1. If a global installation of libvips that meets the
|
||||
minimum version requirement cannot be found;
|
||||
1. If `SHARP_IGNORE_GLOBAL_LIBVIPS` environment variable is set.
|
||||
|
||||
```sh
|
||||
SHARP_IGNORE_GLOBAL_LIBVIPS=1 npm install sharp
|
||||
```
|
||||
|
||||
Should you need to manually download and inspect these files,
|
||||
you can do so via https://github.com/lovell/sharp-libvips/releases
|
||||
|
@ -46,6 +46,10 @@ const pkgConfigPath = function () {
|
||||
};
|
||||
|
||||
const useGlobalLibvips = function () {
|
||||
if (Boolean(process.env.SHARP_IGNORE_GLOBAL_LIBVIPS) === true) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const globalVipsVersion = globalLibvipsVersion();
|
||||
return !!globalVipsVersion && semver.gte(globalVipsVersion, minimumLibvipsVersion);
|
||||
};
|
||||
|
@ -58,5 +58,13 @@ describe('libvips binaries', function () {
|
||||
const hasVendoredLibvips = libvips.hasVendoredLibvips();
|
||||
assert.strictEqual('boolean', typeof hasVendoredLibvips);
|
||||
});
|
||||
it('useGlobalLibvips can be ignored via an env var', function () {
|
||||
process.env.SHARP_IGNORE_GLOBAL_LIBVIPS = 1;
|
||||
|
||||
const useGlobalLibvips = libvips.useGlobalLibvips();
|
||||
assert.strictEqual(false, useGlobalLibvips);
|
||||
|
||||
delete process.env.SHARP_IGNORE_GLOBAL_LIBVIPS;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user