Tweak up compile flags
- Remove unnecessary `-x c++`. - Improve rebuild speed by caching: - Remove `-f` from `autoreconf` to reuse generated configure scripts. - Remove `--rm` from `docker run` to avoid rebuilding Emscripten stdlib. - Add `-C` to `./configure` to reuse stored information about `emcc`. - Remove `rm -rf build` from WebP encoder/decoder.
This commit is contained in:

committed by
Ingvar Stepanyan

parent
bc8d75128f
commit
1542bfb7fd
@ -2,6 +2,6 @@
|
||||
"name": "hqx",
|
||||
"scripts": {
|
||||
"build:image": "docker build -t squoosh-hqx .",
|
||||
"build": "docker run --rm -v $(pwd):/src squoosh-hqx ./build.sh"
|
||||
"build": "docker run -v $(pwd):/src squoosh-hqx ./build.sh"
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,6 @@ echo "============================================="
|
||||
-I node_modules/libimagequant \
|
||||
-o ./imagequant.js \
|
||||
--std=c++11 \
|
||||
-x c++ \
|
||||
imagequant.cpp \
|
||||
node_modules/libimagequant/libimagequant.a
|
||||
)
|
||||
|
@ -2,7 +2,7 @@
|
||||
"name": "imagequant",
|
||||
"scripts": {
|
||||
"install": "napa",
|
||||
"build": "docker run --rm -v $(pwd):/src trzeci/emscripten-upstream ./build.sh"
|
||||
"build": "docker run -v $(pwd):/src trzeci/emscripten-upstream ./build.sh"
|
||||
},
|
||||
"napa": {
|
||||
"libimagequant": "ImageOptim/libimagequant#2.12.1"
|
||||
|
@ -15,9 +15,9 @@ echo "Compiling mozjpeg"
|
||||
echo "============================================="
|
||||
(
|
||||
cd node_modules/mozjpeg
|
||||
autoreconf -fiv
|
||||
emconfigure ./configure --without-simd
|
||||
emmake make libjpeg.la -j`nproc`
|
||||
autoreconf -iv
|
||||
emconfigure ./configure -C --without-simd
|
||||
emmake make libjpeg.la rdswitch.o -j`nproc`
|
||||
)
|
||||
echo "============================================="
|
||||
echo "Compiling mozjpeg done"
|
||||
@ -31,18 +31,15 @@ echo "============================================="
|
||||
--bind \
|
||||
${OPTIMIZE} \
|
||||
--closure 1 \
|
||||
-s WASM=1 \
|
||||
-s ALLOW_MEMORY_GROWTH=1 \
|
||||
-s MODULARIZE=1 \
|
||||
-s 'EXPORT_NAME="mozjpeg_enc"' \
|
||||
-I node_modules/mozjpeg \
|
||||
-o ./mozjpeg_enc.js \
|
||||
-Wno-deprecated-register \
|
||||
-Wno-writable-strings \
|
||||
node_modules/mozjpeg/rdswitch.c \
|
||||
-x c++ -std=c++11 \
|
||||
-std=c++11 \
|
||||
mozjpeg_enc.cpp \
|
||||
node_modules/mozjpeg/.libs/libjpeg.a
|
||||
node_modules/mozjpeg/.libs/libjpeg.a \
|
||||
node_modules/mozjpeg/rdswitch.o
|
||||
)
|
||||
echo "============================================="
|
||||
echo "Compiling wasm bindings done"
|
||||
|
@ -7,7 +7,10 @@
|
||||
#include <string.h>
|
||||
#include "config.h"
|
||||
#include "jpeglib.h"
|
||||
|
||||
extern "C" {
|
||||
#include "cdjpeg.h"
|
||||
}
|
||||
|
||||
using namespace emscripten;
|
||||
|
||||
|
Binary file not shown.
@ -2,7 +2,7 @@
|
||||
"name": "mozjpeg_enc",
|
||||
"scripts": {
|
||||
"install": "napa",
|
||||
"build": "docker run --rm -v $(pwd):/src trzeci/emscripten-upstream ./build.sh"
|
||||
"build": "docker run -v $(pwd):/src trzeci/emscripten-upstream ./build.sh"
|
||||
},
|
||||
"napa": {
|
||||
"mozjpeg": "mozilla/mozjpeg#v3.3.1"
|
||||
|
@ -2,6 +2,6 @@
|
||||
"name": "oxipng",
|
||||
"scripts": {
|
||||
"build:image": "docker build -t squoosh-oxipng .",
|
||||
"build": "docker run --rm -v $(pwd):/src squoosh-oxipng ./build.sh"
|
||||
"build": "docker run -v $(pwd):/src squoosh-oxipng ./build.sh"
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,6 @@
|
||||
"name": "resize",
|
||||
"scripts": {
|
||||
"build:image": "docker build -t squoosh-resize .",
|
||||
"build": "docker run --rm -v $(pwd):/src squoosh-resize ./build.sh"
|
||||
"build": "docker run -v $(pwd):/src squoosh-resize ./build.sh"
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
"name": "rotate",
|
||||
"scripts": {
|
||||
"build:image": "docker build -t squoosh-rotate .",
|
||||
"build": "docker run --rm -v $(pwd):/src squoosh-rotate ./build.sh",
|
||||
"build": "docker run -v $(pwd):/src squoosh-rotate ./build.sh",
|
||||
"benchmark": "echo File size after gzip && npm run benchmark:filesize && echo Optimizing && npm run -s benchmark:optimizing",
|
||||
"benchmark:baseline": "v8 --liftoff --no-wasm-tier-up --no-opt ./benchmark.js",
|
||||
"benchmark:optimizing": "v8 --no-liftoff --no-wasm-tier-up ./benchmark.js",
|
||||
|
@ -14,10 +14,8 @@ echo "Compiling libwebp"
|
||||
echo "============================================="
|
||||
test -n "$SKIP_LIBWEBP" || (
|
||||
cd node_modules/libwebp
|
||||
autoreconf -fiv
|
||||
rm -rf build || true
|
||||
mkdir -p build && cd build
|
||||
emconfigure ../configure \
|
||||
autoreconf -iv
|
||||
emconfigure ./configure -C \
|
||||
--disable-libwebpdemux \
|
||||
--disable-wic \
|
||||
--disable-gif \
|
||||
@ -44,12 +42,10 @@ echo "============================================="
|
||||
-s ALLOW_MEMORY_GROWTH=1 \
|
||||
-s MODULARIZE=1 \
|
||||
-s 'EXPORT_NAME="webp_dec"' \
|
||||
--std=c++11 \
|
||||
-I node_modules/libwebp \
|
||||
-o ./webp_dec.js \
|
||||
-x c++ \
|
||||
webp_dec.cpp \
|
||||
node_modules/libwebp/build/src/.libs/libwebp.a
|
||||
node_modules/libwebp/src/.libs/libwebp.a
|
||||
)
|
||||
echo "============================================="
|
||||
echo "Compiling wasm bindings done"
|
||||
|
@ -2,7 +2,7 @@
|
||||
"name": "webp_dec",
|
||||
"scripts": {
|
||||
"install": "napa",
|
||||
"build": "docker run --rm -v $(pwd):/src trzeci/emscripten-upstream ./build.sh"
|
||||
"build": "docker run -v $(pwd):/src trzeci/emscripten-upstream ./build.sh"
|
||||
},
|
||||
"napa": {
|
||||
"libwebp": "webmproject/libwebp#v1.0.2"
|
||||
|
@ -15,10 +15,8 @@ echo "Compiling libwebp"
|
||||
echo "============================================="
|
||||
test -n "$SKIP_LIBWEBP" || (
|
||||
cd node_modules/libwebp
|
||||
autoreconf -fiv
|
||||
rm -rf build || true
|
||||
mkdir -p build && cd build
|
||||
emconfigure ../configure \
|
||||
autoreconf -iv
|
||||
emconfigure ./configure -C \
|
||||
--disable-libwebpdemux \
|
||||
--disable-wic \
|
||||
--disable-gif \
|
||||
@ -45,12 +43,10 @@ echo "============================================="
|
||||
-s ALLOW_MEMORY_GROWTH=1 \
|
||||
-s MODULARIZE=1 \
|
||||
-s 'EXPORT_NAME="webp_enc"' \
|
||||
--std=c++11 \
|
||||
-I node_modules/libwebp \
|
||||
-o ./webp_enc.js \
|
||||
-x c++ \
|
||||
webp_enc.cpp \
|
||||
node_modules/libwebp/build/src/.libs/libwebp.a
|
||||
node_modules/libwebp/src/.libs/libwebp.a
|
||||
)
|
||||
echo "============================================="
|
||||
echo "Compiling wasm bindings done"
|
||||
|
@ -2,7 +2,7 @@
|
||||
"name": "webp_enc",
|
||||
"scripts": {
|
||||
"install": "napa",
|
||||
"build": "docker run --rm -v $(pwd):/src trzeci/emscripten-upstream ./build.sh"
|
||||
"build": "docker run -v $(pwd):/src trzeci/emscripten-upstream ./build.sh"
|
||||
},
|
||||
"napa": {
|
||||
"libwebp": "webmproject/libwebp#v1.0.2"
|
||||
|
Reference in New Issue
Block a user