# 12 · CAD importer (occt-import-js + Open CASCADE): exact source and build

Answer to: *"Can you supply the exact source and build instructions used for the shipped CAD importer, including Open
CASCADE?"* Verified on 21 Nov 2026 against the npm registry and both git repositories.

## 1. What is shipped

We did **not build** the importer ourselves. The page ships the **unmodified official release occt-import-js 0.0.23**
from npm (author: Viktor Kovács). The same two files are used by the page (`source/occt/`) and by the FlexFeed Light
(`source/lab/occt/`):

| File | Bytes | SHA-256 |
|---|---|---|
| `occt-import-js.js` | 96,871 | `3fb44ce11d00611f9b3f3c5775d520ebab48930c1f08279b7b1316f05f0d3379` |
| `occt-import-js.wasm` | 7,604,031 | `33391fc9d94ea5c869a6718488bf0a9a464222bac9bdc764dfe1690cef281952` |

npm package: `occt-import-js@0.0.23`, tarball https://registry.npmjs.org/occt-import-js/-/occt-import-js-0.0.23.tgz,
shasum `1916aacd5b228e92da5de631ae048ca152281778`, integrity
`sha512-RFfYQXYFX5C1mB1Aywm0ShcUKzXOr/VzTnlzhBSDJOR6YCAPt1HYCzeXWg1vwwjn/cUxwqRNhhtf1dlewoZYCQ==`,
`gitHead` `c2148e54b456b571238d35cac037d304053d64b2`.

## 2. Corresponding source

| Component | Repository | Exact revision | Licence |
|---|---|---|---|
| occt-import-js 0.0.23 | https://github.com/kovacsv/occt-import-js | tag `0.0.23` = commit `c2148e54b456b571238d35cac037d304053d64b2` (2 Dec 2024, "Update emscripten.") | LGPL-2.1 |
| Open CASCADE Technology 7.6.1 | git submodule `occt` → https://git.dev.opencascade.org/repos/occt.git (mirror: https://github.com/Open-Cascade-SAS/OCCT) | commit `d2abb6d844231cb8f29be6894440874a4700e4a5` = tag `V7_6_1` (1 Feb 2022, "Update version up to 7.6.1") | LGPL-2.1 with the Open CASCADE exception 1.0 |

Check that the shipped files belong to this source:

- The WASM file in the tag (`dist/occt-import-js.wasm`) is **byte-identical** to the shipped one (same SHA-256).
- The JS file in the tag differs only in line endings: the npm package was published from Windows (CRLF), the git
  file has LF. After removing CR, both have SHA-256 `8b090be386bc8ffba32222aa19f38742ae8ed35707819beb7f8ab4938a28c97a`.

So the shipped binaries are the build artefacts committed by the author in tag 0.0.23 (`dist/`), produced from that
tag's sources and the OCCT 7.6.1 submodule.

## 3. Build instructions (upstream, as used for the release)

The author builds on Windows with GitHub Actions (`.github/workflows/wasm_build.yml`) and the scripts in `tools/`:

1. `tools/setup_emscripten_win.bat`: clones emsdk, `emsdk install 3.1.69`, `emsdk activate 3.1.69`, plus
   `mingw-7.1.0-64bit` (make).
2. `tools/build_wasm_win.bat Release`:
   `emcmake cmake -B build\wasm -G "Unix Makefiles" -DEMSCRIPTEN=1 -DCMAKE_MAKE_PROGRAM=mingw32-make -DCMAKE_BUILD_TYPE=Release .`
   then `emmake mingw32-make -C build\wasm`.
3. `tools/build_wasm_win_dist.bat`: runs the tests (`npm run test`, mocha) and copies
   `build\wasm\Release\occt-import-js.{js,wasm}`, `occt\LICENSE_LGPL_21.txt` → `dist/license.occt.txt` and
   `LICENSE.md` → `dist/license.occt-import-js.txt` into `dist/`.

Compiler and linker settings (`CMakeLists.txt`, Emscripten branch): all OCCT modules listed by `AddOcctModule` (sources
`occt/src/<module>/*.c*`) plus `occt-import-js/src/*`; compile `-Oz -fexceptions -fwasm-exceptions -DOCCT_NO_PLUGINS`;
link `-sMODULARIZE=1 -sEXPORT_NAME='occtimportjs' -sSTACK_SIZE=10MB -sALLOW_MEMORY_GROWTH=1 --no-heap-copy
-fwasm-exceptions --bind`.

**Linux equivalent:** `tools/build-occt-import-js-0.0.23.sh` in this package (same tag, same submodule commit,
Emscripten 3.1.69, same CMake call with GNU make). We have not rebuilt the binaries ourselves; a rebuild should
produce a functionally equivalent module, but byte-identical output is not guaranteed (toolchain details on the
author's Windows runner). The shipped files are the author's own artefacts, so the source above is their
corresponding source.

## 4. LGPL compliance for the live site (what Lovable must do)

1. Ship the two files **unmodified and separate** (`/occt/occt-import-js.js`, `/occt/occt-import-js.wasm`), loaded at
   runtime; do not bundle, minify or patch them. Users can replace them with their own build (documented on the
   licence page).
2. Ship the licence texts: LGPL-2.1 (`legal/THIRD-PARTY-NOTICES.txt`, and `dist/license.occt.txt`,
   `dist/license.occt-import-js.txt` from the npm package) and name Open CASCADE prominently (OCCT exception).
3. **Offer the corresponding source from the same place as the binaries.** Recommended: host a source archive on the
   site itself, e.g. `/licences/occt-import-js-0.0.23-source.tar.gz` (occt-import-js tag 0.0.23 with the OCCT 7.6.1
   tree), and link it from the licence section next to the GitHub links. `tools/make-lgpl-source-archive.sh` creates
   it (tested 21 Nov 2026: 53.5 MB, SHA-256 `474d9160b7aa0a2faeecf232543feaf731e7132b56eb08beac7be7cbfdd604d5`; the archive is also supplied separately as `occt-import-js-0.0.23-source.tar.gz`). Links to GitHub alone depend on third-party servers; the hosted archive (or a written offer
   valid for three years) is the safer way under LGPL-2.1 § 6.
4. If the importer is ever modified or rebuilt, publish the changed sources and build scripts the same way.
