Skip to content

Commit 7ad86fe

Browse files
committedNov 27, 2023
Docs: package-manager howto for cross-platform install
1 parent 31cf07f commit 7ad86fe

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed
 

‎docs/install.md

+30
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,36 @@ Ready-compiled sharp and libvips binaries are provided for use on the most commo
4242
This provides support for the
4343
JPEG, PNG, WebP, AVIF (limited to 8-bit depth), TIFF, GIF and SVG (input) image formats.
4444

45+
## Cross-platform
46+
47+
At install time, package managers will automatically select prebuilt binaries for the current OS platform and CPU architecture, where available.
48+
49+
Some package managers support multiple platforms and architectures within the same installation tree.
50+
51+
### npm
52+
53+
Use the `--os`, `--cpu` and `--libc` flags:
54+
55+
Example to support both Intel and ARM CPUs on macOS:
56+
```sh
57+
npm install --cpu=x64 --os=darwin sharp
58+
npm install --cpu=arm64 --os=darwin sharp
59+
```
60+
61+
Example to support both glibc and musl-based Linux:
62+
```sh
63+
npm install --cpu=x64 --os=linux sharp
64+
npm install --cpu=x64 --os=linux --libc=musl sharp
65+
```
66+
67+
### yarn
68+
69+
Use the [supportedArchitectures](https://yarnpkg.com/configuration/yarnrc#supportedArchitectures) configuration.
70+
71+
### pnpm
72+
73+
Use the [supportedArchitectures](https://pnpm.io/package_json#pnpmsupportedarchitectures) configuration.
74+
4575
## Custom libvips
4676

4777
To use a custom, globally-installed version of libvips instead of the provided binaries,

0 commit comments

Comments
 (0)