diff options
Diffstat (limited to 'build.zig')
| -rw-r--r-- | build.zig | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -61,6 +61,13 @@ pub fn build(b: *std.Build) void { const dump_path = b.option([]const u8, "dump", "dump .zon embedded into the web shell (-Dplatform=web)"); const is_web = platform == .web; const enable_mupdf = b.option(bool, "mupdf", "native PDF rendering with MuPDF (AGPL/commercial; native default on, web off; -Dmupdf=false disables)") orelse !is_web; + // JPEG 2000, and with it scanned PDFs: a scan is one /JPXDecode image per + // page, so without this MuPDF decodes nothing and every page comes back + // blank. On by default — a viewer that cannot open scans is the more + // surprising default — and a switch at all because it is 31 files of + // third-party C parsing untrusted input. See the OPENJPEG block in + // mupdf.zig. + const enable_jpx = b.option(bool, "jpx", "JPEG 2000 in PDFs, for scanned documents (default on; -Djpx=false drops openjpeg)") orelse true; const is_web_target = target.result.cpu.arch == .wasm32 and target.result.os.tag == .freestanding; // wasm: size is the budget const optimize = if (is_web) .ReleaseSmall else requested_optimize; @@ -362,6 +369,7 @@ pub fn build(b: *std.Build) void { const mupdf = mupdf_build.add(b, io, mupdf_dep, .{ .target = target, .optimize = c_optimize, + .jpx = enable_jpx, }); const mupdf_mod = b.createModule(.{ .target = target, |
