Skip to content

Commit

Permalink
Add support for using pre-compiled binaries with OSX
Browse files Browse the repository at this point in the history
  • Loading branch information
lovell committed Jul 25, 2016
1 parent 7a9a412 commit 36bfbde
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 43 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,19 @@
'<(module_root_dir)/lib/libgobject-2.0.lib'
]
}],
['OS == "mac"', {
'variables': {
'download_vips': '<!(node -e "require(\'./binding\').download_vips()")'
},
'libraries': [
'<(module_root_dir)/lib/libvips-cpp.42.dylib',
'<(module_root_dir)/lib/libvips.42.dylib',
'<(module_root_dir)/lib/libglib-2.0.0.dylib',
'<(module_root_dir)/lib/libgobject-2.0.0.dylib',
# Ensure runtime linking is relative to sharp.node
'-rpath \'@loader_path/../../lib\''
]
}],
['OS == "linux"', {
'variables': {
'download_vips': '<!(LDD_VERSION="<!(ldd --version 2>&1 || true)" node -e "require(\'./binding\').download_vips()")'
Expand Down
10 changes: 0 additions & 10 deletions binding.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
};
5 changes: 4 additions & 1 deletion docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
5 changes: 1 addition & 4 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 6 additions & 22 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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:

```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`.
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.

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

Expand Down

0 comments on commit 36bfbde

Please sign in to comment.