mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 10:30:15 +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
|
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`.
|
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`
|
you might need to set `PKG_CONFIG_PATH` during `npm install`
|
||||||
and `LD_LIBRARY_PATH` at runtime.
|
and `LD_LIBRARY_PATH` at runtime.
|
||||||
|
|
||||||
@ -211,10 +211,17 @@ to the directory containing the `policy.xml` file.
|
|||||||
|
|
||||||
### Pre-compiled libvips binaries
|
### Pre-compiled libvips binaries
|
||||||
|
|
||||||
If a global installation of libvips that meets the
|
This module will attempt to download a pre-compiled bundle of libvips
|
||||||
minimum version requirement cannot be found,
|
and its dependencies on Linux and Windows machines under either of these
|
||||||
this module will attempt to download a pre-compiled bundle of libvips
|
conditions:
|
||||||
and its dependencies on Linux and Windows machines.
|
|
||||||
|
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,
|
Should you need to manually download and inspect these files,
|
||||||
you can do so via https://github.com/lovell/sharp-libvips/releases
|
you can do so via https://github.com/lovell/sharp-libvips/releases
|
||||||
|
@ -46,6 +46,10 @@ const pkgConfigPath = function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const useGlobalLibvips = function () {
|
const useGlobalLibvips = function () {
|
||||||
|
if (Boolean(process.env.SHARP_IGNORE_GLOBAL_LIBVIPS) === true) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
const globalVipsVersion = globalLibvipsVersion();
|
const globalVipsVersion = globalLibvipsVersion();
|
||||||
return !!globalVipsVersion && semver.gte(globalVipsVersion, minimumLibvipsVersion);
|
return !!globalVipsVersion && semver.gte(globalVipsVersion, minimumLibvipsVersion);
|
||||||
};
|
};
|
||||||
|
@ -58,5 +58,13 @@ describe('libvips binaries', function () {
|
|||||||
const hasVendoredLibvips = libvips.hasVendoredLibvips();
|
const hasVendoredLibvips = libvips.hasVendoredLibvips();
|
||||||
assert.strictEqual('boolean', typeof 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