Skip to content
Snippets Groups Projects
Commit f6c82868 authored by Shachar Itzhaky's avatar Shachar Itzhaky
Browse files

[docs] Experimental PoC for compiling with jsCoq SDK.

Based on the Docker solution, depends on `jscoq:sdk`.
parent c8dbc64e
Branches
No related tags found
No related merge requests found
REPO = https://github.com/coq-community/coqoban
WORKDIR = workdir
PATH := $(PWD)/bin:$(PATH)
export PATH
build: $(WORKDIR)
# Use current workspace, not jsCoq's
dune build --root .
$(WORKDIR):
git clone --recursive --depth=1 $(REPO) $@
clean:
dune clean --root .
#!/usr/bin/env node
const child_process = require('child_process');
const ME = 'jscoq',
DOCKER_IMAGE = `${ME}:sdk`;
function mounts() {
var cwd = process.cwd(),
mnt = cwd.match(/[/][^/]+/)[0];
if (!mnt)
console.warn(`${ME}: cannot detect working directory root for '${cwd}';\n` +
` this will probably not work.`)
return (mnt ? [mnt] : []).map(d => `-v${d}:${d}`);
}
function run(args) {
var cmd = 'docker', args = [
'run', ...mounts(), `-w${process.cwd()}`, '--rm',
DOCKER_IMAGE, 'coqc', ...args
];
var rc = child_process.spawnSync(cmd, args, {stdio: 'inherit'});
if (rc.error) {
console.log(`${ME}: failed to run Docker; ${rc.error}\n` +
` (${cmd} ${args.join(' ')})`);
process.exit(1);
}
if (rc.status) process.exit(rc.status);
if (rc.signal) { console.log('Killed'); process.exit(1); }
}
run(process.argv.slice(2));
\ No newline at end of file
(rule
(targets coq-pkgs)
(deps
(package coq-coqoban))
(action
(run npx %{env:pkgtool=jscoq} build workdir --top Coqoban
--package coq-pkgs/coqoban.coq-pkg)))
(dirs workdir)
(lang dune 2.5)
(using coq 0.2)
(lang dune 2.4)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment