|
1 | 1 | set -x |
2 | 2 |
|
3 | | - |
4 | | - |
5 | 3 | # Install system packages. |
6 | | -packages_apt () { |
7 | | - case $COMPILER in |
8 | | - 4.02) PPA=avsm/ocaml42+opam12;; |
9 | | - 4.03) PPA=avsm/ocaml42+opam12; DO_SWITCH=yes;; |
10 | | - 4.04) PPA=avsm/ocaml42+opam12; DO_SWITCH=yes;; |
11 | | - 4.05) PPA=avsm/ocaml42+opam12; DO_SWITCH=yes;; |
12 | | - 4.06) PPA=avsm/ocaml42+opam12; DO_SWITCH=yes;; |
13 | | - 4.07) PPA=avsm/ocaml42+opam12; DO_SWITCH=yes;; |
14 | | - *) echo Unsupported compiler $COMPILER; exit 1;; |
15 | | - esac |
16 | | - |
17 | | - sudo add-apt-repository -y ppa:$PPA |
18 | | - sudo apt-get update -qq |
19 | | - |
20 | | - if [ -z "$DO_SWITCH" ] |
21 | | - then |
22 | | - sudo apt-get install -qq ocaml-nox |
23 | | - fi |
24 | | - |
25 | | - sudo apt-get install -qq opam |
26 | | - |
27 | | -} |
28 | | - |
29 | | -packages_homebrew () { |
30 | | - brew update > /dev/null |
31 | | - |
32 | | - if [ "$COMPILER" = system ] |
33 | | - then |
34 | | - brew install ocaml |
35 | | - # The system compiler on Homebrew is now 4.06 or higher, and there is no |
36 | | - # system Camlp4 package compatible with that (at least not yet). See: |
37 | | - # https://github.com/ocaml/opam-repository/pull/10455 |
38 | | - HAVE_CAMLP4=no |
39 | | - else |
40 | | - DO_SWITCH=yes |
41 | | - fi |
42 | | - |
43 | | - brew install opam |
44 | | - |
45 | | -} |
46 | | - |
47 | | -packages_osx () { |
48 | | - case $PACKAGE_MANAGER in |
49 | | - *) packages_homebrew;; |
50 | | - esac |
51 | | -} |
52 | | - |
53 | | -packages () { |
54 | | - case $TRAVIS_OS_NAME in |
55 | | - linux) packages_apt;; |
56 | | - osx) packages_osx;; |
57 | | - *) echo Unsupported system $TRAVIS_OS_NAME; exit 1;; |
58 | | - esac |
59 | | -} |
| 4 | +wget https://raw.githubusercontent.com/ocaml/ocaml-travisci-skeleton/master/.travis-ocaml.sh |
| 5 | +bash -ex .travis-ocaml.sh |
60 | 6 |
|
61 | | -packages |
62 | | - |
63 | | - |
64 | | - |
65 | | -# Initialize OPAM and switch to the right compiler, if necessary. |
66 | | -case $COMPILER in |
67 | | - 4.02) OCAML_VERSION=4.02.3;; |
68 | | - 4.03) OCAML_VERSION=4.03.0;; |
69 | | - 4.04) OCAML_VERSION=4.04.2;; |
70 | | - 4.05) OCAML_VERSION=4.05.0;; |
71 | | - 4.06) OCAML_VERSION=4.06.0;; |
72 | | - 4.07) OCAML_VERSION=4.07.0;; |
73 | | - system) OCAML_VERSION=`ocamlc -version`;; |
74 | | - *) echo Unsupported compiler $COMPILER; exit 1;; |
75 | | -esac |
76 | | - |
77 | | -if [ "$FLAMBDA" = yes ] |
78 | | -then |
79 | | - SWITCH="$OCAML_VERSION+flambda" |
80 | | -else |
81 | | - SWITCH="$OCAML_VERSION" |
82 | | -fi |
83 | | - |
84 | | -if [ -n "$DO_SWITCH" ] |
85 | | -then |
86 | | - opam init --compiler=$SWITCH -y -a |
87 | | -else |
88 | | - opam init -y -a |
89 | | -fi |
90 | | - |
91 | | -eval `opam config env` |
| 7 | +eval $(opam env) |
92 | 8 |
|
93 | 9 | ACTUAL_COMPILER=`ocamlc -version` |
94 | 10 | if [ "$ACTUAL_COMPILER" != "$OCAML_VERSION" ] |
|
97 | 13 | fi |
98 | 14 |
|
99 | 15 |
|
100 | | - |
101 | 16 | # Pin Js_of_ocaml, install dependencies, and then install Js_of_ocaml. |
102 | 17 | # Js_of_ocaml is installed |
103 | 18 | # separately because we want to keep the build directory for running the tests. |
|
0 commit comments