Skip to content

Commit

Permalink
Upgrade to libvips v8.9.0-alpha2 prebuild
Browse files Browse the repository at this point in the history
Improve tests for 32-bit ARM
  • Loading branch information
lovell committed Mar 4, 2020
1 parent 258c9e8 commit 14dc768
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 7 deletions.
5 changes: 5 additions & 0 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,11 @@
'-Wno-cast-function-type'
]
}],
['target_arch == "arm"', {
'cflags_cc': [
'-Wno-psabi'
]
}],
['OS == "win"', {
'msvs_settings': {
'VCCLCompilerTool': {
Expand Down
9 changes: 7 additions & 2 deletions install/libvips.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ const agent = require('../lib/agent');
const libvips = require('../lib/libvips');
const platform = require('../lib/platform');

const minimumGlibcVersionByArch = {
arm: '2.28',
arm64: '2.29',
x64: '2.17'
};

const { minimumLibvipsVersion, minimumLibvipsVersionLabelled } = libvips;
const distBaseUrl = process.env.npm_config_sharp_dist_base_url || process.env.SHARP_DIST_BASE_URL || `https://github.com/lovell/sharp-libvips/releases/download/v${minimumLibvipsVersionLabelled}/`;

Expand Down Expand Up @@ -64,8 +70,7 @@ try {
throw new Error(`BSD/SunOS systems require manual installation of libvips >= ${minimumLibvipsVersion}`);
}
if (detectLibc.family === detectLibc.GLIBC && detectLibc.version) {
const minimumGlibcVersion = arch === 'arm64' ? '2.29.0' : '2.17.0';
if (semver.lt(`${detectLibc.version}.0`, minimumGlibcVersion)) {
if (semver.lt(`${detectLibc.version}.0`, `${minimumGlibcVersionByArch[arch]}.0`)) {
throw new Error(`Use with glibc ${detectLibc.version} requires manual installation of libvips >= ${minimumLibvipsVersion}`);
}
}
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,15 @@
"tunnel-agent": "^0.6.0"
},
"devDependencies": {
"async": "^3.1.1",
"async": "^3.2.0",
"cc": "^2.0.1",
"decompress-zip": "^0.3.2",
"documentation": "^12.1.4",
"exif-reader": "^1.0.3",
"icc": "^1.0.0",
"license-checker": "^25.0.1",
"mocha": "^7.0.1",
"mock-fs": "^4.10.4",
"mocha": "^7.1.0",
"mock-fs": "^4.11.0",
"nyc": "^15.0.0",
"prebuild": "^10.0.0",
"prebuild-ci": "^3.1.0",
Expand All @@ -135,7 +135,7 @@
},
"license": "Apache-2.0",
"config": {
"libvips": "8.9.1-alpha1"
"libvips": "8.9.1-alpha2"
},
"engines": {
"node": ">=10.16.0"
Expand Down
Binary file modified test/fixtures/expected/blur-0.3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion test/unit/beforeEach.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ const sharp = require('../../');

const usingCache = detectLibc.family !== detectLibc.MUSL;
const usingSimd = !process.env.G_DEBUG;
const concurrency = detectLibc.family === detectLibc.MUSL ? 1 : undefined;
const concurrency =
detectLibc.family === detectLibc.MUSL || process.arch === 'arm'
? 1
: undefined;

beforeEach(function () {
sharp.cache(usingCache);
Expand Down
3 changes: 3 additions & 0 deletions test/unit/platform.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ describe('Platform-detection', function () {

it('Defaults to ARMv6 for 32-bit', function () {
process.env.npm_config_arch = 'arm';
const armVersion = process.config.variables.arm_version;
delete process.config.variables.arm_version;
assert.strictEqual('armv6', platform().split('-')[1]);
process.config.variables.arm_version = armVersion;
delete process.env.npm_config_arch;
});

Expand Down

0 comments on commit 14dc768

Please sign in to comment.