# syntax=docker/dockerfile:1 # # helpdeco (the WinHelp decompiler by Manfred Winterhoff, Ben Collver and Paul # Wise, GPL) compiled to WebAssembly for johnmcm.com's /hlp-viewer: it turns a # .hlp into RTF topics, a project file and pictures. It is built unmodified, as # a program: each run is a fresh instance with its own in-memory file system. # (The page decodes helpdeco's SHG and MRB pictures itself; the package's # splitmrb writes them out garbled when built for 32 bits.) The Emscripten image is # pinned by version and digest, helpdeco by commit; the source built is # copied into source/ and published with these files at /source/helpdeco/. # # ./build.ps1 (or) docker build --target export --output type=local,dest=dist . ARG EMSDK_IMAGE=emscripten/emsdk:6.0.10@sha256:e077d54e2b8970575ebc4f185ac1de0b95c05f2b266134d4ba27449af7aebf65 FROM ${EMSDK_IMAGE} AS build ARG HELPDECO_COMMIT=785273788af17fde4fba7df7162d547f8645d7d8 RUN git clone -q https://github.com/pmachapman/helpdeco /helpdeco \ && git -C /helpdeco checkout -q ${HELPDECO_COMMIT} \ && test "$(git -C /helpdeco rev-parse HEAD)" = "${HELPDECO_COMMIT}" # Common settings: a program run by callMain, stdin supplied by the page (helpdeco # asks "Press CR to continue" after recoverable damage; the page always answers yes). ARG EMFLAGS="-O2 -w -sMODULARIZE=1 -sEXPORT_ES6=1 -sENVIRONMENT=worker,node \ -sINVOKE_RUN=0 -sEXIT_RUNTIME=1 -sALLOW_MEMORY_GROWTH=1 -sMAXIMUM_MEMORY=2147483648 \ -sSTACK_SIZE=1048576 -sDYNAMIC_EXECUTION=0 -sFORCE_FILESYSTEM=1 \ -sINCOMING_MODULE_JS_API=print,printErr,stdin,locateFile,wasmBinary,instantiateWasm \ -sEXPORTED_RUNTIME_METHODS=callMain,FS" RUN mkdir -p /out/source \ && cd /helpdeco/src \ && cp helpdeco.c helpdec1.c helpdeco.h compat.c compat.h helper.h /helpdeco/LICENSE /helpdeco/README /out/source/ \ && emcc ${EMFLAGS} -sEXPORT_NAME=createHelpdeco helpdeco.c helpdec1.c compat.c -o /out/helpdeco.mjs FROM scratch AS export COPY --from=build /out/ /