#!/usr/bin/env bash # Compiles the QuarkXPress/PageMaker/FreeHand binding (binding_dtp.cpp) and the JSON drawing generator and links them with the # static libraries built in the Dockerfile's deps stage. Runs inside the # emscripten/emsdk container. # # compile_dtp.sh -> /dtp.mjs and /dtp.wasm set -euo pipefail OUT="${1:-/out}" PREFIX="${PREFIX:-/opt/rv}" EH_FLAGS="${EH_FLAGS:--fwasm-exceptions}" PORTS="-sUSE_ZLIB=1 -sUSE_ICU=1 -sUSE_BOOST_HEADERS=1" INCLUDES="-I${PREFIX}/include/librevenge-0.0 -I${PREFIX}/include/libqxp-0.0 -I${PREFIX}/include/libpagemaker-0.0 -I${PREFIX}/include/libfreehand-0.1" LIBS="-L${PREFIX}/lib -lqxp-0.0 -lpagemaker-0.0 -lfreehand-0.1 -llcms2 -lrevenge-stream-0.0 -lrevenge-0.0" mkdir -p "${OUT}" em++ -std=c++17 -Oz ${EH_FLAGS} ${PORTS} ${INCLUDES} -c JSONDrawingGenerator.cpp -o /tmp/JSONDrawingGenerator.o em++ -std=c++17 -Oz ${EH_FLAGS} ${PORTS} ${INCLUDES} -c binding_dtp.cpp -o /tmp/binding.o emcc -Oz -c icudata_subset.c -o /tmp/icudata.o em++ -Oz /tmp/binding.o /tmp/JSONDrawingGenerator.o /tmp/icudata.o ${LIBS} \ ${EH_FLAGS} ${PORTS} \ -lembind \ -sMODULARIZE=1 -sEXPORT_ES6=1 -sEXPORT_NAME=createDtp \ -sENVIRONMENT=web,worker,node \ -sALLOW_MEMORY_GROWTH=1 \ -sMAXIMUM_MEMORY=1073741824 \ -sSTACK_SIZE=1048576 \ -sINITIAL_MEMORY=33554432 \ -sFILESYSTEM=0 \ -sDYNAMIC_EXECUTION=0 \ -sINCOMING_MODULE_JS_API=print,printErr,locateFile \ -o "${OUT}/dtp.mjs" ls -l "${OUT}"