mirror of
https://github.com/GoogleChromeLabs/squoosh.git
synced 2025-11-15 18:19:47 +00:00
optipng: switch to bundled zlib and libpng
Benefits:
- newer versions of the libraries
- zlib: 1.2.8 -> 1.2.11
- libpng: 1.6.18beta04 -> 1.6.34
- much fewer dependencies to install (as libs are already in optipng archive and we don't need napa)
- much smaller build thanks to customised versions of zlib and libpng containing only APIs necessary for optipng itself: 238950 -> 177359 bytes
- much faster build thanks to preconfigured libpng and stripped APIs: 2m15s -> 40s
- much simpler build script: 77 -> 46 lines
This commit is contained in:
@@ -4,46 +4,13 @@ set -e
|
|||||||
|
|
||||||
export OPTIMIZE="-Os"
|
export OPTIMIZE="-Os"
|
||||||
export PREFIX="/src/build"
|
export PREFIX="/src/build"
|
||||||
export CFLAGS="${OPTIMIZE} -I${PREFIX}/include/"
|
|
||||||
export CPPFLAGS="${OPTIMIZE} -I${PREFIX}/include/"
|
|
||||||
export LDFLAGS="${OPTIMIZE} -L${PREFIX}/lib/"
|
|
||||||
|
|
||||||
apt-get update
|
|
||||||
apt-get install -qqy autoconf libtool
|
|
||||||
|
|
||||||
echo "============================================="
|
|
||||||
echo "Compiling zlib"
|
|
||||||
echo "============================================="
|
|
||||||
test -n "$SKIP_ZLIB" || (
|
|
||||||
cd node_modules/zlib
|
|
||||||
emconfigure ./configure --prefix=${PREFIX}/
|
|
||||||
emmake make
|
|
||||||
emmake make install
|
|
||||||
)
|
|
||||||
echo "============================================="
|
|
||||||
echo "Compiling zlib done"
|
|
||||||
echo "============================================="
|
|
||||||
|
|
||||||
echo "============================================="
|
|
||||||
echo "Compiling libpng"
|
|
||||||
echo "============================================="
|
|
||||||
test -n "$SKIP_LIBPNG" || (
|
|
||||||
cd node_modules/libpng
|
|
||||||
autoreconf -i
|
|
||||||
emconfigure ./configure --with-zlib-prefix=${PREFIX}/ --prefix=${PREFIX}/
|
|
||||||
emmake make
|
|
||||||
emmake make install
|
|
||||||
)
|
|
||||||
echo "============================================="
|
|
||||||
echo "Compiling libpng done"
|
|
||||||
echo "============================================="
|
|
||||||
|
|
||||||
echo "============================================="
|
echo "============================================="
|
||||||
echo "Compiling optipng"
|
echo "Compiling optipng"
|
||||||
echo "============================================="
|
echo "============================================="
|
||||||
(
|
(
|
||||||
cd node_modules/optipng
|
cd node_modules/optipng
|
||||||
emconfigure ./configure --prefix=${PREFIX} --with-system-libs
|
CFLAGS="${OPTIMIZE} -Isrc/zlib" emconfigure ./configure --prefix=${PREFIX}
|
||||||
emmake make
|
emmake make
|
||||||
emmake make install
|
emmake make install
|
||||||
mkdir -p ${PREFIX}/lib
|
mkdir -p ${PREFIX}/lib
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Binary file not shown.
918
codecs/optipng/package-lock.json
generated
918
codecs/optipng/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"name": "optipng",
|
"name": "optipng",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"install": "tar-dependency install && napa",
|
"install": "tar-dependency install",
|
||||||
"build": "npm run build:wasm",
|
"build": "npm run build:wasm",
|
||||||
"build:wasm": "docker run --rm -v $(pwd):/src -e SKIP_ZLIB=\"${SKIP_ZLIB}\" -e SKIP_LIBPNG=\"${SKIP_LIBPNG}\" trzeci/emscripten-upstream ./build.sh"
|
"build:wasm": "docker run --rm -v $(pwd):/src trzeci/emscripten-upstream ./build.sh"
|
||||||
},
|
},
|
||||||
"tarDependencies": {
|
"tarDependencies": {
|
||||||
"node_modules/optipng": {
|
"node_modules/optipng": {
|
||||||
@@ -11,12 +11,7 @@
|
|||||||
"strip": 1
|
"strip": 1
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"napa": {
|
|
||||||
"libpng": "emscripten-ports/libpng",
|
|
||||||
"zlib": "emscripten-ports/zlib"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"napa": "3.0.0",
|
|
||||||
"tar-dependency": "0.0.3"
|
"tar-dependency": "0.0.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user