-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathappveyor-build.sh
68 lines (54 loc) · 1.83 KB
/
appveyor-build.sh
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env sh
# If a fork of these scripts is specified, use that GitHub user instead
fork_user=${FORK_USER:-ocaml}
# If a branch of these scripts is specified, use that branch instead of 'master'
fork_branch=${FORK_BRANCH:-master}
# default setttings
SWITCH='4.02.3+mingw64c'
OPAM_URL='https://dl.dropboxusercontent.com/s/b2q2vjau7if1c1b/opam64.tar.xz'
OPAM_ARCH=opam64
if [ "$PROCESSOR_ARCHITECTURE" != "AMD64" ] && \
[ "$PROCESSOR_ARCHITEW6432" != "AMD64" ]; then
OPAM_URL='https://dl.dropboxusercontent.com/s/eo4igttab8ipyle/opam32.tar.xz'
OPAM_ARCH=opam32
fi
if [ $# -gt 0 ] && [ -n "$1" ]; then
SWITCH=$1
fi
export OPAM_LINT="false"
export CYGWIN='winsymlinks:native'
export OPAMYES=1
get() {
wget https://raw.githubusercontent.com/${fork_user}/ocaml-ci-scripts/${fork_branch}/$@
}
set -eu
curl -fsSL -o "${OPAM_ARCH}.tar.xz" "${OPAM_URL}"
tar -xf "${OPAM_ARCH}.tar.xz"
"${OPAM_ARCH}/install.sh"
opam init -a default "https://github.com/fdopen/opam-repository-mingw.git" --comp "$SWITCH" --switch "$SWITCH"
eval $(opam config env)
ocaml_system="$(ocamlc -config | awk '/^system:/ { print $2 }')"
case "$ocaml_system" in
*mingw64*)
PATH="/usr/x86_64-w64-mingw32/sys-root/mingw/bin:${PATH}"
export PATH
;;
*mingw*)
PATH="/usr/i686-w64-mingw32/sys-root/mingw/bin:${PATH}"
export PATH
;;
*)
echo "ocamlc reports a dubious system: ${ocaml_system}. Good luck!" >&2
esac
opam install depext-cygwinports depext ocp-build menhir yojson
eval $(opam config env)
TMP_BUILD=$(mktemp -d 2>/dev/null || mktemp -d -t 'citmpdir')
cd "${TMP_BUILD}"
get ci_opam.ml
get yorick.mli
get yorick.ml
ocamlc.opt yorick.mli
ocamlfind ocamlc -c yorick.ml
ocamlfind ocamlc -o ci-opam.exe -package unix -linkpkg yorick.cmo ci_opam.ml
cd "${APPVEYOR_BUILD_FOLDER}"
${TMP_BUILD}/ci-opam.exe