Commit 0ee309d8 authored by Stephane Glondu's avatar Stephane Glondu

Rewrite opam-bootstrap.sh to put bootstrap dir outside of OPAMROOT

Because OPAM deletes OPAMROOT in some circumstances...
parent 662a80d9
......@@ -8,18 +8,21 @@ if which ocamlduce >/dev/null; then
exit 1
fi
export OPAMROOT="${OPAMROOT:-$HOME/.opam}"
export BELENIOS_SYSROOT="${BELENIOS_SYSROOT:-$HOME/.belenios}"
export OPAMROOT="$BELENIOS_SYSROOT/opam"
if [ -e "$OPAMROOT" ]; then
echo "$OPAMROOT already exists."
echo "Please set OPAMROOT to a non-existent directory first."
if [ -e "$BELENIOS_SYSROOT" ]; then
echo "$BELENIOS_SYSROOT already exists."
echo "Please remove it or set BELENIOS_SYSROOT to a non-existent directory first."
exit 1
fi
mkdir -p "$OPAMROOT/bootstrap/src"
mkdir -p "$BELENIOS_SYSROOT/bootstrap/src"
# Download and check tarballs
cd "$OPAMROOT/bootstrap/src"
echo
echo "=-=-= Download and check tarballs =-=-="
echo
cd "$BELENIOS_SYSROOT/bootstrap/src"
wget http://caml.inria.fr/pub/distrib/ocaml-4.01/ocaml-4.01.0.tar.gz
wget http://www.ocamlpro.com/pub/opam-full-1.1.0.tar.gz
sha256sum --check <<EOF
......@@ -27,43 +30,53 @@ ea1751deff454f5c738d10d8a0ad135afee0852d391cf95766b726c0faf7cfdb ocaml-4.01.0.t
c0ab5e85b6cd26e533a40686e08aea173387d15bead817026f5b08f264642583 opam-full-1.1.0.tar.gz
EOF
# Install OCaml from source
cd "$OPAMROOT/bootstrap/src"
echo
echo "=-=-= Compilation and installation of OCaml =-=-="
echo
cd "$BELENIOS_SYSROOT/bootstrap/src"
tar -xzf ocaml-4.01.0.tar.gz
cd ocaml-4.01.0
./configure -prefix "$OPAMROOT/bootstrap"
./configure -prefix "$BELENIOS_SYSROOT/bootstrap"
make world
make opt
make opt.opt
make install
export PATH="$OPAMROOT/bootstrap/bin:$PATH"
export PATH="$BELENIOS_SYSROOT/bootstrap/bin:$PATH"
# Install OPAM from source
cd "$OPAMROOT/bootstrap/src"
echo
echo "=-=-= Compilation and installation of OPAM =-=-="
echo
cd "$BELENIOS_SYSROOT/bootstrap/src"
tar -xzf opam-full-1.1.0.tar.gz
cd opam-full-1.1.0
./configure -prefix "$OPAMROOT/bootstrap"
./configure -prefix "$BELENIOS_SYSROOT/bootstrap"
make
make install
# Installation of Belenios build-dependencies
echo
echo "=-=-= Initialization of OPAM root =-=-="
echo
opam init --no-setup
eval `opam config env`
echo
echo "=-=-= Installation of Belenios build-dependencies =-=-="
echo
opam install --yes atdgen zarith cryptokit uuidm calendar eliom csv
echo
echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
echo
echo "Belenios build-dependencies have been successfully compiled and installed"
echo "to $OPAMROOT. The directory"
echo " $OPAMROOT/bootstrap/src"
echo "to $BELENIOS_SYSROOT. The directory"
echo " $BELENIOS_SYSROOT/bootstrap/src"
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:"
echo " export PATH=$OPAMROOT/bootstrap/bin:\$PATH"
echo " export PATH=$BELENIOS_SYSROOT/bootstrap/bin:\$PATH"
echo " export OPAMROOT=$OPAMROOT"
echo " eval \`opam config env\`"
echo
echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
echo
\ No newline at end of file
echo
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment