Install: pass PKG_CONFIG_PATH via env rather than substitution

This commit is contained in:
Lovell Fuller 2022-05-23 12:12:19 +01:00
parent 7bf6cbd669
commit a6aeef612b
2 changed files with 13 additions and 2 deletions

View File

@ -6,6 +6,9 @@ Requires libvips v8.12.2
### v0.30.5 - TBD ### v0.30.5 - TBD
* Install: pass `PKG_CONFIG_PATH` via env rather than substitution.
[@dwisiswant0](https://github.com/dwisiswant0)
* Allow installation of prebuilt libvips binaries from filesystem. * Allow installation of prebuilt libvips binaries from filesystem.
[#3196](https://github.com/lovell/sharp/pull/3196) [#3196](https://github.com/lovell/sharp/pull/3196)
[@ankurparihar](https://github.com/ankurparihar) [@ankurparihar](https://github.com/ankurparihar)

View File

@ -65,7 +65,12 @@ const isRosetta = function () {
const globalLibvipsVersion = function () { const globalLibvipsVersion = function () {
if (process.platform !== 'win32') { if (process.platform !== 'win32') {
const globalLibvipsVersion = spawnSync(`PKG_CONFIG_PATH="${pkgConfigPath()}" pkg-config --modversion vips-cpp`, spawnSyncOptions).stdout; const globalLibvipsVersion = spawnSync('pkg-config --modversion vips-cpp', {
...spawnSyncOptions,
env: {
PKG_CONFIG_PATH: pkgConfigPath()
}
}).stdout;
/* istanbul ignore next */ /* istanbul ignore next */
return (globalLibvipsVersion || '').trim(); return (globalLibvipsVersion || '').trim();
} else { } else {
@ -85,7 +90,10 @@ const removeVendoredLibvips = function () {
const pkgConfigPath = function () { const pkgConfigPath = function () {
if (process.platform !== 'win32') { if (process.platform !== 'win32') {
const brewPkgConfigPath = spawnSync('which brew >/dev/null 2>&1 && eval $(brew --env) && echo $PKG_CONFIG_LIBDIR', spawnSyncOptions).stdout || ''; const brewPkgConfigPath = spawnSync(
'which brew >/dev/null 2>&1 && brew environment --plain | grep PKG_CONFIG_LIBDIR | cut -d" " -f2',
spawnSyncOptions
).stdout || '';
return [ return [
brewPkgConfigPath.trim(), brewPkgConfigPath.trim(),
env.PKG_CONFIG_PATH, env.PKG_CONFIG_PATH,