From 36bfbdee0d2726bf5fe8f3920b3518210d5cdd1e Mon Sep 17 00:00:00 2001 From: Lovell Fuller Date: Fri, 17 Jun 2016 10:55:19 +0100 Subject: [PATCH] Add support for using pre-compiled binaries with OSX --- .travis.yml | 3 +-- README.md | 5 +---- binding.gyp | 13 +++++++++++++ binding.js | 10 ---------- docs/changelog.md | 5 ++++- docs/index.md | 5 +---- docs/install.md | 28 ++++++---------------------- 7 files changed, 26 insertions(+), 43 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7bd20fe4..b6cf8914 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,9 +14,8 @@ addons: - ubuntu-toolchain-r-test packages: - g++-4.8 -osx_image: xcode7.3 +osx_image: xcode8 before_install: - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export CXX=g++-4.8; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install homebrew/science/vips; fi after_success: - cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js diff --git a/README.md b/README.md index 2245b9ce..c844bb1f 100644 --- a/README.md +++ b/README.md @@ -13,12 +13,9 @@ Lanczos resampling ensures quality is not sacrificed for speed. As well as image resizing, operations such as rotation, extraction, compositing and gamma correction are available. -Most Windows (x64), Linux and ARMv6+ systems do not require +OS X, Windows (x64), Linux (x64, ARM) systems do not require the installation of any external runtime dependencies. -Use with OS X is as simple as running `brew install homebrew/science/vips` -to install the libvips dependency. - [![Test Coverage](https://coveralls.io/repos/lovell/sharp/badge.png?branch=master)](https://coveralls.io/r/lovell/sharp?branch=master) ### Documentation diff --git a/binding.gyp b/binding.gyp index 5eeaba60..c72f05e3 100644 --- a/binding.gyp +++ b/binding.gyp @@ -125,6 +125,19 @@ '<(module_root_dir)/lib/libgobject-2.0.lib' ] }], + ['OS == "mac"', { + 'variables': { + 'download_vips': '&1 || true)" node -e "require(\'./binding\').download_vips()")' diff --git a/binding.js b/binding.js index cda2313b..02eda8ef 100644 --- a/binding.js +++ b/binding.js @@ -120,15 +120,5 @@ module.exports.use_global_vips = function() { minimumLibvipsVersion ); } - if (process.platform === 'darwin' && !useGlobalVips) { - if (globalVipsVersion) { - error( - 'Found libvips ' + globalVipsVersion + ' but require ' + minimumLibvipsVersion + - '\nPlease upgrade libvips by running: brew update && brew upgrade' - ); - } else { - error('Please install libvips by running: brew install homebrew/science/vips --with-webp --with-graphicsmagick'); - } - } process.stdout.write(useGlobalVips ? 'true' : 'false'); }; diff --git a/docs/changelog.md b/docs/changelog.md index a351b8ed..f6825bde 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -6,7 +6,8 @@ Requires libvips v8.3.2 #### v0.16.0 - TBD -* Remove deprecated interpolateWith method - use resize(w, h, { interpolator: ... }) +* Add pre-compiled libvips for OS X. + [#312](https://github.com/lovell/sharp/issues/312) * Ensure boolean, bandbool, extractChannel ops occur before sRGB conversion. [#504](https://github.com/lovell/sharp/pull/504) @@ -24,6 +25,8 @@ Requires libvips v8.3.2 [#521](https://github.com/lovell/sharp/issues/521) [@ChrisPinewood](https://github.com/ChrisPinewood) +* Remove deprecated interpolateWith method - use resize(w, h, { interpolator: ... }) + ### v0.15 - "*outfit*" Requires libvips v8.3.1 diff --git a/docs/index.md b/docs/index.md index 17d17cf1..a77e9a35 100644 --- a/docs/index.md +++ b/docs/index.md @@ -13,12 +13,9 @@ Lanczos resampling ensures quality is not sacrificed for speed. As well as image resizing, operations such as rotation, extraction, compositing and gamma correction are available. -Most Windows (x64), Linux and ARMv6+ systems do not require +OS X, Windows (x64), Linux (x64, ARM) systems do not require the installation of any external runtime dependencies. -Use with OS X is as simple as running `brew install homebrew/science/vips` -to install the libvips dependency. - [![Test Coverage](https://coveralls.io/repos/lovell/sharp/badge.png?branch=master)](https://coveralls.io/r/lovell/sharp?branch=master) ### Formats diff --git a/docs/install.md b/docs/install.md index d033b263..5da69ff4 100644 --- a/docs/install.md +++ b/docs/install.md @@ -29,7 +29,7 @@ Most recent Linux-based operating systems with glibc running on x64 and ARMv6+ C * Amazon Linux 2015.03, 2015.09 To use your own version of libvips instead of the provided binaries, make sure it is -at least the version listed under `config.libvips` in the `package.json` file, +at least the version listed under `config.libvips` in the `package.json` file and that it can be located using `pkg-config --modversion vips-cpp`. There are [changes in the C++11 ABI](https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html) @@ -66,28 +66,12 @@ via `sharp.cache(false)` to avoid a stack overflow. [![OS X 10.9.5 Build Status](https://travis-ci.org/lovell/sharp.png?branch=master)](https://travis-ci.org/lovell/sharp) -libvips must be installed before `npm install` is run. -This can be achieved via homebrew: +libvips and its dependencies are fetched and stored within `node_modules/sharp/lib` during `npm install`. +This involves an automated HTTPS download of approximately 6.5MB. -```sh -brew install homebrew/science/vips -``` - -For WebP suppport use: - -```sh -brew install homebrew/science/vips --with-webp -``` - -A missing or incorrectly configured _Xcode Command Line Tools_ installation -[can lead](https://github.com/lovell/sharp/issues/80) to a -`library not found for -ljpeg` error. -If so, please try: `xcode-select --install`. - -The _gettext_ dependency of _libvips_ -[can lead](https://github.com/lovell/sharp/issues/9) -to a `library not found for -lintl` error. -If so, please try `brew link gettext --force`. +To use your own version of libvips instead of the provided binaries, make sure it is +at least the version listed under `config.libvips` in the `package.json` file and +that it can be located using `pkg-config --modversion vips-cpp`. ### Windows