How rawlab.wasm was built ========================= Toolchain: emcc 6.0.6 (ce75e06884093bcefb86a6b8fd56a5d62a4cc245) Source: libraw-0.22.2.tar.gz, sha256 de86b035655accff8d4010f1a221fdf50d353cb7b1422ba26f14a0db92612cfa Artifact: rawlab.wasm, sha256 eacf21cbf5dc6a50b60eecdf8ef9cd5aaae5e0c84867cdf6caa232fbe95ee7ba 803417 bytes The source list is derived from LibRaw's own lib_libraw_a_SOURCES in Makefile.am (78 translation units) by srcs.sh, not from find(1): the tree carries src/**/*_ph.cpp placeholder units that #include their siblings and produce 13 duplicate symbols at link time. Command: see build-wasm.sh, reproduced here verbatim. #!/bin/sh # Build LibRaw 0.22.2 + our wrapper into ONE standalone .wasm with no generated # JS glue. The loader that goes with it is hand-written (loader.mjs, ~150 lines) # and stubs the handful of WASI imports the C++ runtime references. # # CDDL NOTE. This script is the record of exactly what went into the artifact # and is published alongside LibRaw-0.22.2.tar.gz and the patch series. If you # change a define here, the published source description is wrong until you # change it here too. set -eu cd "$(dirname "$0")" . ./emsdk/emsdk_env.sh >/dev/null 2>&1 LR=LibRaw-0.22.2 OUT=build-wasm OBJ=$OUT/obj mkdir -p "$OBJ" for p in LibRaw-demosaic-pack-GPL2 LibRaw-demosaic-pack-GPL3; do if [ -e "$LR/$p" ]; then echo "FATAL: GPL demosaic pack present: $p" >&2; exit 1; fi done SRCS=$(./srcs.sh "$LR") DEFS="-DLIBRAW_NOTHREADS -DUSE_ZLIB -DUSE_JPEG -DNO_LCMS" FLAGS="-O3 -std=c++17 -w $DEFS -I$LR --use-port=zlib --use-port=libjpeg -fwasm-exceptions" n=0 for s in $SRCS; do o="$OBJ/$(echo "$s" | tr / _).o" if [ -f "$o" ] && [ "$o" -nt "$s" ]; then continue; fi emcc $FLAGS -c "$s" -o "$o" & n=$((n + 1)) [ $((n % 8)) -eq 0 ] && wait done wait emcc $FLAGS -c wrapper/rawlab.cpp -o "$OBJ/rawlab.o" EXPORTS='_rl_alloc,_rl_free,_rl_open,_rl_unpack,_rl_thumb,_rl_close,_rl_i32,_rl_f32,_rl_str,_rl_xtrans,_rl_raw_ptr,_rl_raw_len,_rl_rawN_ptr,_rl_fcol,_rl_thumb_ptr,_rl_thumb_len,_rl_thumb_count,_rl_thumb_info,_rl_bin2x2,_rl_bin3x3,_rl_bilinear,_rl_xtrans_audit,_rl_out_ptr,_rl_out_len,_rl_last_error,_rl_strerror,_rl_version,_rl_heap_size,_rl_preview_decode,_rl_preview_ptr,_rl_preview_w,_rl_preview_h,_rl_preview_c,_rl_thumb_ex,_rl_thumb_pick,_rl_out_fnv,_rl_raw_fnv,_rl_black_at,_rl_cblack' em++ -O3 -fwasm-exceptions \ --use-port=zlib --use-port=libjpeg \ -sSTANDALONE_WASM=1 --no-entry \ -sALLOW_MEMORY_GROWTH=1 -sINITIAL_MEMORY=33554432 -sMAXIMUM_MEMORY=4294967296 \ -sEXPORTED_FUNCTIONS="$EXPORTS" \ -sERROR_ON_UNDEFINED_SYMBOLS=1 \ -o "$OUT/rawlab.wasm" "$OBJ"/*.o ls -l "$OUT/rawlab.wasm" shasum -a 256 "$OUT/rawlab.wasm" gzip -9 -c "$OUT/rawlab.wasm" | wc -c | sed 's/^/gzipped bytes: /'