Skip to content

Commit

Permalink
Changelog and doc update for #2217
Browse files Browse the repository at this point in the history
  • Loading branch information
lovell committed May 22, 2020
1 parent d248ead commit b3dd54d
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 12 deletions.
6 changes: 6 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

Requires libvips v8.9.1

### v0.25.4 - TBD

* Allow libvips binary location override where version is appended.
[#2217](https://github.com/lovell/sharp/pull/2217)
[@malice00](https://github.com/malice00)

### v0.25.3 - 17th May 2020

* Ensure libvips is initialised only once, improves worker thread safety.
Expand Down
3 changes: 3 additions & 0 deletions docs/humans.txt
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,6 @@ GitHub: https://github.com/edsilv

Name: Dumitru Deveatii
GitHub: https://github.com/dimadeveatii

Name: Roland Asmann
GitHub: https://github.com/malice00
35 changes: 26 additions & 9 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,25 +81,42 @@ Building from source requires:

This is an advanced approach that most people will not require.

To install the prebuilt sharp binaries from a custom URL,
set the `sharp_binary_host` npm config option
or the `npm_config_sharp_binary_host` environment variable.

To install the prebuilt libvips binaries from a custom URL,
set the `sharp_dist_base_url` npm config option
or the `SHARP_DIST_BASE_URL` environment variable.
set the `sharp_libvips_binary_host` npm config option
or the `npm_config_sharp_libvips_binary_host` environment variable.

The version subpath and file name are appended to these.

For example, if `sharp_libvips_binary_host` is set to `https://hostname/path`
and the libvips version is `1.2.3` then the resultant URL will be
`https://hostname/path/v1.2.3/libvips-1.2.3-platform-arch.tar.gz`.

See the Chinese mirror below for a further example.

For example, both of the following will result in an attempt to download the file located at
`https://hostname/path/libvips-x.y.z-platform.tar.gz`.
## Chinese mirror

Alibaba provide a mirror site based in China containing binaries for both sharp and libvips.

To use this either set the following configuration:

```sh
npm config set sharp_dist_base_url "https://hostname/path/"
npm config set sharp_binary_host "https://npm.taobao.org/mirrors/sharp"
npm config set sharp_libvips_binary_host "https://npm.taobao.org/mirrors/sharp-libvips"
npm install sharp
```

or set the following environment variables:

```sh
SHARP_DIST_BASE_URL="https://hostname/path/" npm install sharp
npm_config_sharp_binary_host="https://npm.taobao.org/mirrors/sharp" \
npm_config_sharp_libvips_binary_host "https://npm.taobao.org/mirrors/sharp-libvips" \
npm install sharp
```

To install the prebuilt sharp binaries from a custom URL, please see
[https://github.com/prebuild/prebuild-install#custom-binaries](https://github.com/prebuild/prebuild-install#custom-binaries)

## FreeBSD

The `vips` package must be installed before `npm install` is run.
Expand Down
2 changes: 1 addition & 1 deletion docs/search-index.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions install/libvips.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ const minimumGlibcVersionByArch = {
};

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

const fail = function (err) {
npmLog.error('sharp', err.message);
Expand Down

0 comments on commit b3dd54d

Please sign in to comment.