Skip to content

Commit

Permalink
Upgrade to libvips v8.6.0
Browse files Browse the repository at this point in the history
Expose offset coordinates of strategy-based crop
Switch to Github releases for prebuilt libvips
Move packaging scripts to lovell/sharp-libvips repo
  • Loading branch information
lovell committed Sep 23, 2017
1 parent 3511723 commit 0678c63
Show file tree
Hide file tree
Showing 29 changed files with 86 additions and 622 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/libvips/* linguist-vendored
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ test/saliency/Image*
test/saliency/[Uu]serData*
!test/saliency/userData.js
vendor
packaging/libvips*
packaging/*.log
!packaging/build
.gitattributes
.DS_Store
.nyc_output
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ New bugs are assigned a `triage` label whilst under investigation.

If a [similar request](https://github.com/lovell/sharp/labels/enhancement) exists, it's probably fastest to add a comment to it about your requirement.

Implementation is usually straightforward if _libvips_ [already supports](http://www.vips.ecs.soton.ac.uk/supported/current/doc/html/libvips/ch03.html) the feature you need.
Implementation is usually straightforward if _libvips_ [already supports](https://jcupitt.github.io/libvips/API/current/) the feature you need.

## Submit a Pull Request to fix a bug

Expand All @@ -41,8 +41,8 @@ Any change that modifies the existing public API should be added to the relevant

| Release | WIP branch |
| ------: | :--------- |
| v0.18.0 | ridge |
| v0.19.0 | suit |
| v0.20.0 | teeth |

Please squash your changes into a single commit using a command like `git rebase -i upstream/<wip-branch>`.

Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ environment:
matrix:
- nodejs_version: "4"
- nodejs_version: "6"
- nodejs_version: "7"
- nodejs_version: "8"
install:
- ps: Install-Product node $env:nodejs_version x64
- npm install -g npm@latest
Expand Down
8 changes: 6 additions & 2 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@
'copies': [{
'destination': 'build/Release',
'files': [
'vendor/lib/GNU.Gettext.dll',
'vendor/lib/libasprintf-0.dll',
'vendor/lib/libcairo-2.dll',
'vendor/lib/libcairo-gobject-2.dll',
Expand All @@ -245,19 +244,24 @@
'vendor/lib/libfreetype-6.dll',
'vendor/lib/libgcc_s_seh-1.dll',
'vendor/lib/libgdk_pixbuf-2.0-0.dll',
'vendor/lib/libgettextlib-0-19-8.dll',
'vendor/lib/libgettextpo-1.dll',
'vendor/lib/libgettextsrc-0-19-8.dll',
'vendor/lib/libgif-7.dll',
'vendor/lib/libgio-2.0-0.dll',
'vendor/lib/libglib-2.0-0.dll',
'vendor/lib/libgmodule-2.0-0.dll',
'vendor/lib/libgobject-2.0-0.dll',
'vendor/lib/libgsf-1-114.dll',
'vendor/lib/libgthread-2.0-0.dll',
'vendor/lib/libharfbuzz-0.dll',
'vendor/lib/libiconv-2.dll',
'vendor/lib/libintl-8.dll',
'vendor/lib/libintl-9.dll',
'vendor/lib/libjpeg-62.dll',
'vendor/lib/liblcms2-2.dll',
'vendor/lib/libpango-1.0-0.dll',
'vendor/lib/libpangocairo-1.0-0.dll',
'vendor/lib/libpangoft2-1.0-0.dll',
'vendor/lib/libpangowin32-1.0-0.dll',
'vendor/lib/libpixman-1-0.dll',
'vendor/lib/libpng16-16.dll',
Expand Down
59 changes: 27 additions & 32 deletions binding.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ const semver = require('semver');
const tar = require('tar');
const detectLibc = require('detect-libc');

const distBaseUrl = process.env.SHARP_DIST_BASE_URL || 'https://dl.bintray.com/lovell/sharp/';

// Use NPM-provided environment variable where available, falling back to require-based method for Electron
const minimumLibvipsVersion = process.env.npm_package_config_libvips || require('./package.json').config.libvips;

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

const platform = process.env.npm_config_platform || process.platform;

const arch = process.env.npm_config_arch || process.arch;
Expand Down Expand Up @@ -81,37 +81,32 @@ module.exports.download_vips = function () {
}
// Arch/platform-specific .tar.gz
const tarFilename = ['libvips', minimumLibvipsVersion, platformId()].join('-') + '.tar.gz';
const tarPathLocal = path.join(__dirname, 'packaging', tarFilename);
if (isFile(tarPathLocal)) {
unpack(tarPathLocal);
} else {
// Download to per-process temporary file
const tarPathTemp = path.join(os.tmpdir(), process.pid + '-' + tarFilename);
const tmpFile = fs.createWriteStream(tarPathTemp).on('finish', function () {
unpack(tarPathTemp, function () {
// Attempt to remove temporary file
try {
fs.unlinkSync(tarPathTemp);
} catch (err) {}
});
// Download to per-process temporary file
const tarPathTemp = path.join(os.tmpdir(), process.pid + '-' + tarFilename);
const tmpFile = fs.createWriteStream(tarPathTemp).on('finish', function () {
unpack(tarPathTemp, function () {
// Attempt to remove temporary file
try {
fs.unlinkSync(tarPathTemp);
} catch (err) {}
});
const url = distBaseUrl + tarFilename;
const simpleGetOpt = {
url: url,
agent: caw(null, {
protocol: 'https'
})
};
simpleGet(simpleGetOpt, function (err, response) {
if (err) {
error('Download of ' + url + ' failed: ' + err.message);
}
if (response.statusCode !== 200) {
error(url + ' status code ' + response.statusCode);
}
response.pipe(tmpFile);
});
}
});
const url = distBaseUrl + tarFilename;
const simpleGetOpt = {
url: url,
agent: caw(null, {
protocol: 'https'
})
};
simpleGet(simpleGetOpt, function (err, response) {
if (err) {
error('Download of ' + url + ' failed: ' + err.message);
}
if (response.statusCode !== 200) {
error(url + ' status code ' + response.statusCode);
}
response.pipe(tmpFile);
});
}
};

Expand Down
10 changes: 10 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

### v0.19 - "*suit*"

Requires libvips v8.6.0.

#### v0.19.0 - TBD

* Expose offset coordinates of strategy-based crop.
[#868](https://github.com/lovell/sharp/issues/868)
[@mirohristov-com](https://github.com/mirohristov-com)

### v0.18 - "*ridge*"

Requires libvips v8.5.5.
Expand Down
1 change: 1 addition & 0 deletions lib/output.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const sharp = require('../build/Release/sharp.node');
* @param {Function} [callback] - called on completion with two arguments `(err, info)`.
* `info` contains the output image `format`, `size` (bytes), `width`, `height`,
* `channels` and `premultiplied` (indicating if premultiplication was used).
* When using a crop strategy also contains `cropOffsetLeft` and `cropOffsetTop`.
* @returns {Promise<Object>} - when no callback is provided
* @throws {Error} Invalid parameters
*/
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "sharp",
"description": "High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP and TIFF images",
"version": "0.18.4",
"version": "0.19.0-alpha",
"author": "Lovell Fuller <npm@lovell.info>",
"homepage": "https://github.com/lovell/sharp",
"contributors": [
Expand Down Expand Up @@ -71,26 +71,26 @@
"caw": "^2.0.0",
"color": "^2.0.0",
"detect-libc": "^0.2.0",
"nan": "^2.6.2",
"semver": "^5.3.0",
"nan": "^2.7.0",
"semver": "^5.4.1",
"simple-get": "^2.7.0",
"tar": "^3.1.5"
"tar": "^4.0.1"
},
"devDependencies": {
"async": "^2.5.0",
"cc": "^1.0.1",
"documentation": "^4.0.0-rc.1",
"exif-reader": "^1.0.2",
"icc": "^1.0.0",
"mocha": "^3.4.2",
"nyc": "^11.0.3",
"mocha": "^3.5.0",
"nyc": "^11.1.0",
"rimraf": "^2.6.1",
"semistandard": "^11.0.0",
"unzip": "^0.1.11"
},
"license": "Apache-2.0",
"config": {
"libvips": "8.5.5"
"libvips": "8.6.0"
},
"engines": {
"node": ">=4.5.0"
Expand Down
57 changes: 0 additions & 57 deletions packaging/README.md

This file was deleted.

48 changes: 0 additions & 48 deletions packaging/build.sh

This file was deleted.

Loading

0 comments on commit 0678c63

Please sign in to comment.