File: with-rocq-wrap.sh

package info (click to toggle)
rocq-stdlib 9.0.0-3
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 11,828 kB
  • sloc: python: 2,928; sh: 444; makefile: 319; javascript: 24; ml: 2
file content (53 lines) | stat: -rwxr-xr-x 1,182 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env bash

set -ex

rocq=$(command -v rocq)
# NB on cygwin "$rocq" is a cygwin path (/foo/bar)
# but reading files from hash.exe needs windows paths (C:/cygwin/foo/bar)
# we avoid the problem by going through stdin
rocqhash=$(dune exec --root "$(dirname "$0")"/.. -- dev/tools/hash.exe < "$rocq")

rm -rf .wrappers
mkdir .wrappers

cat > .wrappers/coqc <<EOF
#!/bin/sh
# hash = $rocqhash
exec rocq c "\$@"
EOF

cat > .wrappers/coqdep <<EOF
#!/bin/sh
# hash = $rocqhash
exec rocq dep "\$@"
EOF

cat > .wrappers/coqdoc <<EOF
#!/bin/sh
# hash = $rocqhash
exec rocq doc "\$@"
EOF

chmod +x .wrappers/coqc .wrappers/coqdep .wrappers/coqdoc

ln -s "$(ocamlfind query rocq-runtime.kernel)" .wrappers/kernel

# fake coq-core.kernel for dune (mode native)
cat > .wrappers/META.coq-core <<EOF
package "kernel" (
  directory = "kernel"
  version = "dev"
  description = "The Rocq Kernel"
  requires = "dynlink rocq-runtime.boot rocq-runtime.lib rocq-runtime.vm"
  archive(byte) = "kernel.cma"
  archive(native) = "kernel.cmxa"
  plugin(byte) = "kernel.cma"
  plugin(native) = "kernel.cmxs"
)
EOF

export PATH="$PWD/.wrappers:$PATH"
export OCAMLPATH="$PWD/.wrappers:$OCAMLPATH"

"$@"