|
| 1 | +# Sharp-libvips in Session |
| 2 | + |
| 3 | +This is our own fork of `sharp-libvips`, with some changes to make it work with our specific needs. |
| 4 | +Here are some details of how sharp and `sharp-libvips` are architected, so if someone has to come back to this project in 2 years, they can understand what's going on. |
| 5 | + |
| 6 | +## High level overview |
| 7 | + |
| 8 | +`sharp-libvips` is a project to clone and build all of the libvips dependencies. |
| 9 | +Then sharp will use the prebuilt binaries to build a sharp.node module. |
| 10 | + |
| 11 | +It generates through the CI a libvips for each supported platform and architecture. This step is very slow especially on darwin builds and takes +35minutes on the github runners. |
| 12 | + |
| 13 | +## Differences with official sharp-libvips |
| 14 | + |
| 15 | +### Supported platforms |
| 16 | + |
| 17 | +We have removed some of the supported platforms and architectures from the official `sharp-libvips`, as Session is not planning to support them. Some of those remove are: |
| 18 | + |
| 19 | +- linux-musl (glibc alternative) |
| 20 | +- linux-armv6 |
| 21 | +- linux-ppc64le |
| 22 | +- linux-riscv64 |
| 23 | +- linux-s390x |
| 24 | +- win32 that are not for x64 |
| 25 | + |
| 26 | +What we do support is: |
| 27 | + |
| 28 | +- darwin-x64 |
| 29 | +- darwin-arm64 |
| 30 | +- linux-x64 |
| 31 | +- linux-arm64v8 |
| 32 | +- win32-x64 |
| 33 | + |
| 34 | +**Note:** |
| 35 | + |
| 36 | +- **linux-sse2-x64** is not supported/tested yet, but we have added it to our fork. |
| 37 | +- **linux-x64**, we have added a way to build `libvips` statically (i.e. `.a`) and kept the `.so` files. The `sharp.node` build is then allowed to pick one of the two depending on the platform when it gets built. |
| 38 | + |
| 39 | +## Publishing |
| 40 | + |
| 41 | +Our custom build is not publishing to npm, but only to [github releases](https://github.com/session-foundation/sharp-libvips/releases/). |
| 42 | + |
| 43 | +Each build on each platform is uploaded separately and includes the files needed to build the `sharp.node` module for that specific platform. |
| 44 | +There is no top level `sharp-libvips` package like we have of `sharp`. |
| 45 | +So after a build through the CI, a new release is created on github, and that release contains a bunch .tar.gz that the prebuilt binaries. |
| 46 | +So the release is not a npm package, but a set of `npm pack` .tar.gz files, uploaded to github as a release. |
| 47 | + |
| 48 | +## Build a new release of sharp-libvips |
| 49 | + |
| 50 | +If you do make changes to `sharp-libvips`, you'll need to build a new release. |
| 51 | +The version doesn't have to match the official `sharp-libvips` version, but it should be a new version. |
| 52 | + |
| 53 | +To build a new release through the CI, all you need to do is to |
| 54 | + |
| 55 | +- remove the existing release on github for that version (Note: make sure no official release of session is using it, otherwise create a new version) |
| 56 | +- change the release to be built by searching and replacing the current version in this project. For instance, search and replace `1.2.4` with `1.2.5`. |
| 57 | +- remove the tag locally and remotely, and force push the changes (including the new tag) |
| 58 | +- `git tag -d v1.2.5; git tag v1.2.5 && git push foundation -f && git push foundation -f tags/v1.2.5` |
| 59 | + |
| 60 | +Note: the build needs a tag to generate a release, hence why you should delete and force push the tag each time you are iterating. |
| 61 | + |
| 62 | +## Integrate that change in a new release of sharp |
| 63 | + |
| 64 | +Once you have a new release of `sharp-libvips`, you can integrate it in a new release of `sharp`. |
| 65 | +To see the steps for this, check the `README.session.md` in our own `session-foundation/sharp` repository. |
0 commit comments