forked from HoTT/Coq-HoTT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hoq-config.in
53 lines (48 loc) · 1.77 KB
/
hoq-config.in
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
#!/bin/bash
# This is the configuration for wrapers around coq which tricks Coq
# into using the HoTT standard library and enables the HoTT-specific
# options. One day we might figure out how to create an honest Coq
# toplevel instead.
prefix="@prefix@"
export COQC="@COQC@"
export COQCHK="@COQCHK@"
export COQDEP="@COQDEP@"
export COQDOC="@COQDOC@"
export COQIDE="@COQIDE@"
export COQTOP="@COQTOP@"
function readlink_f() {
# readlink -f doesn't work on Mac OS. So we roll our own readlink
# -f, from
# http://stackoverflow.com/questions/1055671/how-can-i-get-the-behavior-of-gnus-readlink-f-on-a-mac
TARGET_FILE="$1"
cd "$(dirname "$TARGET_FILE")"
TARGET_FILE=`basename "$TARGET_FILE"`
# Iterate down a (possible) chain of symlinks
while [ -L "$TARGET_FILE" ]
do
TARGET_FILE=`readlink "$TARGET_FILE"`
cd "$(dirname "$TARGET_FILE")"
TARGET_FILE=`basename "$TARGET_FILE"`
done
# Compute the canonicalized name by finding the physical path
# for the directory we're in and appending the target file.
PHYS_DIR=`pwd -P`
RESULT="$PHYS_DIR/$TARGET_FILE"
echo "$RESULT"
}
# If there is a coq/theories directory in the parent directory of this
# script, then use that one, otherwise use the global one. This trick
# allows hoqc to work "in place" on the source files.
mydir="$(dirname "$(readlink_f "${BASH_SOURCE[0]}")")"
which cygpath 2>/dev/null >/dev/null && mydir="$(cygpath -m "$mydir")"
if test -d "$mydir/coq/theories"
then
export COQLIB="$mydir/coq"
export HOTTLIB="$mydir/theories"
export HOTTCONTRIB="$mydir/contrib"
else
export COQLIB="@hottdir@/coq"
export HOTTLIB="@hottdir@/theories"
export HOTTCONTRIB="@hottdir@/contrib"
fi
#export COQ_ARGS=(-coqlib "$COQLIB" -R "$HOTTLIB" HoTT -Q "$HOTTCONTRIB" "" -indices-matter)