diff --git a/binding.gyp b/binding.gyp index fac6dc78..f20036a2 100644 --- a/binding.gyp +++ b/binding.gyp @@ -144,7 +144,7 @@ }], ['OS == "linux"', { 'variables': { - 'download_vips': '&1 || true)" node -e "require(\'./binding\').download_vips()")' + 'download_vips': '= 2.15 - const lddVersion = process.env.LDD_VERSION; - if (lddVersion) { - if (/(glibc|gnu libc|gentoo|solus)/i.test(lddVersion)) { - const glibcVersion = lddVersion ? lddVersion.split(/\n/)[0].split(' ').slice(-1)[0].trim() : ''; - if (glibcVersion && semver.lt(glibcVersion + '.0', '2.13.0')) { - error('glibc version ' + glibcVersion + ' requires manual installation - please see http://sharp.dimens.io/en/stable/install/'); - } - } else { - error(lddVersion.split(/\n/)[0] + ' requires manual installation - please see http://sharp.dimens.io/en/stable/install/'); - } + // Ensure glibc Linux + if (detectLibc.isNonGlibcLinux) { + error(`Use with ${detectLibc.family} libc requires manual installation of libvips - please see http://sharp.dimens.io/page/install`); + } + // Ensure glibc >= 2.13 + if (detectLibc.family === detectLibc.GLIBC && detectLibc.version && semver.lt(`${detectLibc.version}.0`, '2.13.0')) { + error(`Use with glibc version ${detectLibc.version} requires manual installation of libvips - please see http://sharp.dimens.io/page/install`); } // Arch/platform-specific .tar.gz const tarFilename = ['libvips', minimumLibvipsVersion, platformId()].join('-') + '.tar.gz'; diff --git a/docs/install.md b/docs/install.md index d2cce612..19e1dc26 100644 --- a/docs/install.md +++ b/docs/install.md @@ -47,7 +47,7 @@ This allows the use of newer versions of libvips with older versions of sharp. For 32-bit Intel CPUs and older Linux-based operating systems such as Centos 6, it is recommended to install a system-wide installation of libvips from source: -https://github.com/jcupitt/libvips#building-libvips-from-a-source-tarball +https://jcupitt.github.io/libvips/install.html#building-libvips-from-a-source-tarball #### Alpine Linux diff --git a/package.json b/package.json index 9b02a07f..05cae3bb 100644 --- a/package.json +++ b/package.json @@ -69,6 +69,7 @@ "dependencies": { "caw": "^2.0.0", "color": "^2.0.0", + "detect-libc": "^0.2.0", "got": "^7.1.0", "nan": "^2.6.2", "semver": "^5.3.0",