Attention une mise à jour du service Gitlab va être effectuée le mardi 30 novembre entre 17h30 et 18h00. Cette mise à jour va générer une interruption du service dont nous ne maîtrisons pas complètement la durée mais qui ne devrait pas excéder quelques minutes. Cette mise à jour intermédiaire en version 14.0.12 nous permettra de rapidement pouvoir mettre à votre disposition une version plus récente.

opam-bootstrap.sh 3 KB
Newer Older
1 2 3 4
#!/bin/sh

set -e

Stephane Glondu's avatar
Stephane Glondu committed
5 6
BELENIOS_SRC="${BELENIOS_SRC:-$PWD}"

7 8 9 10 11 12
# Check that OCamlDuce is not installed
if which ocamlduce >/dev/null; then
    echo "Please uninstall OCamlDuce first, or remove it from your PATH."
    exit 1
fi

13 14 15 16 17 18 19 20 21 22 23 24
echo
echo "=-=-= Download and check tarballs =-=-="
echo

# Look for wget or curl
if which wget >/dev/null; then
    echo "wget was found and will be used"
elif which curl >/dev/null; then
    wget () { curl "$1" > "${1##*/}"; }
    echo "curl was found and will be used"
fi

25 26
export BELENIOS_SYSROOT="${BELENIOS_SYSROOT:-$HOME/.belenios}"
export OPAMROOT="$BELENIOS_SYSROOT/opam"
27

28 29 30
if [ -e "$BELENIOS_SYSROOT" ]; then
    echo "$BELENIOS_SYSROOT already exists."
    echo "Please remove it or set BELENIOS_SYSROOT to a non-existent directory first."
31 32 33
    exit 1
fi

34
mkdir -p "$BELENIOS_SYSROOT/bootstrap/src"
35

36
cd "$BELENIOS_SYSROOT/bootstrap/src"
Stephane Glondu's avatar
Stephane Glondu committed
37 38
wget http://caml.inria.fr/pub/distrib/ocaml-4.02/ocaml-4.02.1.tar.gz
wget https://github.com/ocaml/opam/releases/download/1.2.2/opam-full-1.2.2.tar.gz
39 40

if which sha256sum >/dev/null; then
41
sha256sum --check <<EOF
Stephane Glondu's avatar
Stephane Glondu committed
42 43
3cbc7af5a3886c8c5af8dab5568d6256a191d89ecbd4aea18eaf5b47034c6138  ocaml-4.02.1.tar.gz
15e617179251041f4bf3910257bbb8398db987d863dd3cfc288bdd958de58f00  opam-full-1.2.2.tar.gz
44
EOF
45 46 47
else
    echo "WARNING: sha256sum was not found, checking tarballs is impossible!"
fi
48

49 50 51 52
echo
echo "=-=-= Compilation and installation of OCaml =-=-="
echo
cd "$BELENIOS_SYSROOT/bootstrap/src"
Stephane Glondu's avatar
Stephane Glondu committed
53 54
tar -xzf ocaml-4.02.1.tar.gz
cd ocaml-4.02.1
55
./configure -prefix "$BELENIOS_SYSROOT/bootstrap"
56 57 58 59
make world
make opt
make opt.opt
make install
60
export PATH="$BELENIOS_SYSROOT/bootstrap/bin:$PATH"
61

62 63 64 65
echo
echo "=-=-= Compilation and installation of OPAM =-=-="
echo
cd "$BELENIOS_SYSROOT/bootstrap/src"
Stephane Glondu's avatar
Stephane Glondu committed
66 67
tar -xzf opam-full-1.2.2.tar.gz
cd opam-full-1.2.2
68
./configure -prefix "$BELENIOS_SYSROOT/bootstrap"
Stephane Glondu's avatar
Stephane Glondu committed
69
make lib-ext
70 71 72
make
make install

Stephane Glondu's avatar
Stephane Glondu committed
73 74 75 76 77 78 79 80 81
echo
echo "=-=-= Generation of env.sh =-=-="
echo
cat > $BELENIOS_SRC/env.sh <<EOF
PATH="$BELENIOS_SYSROOT/bootstrap/bin:\$PATH"; export PATH;
OPAMROOT=$OPAMROOT; export OPAMROOT;
eval \`opam config env\`
EOF

82 83 84
echo
echo "=-=-= Initialization of OPAM root =-=-="
echo
85
opam init --no-setup
Stephane Glondu's avatar
Stephane Glondu committed
86
eval `opam config env`
87
opam switch 4.01.0
Stephane Glondu's avatar
Stephane Glondu committed
88
eval `opam config env`
89 90 91 92

echo
echo "=-=-= Installation of Belenios build-dependencies =-=-="
echo
93
opam install --yes atdgen=1.3.1 zarith=1.3 cryptokit=1.10 uuidm=0.9.5 calendar cmdliner=0.9.7 eliom=4.0.0 csv=1.3.3
94 95 96 97 98

echo
echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
echo
echo "Belenios build-dependencies have been successfully compiled and installed"
99 100
echo "to $BELENIOS_SYSROOT. The directory"
echo "  $BELENIOS_SYSROOT/bootstrap/src"
101 102 103 104
echo "can be safely removed now."
echo
echo "Next, you need to run the following commands or add them to your ~/.bashrc"
echo "or equivalent:"
Stephane Glondu's avatar
Stephane Glondu committed
105
echo "  source $BELENIOS_SRC/env.sh"
106 107
echo "Note that if you use a Bourne-incompatible shell (e.g. tcsh), you'll have"
echo "to adapt env.sh to your shell."
108 109
echo
echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
110
echo