feat: add self-contained offline development resources
Some checks failed
real-verification / chrome (push) Has been cancelled
real-verification / freecad-oracle (push) Has been cancelled
real-verification / wasm (push) Has been cancelled

This commit is contained in:
2026-08-12 02:36:09 -04:00
parent 97967041e2
commit ca6fe46030
14 changed files with 1102 additions and 12 deletions

View File

@@ -1,5 +1,5 @@
import { execFileSync } from 'node:child_process'
import { cp, mkdir, readFile, rm, writeFile } from 'node:fs/promises'
import { access, cp, mkdir, readFile, rm, writeFile } from 'node:fs/promises'
import { resolve } from 'node:path'
const root = resolve(new URL('..', import.meta.url).pathname)
@@ -7,11 +7,15 @@ const source = resolve(root, 'OpenCAMLib')
const build = resolve(root, '.cache/opencamlib-wasm')
const boost = resolve(root, '.cache/opencamlib-boost')
const install = resolve(root, 'public/vendor/opencamlib')
const offlineBoost = resolve(root, '.cache/offline-sysroot/include/boost')
const systemBoost = process.env.BOOST_INCLUDE_DIR
? resolve(process.env.BOOST_INCLUDE_DIR, 'boost')
: '/usr/include/boost'
const revision = execFileSync('git', ['-C', source, 'rev-parse', 'HEAD'], { encoding: 'utf8' }).trim()
await rm(boost, { recursive: true, force: true })
await mkdir(boost, { recursive: true })
await cp('/usr/include/boost', resolve(boost, 'boost'), { recursive: true })
await cp(await access(offlineBoost).then(() => offlineBoost, () => systemBoost), resolve(boost, 'boost'), { recursive: true })
await mkdir(build, { recursive: true })
const configure = [