-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add infrastructure to build static WebAssembly libs via wasm-vips
- Loading branch information
Showing
7 changed files
with
106 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
libvips* | ||
*.log | ||
build/wasm-vips-* | ||
deps/ | ||
target/ | ||
npm/*/* | ||
!npm/*/package.json | ||
!npm/dev-wasm32/THIRD-PARTY-NOTICES.md | ||
npm/img-sharp-libvips-*.tgz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
VERSION_WASM_VIPS="56f151b" | ||
|
||
DIR="wasm-vips-${VERSION_WASM_VIPS}" | ||
TAG="wasm-vips:${VERSION_WASM_VIPS}" | ||
|
||
echo "Using ${TAG}" | ||
cd "${0%/*}" | ||
|
||
if [ ! -d "$DIR" ]; then | ||
# Download specific version of wasm-vips | ||
mkdir "${DIR}" | ||
curl -Ls https://github.com/kleisauke/wasm-vips/archive/${VERSION_WASM_VIPS}.tar.gz | tar xzC "${DIR}" --strip-components=1 | ||
fi | ||
|
||
if [ -z "$(docker images -q ${TAG})" ]; then | ||
# Create container with emscripten | ||
pushd "${DIR}" | ||
docker build -t "${TAG}" . | ||
popd | ||
fi | ||
|
||
if [ ! -d "$DIR/build/target/lib" ]; then | ||
# Build libvips and dependencies as static Wasm libraries via emscripten | ||
docker run --rm -v "$PWD/${DIR}":/src "${TAG}" -c "./build.sh --disable-bindings --disable-modules --disable-jxl --enable-libvips-cpp" | ||
fi | ||
|
||
# Copy only the files we need | ||
cp -r --no-preserve=mode,ownership ${DIR}/build/target/{include,lib,versions.json} ../npm/dev-wasm32 | ||
rm -r ../npm/dev-wasm32/lib/cmake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Third-party notices | ||
|
||
This software contains third-party libraries | ||
used under the terms of the following licences: | ||
|
||
| Library | Used under the terms of | | ||
|---------------|-----------------------------------------------------------------------------------------------------------| | ||
| aom | BSD 2-Clause + [Alliance for Open Media Patent License 1.0](https://aomedia.org/license/patent-license/) | | ||
| cgif | MIT Licence | | ||
| expat | MIT Licence | | ||
| glib | LGPLv3 | | ||
| highway | Apache-2.0 License, BSD 3-Clause | | ||
| lcms | MIT Licence | | ||
| libexif | LGPLv3 | | ||
| libffi | MIT Licence | | ||
| libheif | LGPLv3 | | ||
| libimagequant | [BSD 2-Clause](https://github.com/lovell/libimagequant/blob/main/COPYRIGHT) | | ||
| mozjpeg | [zlib License, IJG License, BSD-3-Clause](https://github.com/mozilla/mozjpeg/blob/master/LICENSE.md) | | ||
| libnsgif | MIT Licence | | ||
| libspng | [BSD 2-Clause, libpng License](https://github.com/randy408/libspng/blob/master/LICENSE) | | ||
| libtiff | [libtiff License](https://gitlab.com/libtiff/libtiff/blob/master/LICENSE.md) (BSD-like) | | ||
| libvips | LGPLv3 | | ||
| libwebp | New BSD License | | ||
| resvg | MPL-2.0 License | | ||
| zlib-ng | [zlib Licence](https://github.com/zlib-ng/zlib-ng/blob/develop/LICENSE.md) | | ||
|
||
Use of libraries under the terms of the LGPLv3 is via the | ||
"any later version" clause of the LGPLv2 or LGPLv2.1. | ||
|
||
Please report any errors or omissions via | ||
https://github.com/lovell/sharp-libvips/issues/new |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"name": "@img/sharp-libvips-dev-wasm32", | ||
"version": "0.0.3", | ||
"description": "Header files and static wasm32 libraries for libvips and dependencies to build sharp as wasm32", | ||
"author": "Lovell Fuller <[email protected]>", | ||
"homepage": "https://sharp.pixelplumbing.com", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/lovell/sharp-libvips.git", | ||
"directory": "npm/dev-wasm32" | ||
}, | ||
"license": "LGPL-3.0-or-later", | ||
"funding": { | ||
"url": "https://opencollective.com/libvips" | ||
}, | ||
"preferUnplugged": true, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"files": [ | ||
"include", | ||
"lib", | ||
"versions.json" | ||
], | ||
"type": "commonjs", | ||
"exports": { | ||
"./include": "./include/index.js", | ||
"./lib": "./lib/index.js", | ||
"./versions": "./versions.json" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
"private": "true", | ||
"workspaces": [ | ||
"dev", | ||
"dev-wasm32", | ||
"darwin-x64", | ||
"darwin-arm64", | ||
"linux-arm", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters