Skip to content

Commit a6aeef6

Browse files
committedMay 23, 2022
Install: pass PKG_CONFIG_PATH via env rather than substitution
1 parent 7bf6cbd commit a6aeef6

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed
 

‎docs/changelog.md

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ Requires libvips v8.12.2
66

77
### v0.30.5 - TBD
88

9+
* Install: pass `PKG_CONFIG_PATH` via env rather than substitution.
10+
[@dwisiswant0](https://github.com/dwisiswant0)
11+
912
* Allow installation of prebuilt libvips binaries from filesystem.
1013
[#3196](https://github.com/lovell/sharp/pull/3196)
1114
[@ankurparihar](https://github.com/ankurparihar)

‎lib/libvips.js

+10-2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,12 @@ const isRosetta = function () {
6565

6666
const globalLibvipsVersion = function () {
6767
if (process.platform !== 'win32') {
68-
const globalLibvipsVersion = spawnSync(`PKG_CONFIG_PATH="${pkgConfigPath()}" pkg-config --modversion vips-cpp`, spawnSyncOptions).stdout;
68+
const globalLibvipsVersion = spawnSync('pkg-config --modversion vips-cpp', {
69+
...spawnSyncOptions,
70+
env: {
71+
PKG_CONFIG_PATH: pkgConfigPath()
72+
}
73+
}).stdout;
6974
/* istanbul ignore next */
7075
return (globalLibvipsVersion || '').trim();
7176
} else {
@@ -85,7 +90,10 @@ const removeVendoredLibvips = function () {
8590

8691
const pkgConfigPath = function () {
8792
if (process.platform !== 'win32') {
88-
const brewPkgConfigPath = spawnSync('which brew >/dev/null 2>&1 && eval $(brew --env) && echo $PKG_CONFIG_LIBDIR', spawnSyncOptions).stdout || '';
93+
const brewPkgConfigPath = spawnSync(
94+
'which brew >/dev/null 2>&1 && brew environment --plain | grep PKG_CONFIG_LIBDIR | cut -d" " -f2',
95+
spawnSyncOptions
96+
).stdout || '';
8997
return [
9098
brewPkgConfigPath.trim(),
9199
env.PKG_CONFIG_PATH,

0 commit comments

Comments
 (0)
Please sign in to comment.