LibreDWG for the FormatYard DWG to PDF tool: how the WebAssembly build is made ============================================================================== What is served /engine/dwgread.mjs + dwgread.wasm, /engine/dwgwrite.mjs + dwgwrite.wasm Built from GNU LibreDWG 0.14 (GPL version 3 or later) with the three patches in this folder: libredwg-0.14-jsmn-parent-links.patch faster JSON reading (JSMN_PARENT_LINKS) libredwg-0.14-downconvert-aci.patch keeps a plain ACI colour when writing R2000 libredwg-0.14-dxf-truecolor-24bit.patch true colour groups 420-427 written as 24-bit values Source LibreDWG 0.14: libredwg-0.14.tar.xz in this folder (copied unchanged from https://ftp.gnu.org/gnu/libredwg/, with its .sig; SHA-256 62ebb73b984f865960f20ed26619ea5f8789d5e3fd088fa40a2598384da81275) The patches: this folder. Build (macOS, emsdk 3.1.74) 1. Unpack libredwg-0.14.tar.xz and apply the three patches (patch -p1 < file). 2. emconfigure ./configure CFLAGS="-O2 -Wno-error -Wno-format" 3. emmake make 4. Link each program (dwgread, dwgwrite) with: emcc -sMODULARIZE -sEXPORT_ES6 -sINVOKE_RUN=0 -sENVIRONMENT=web,worker -sALLOW_MEMORY_GROWTH -sMAXIMUM_MEMORY=4GB -sSTACK_SIZE=8MB -sEXPORTED_RUNTIME_METHODS=FS,callMain The JavaScript that drives these programs in the browser (convert.worker.mjs, dwgpdf.mjs, r2000clean.mjs and the helpers next to them in /engine/) is FormatYard's own code and is served as readable source.