Commit d45c0844 authored by Stephane Glondu's avatar Stephane Glondu

Add opam-bootstrap.sh and add an "easy way" section to INSTALL.md

parent 24b0859f
Belenios compilation instructions
=================================
The easiest and most portable way to compile Belenios from source is
to use [OPAM](http://opam.ocamlpro.com/), which is a package manager
for OCaml projects. You can find installation instructions
[there](http://opam.ocaml.org/doc/Quick_Install.html).
The easy way
------------
Belenios is written in OCaml and has some dependencies towards
third-party OCaml libraries. The easiest and most portable way to
compile Belenios from source is to use
[OPAM](http://opam.ocamlpro.com/), which is a package manager for
OCaml projects.
The requirements are a POSIX system, a C compiler,
[GMP](http://gmplib.org/) and [PCRE](http://www.pcre.org/). These
libraries are quite common, and probably available from your system
package manager if you have one.
In Belenios sources, there is a `opam-bootstrap.sh` shell script that
downloads and installs OCaml, OPAM and all the dependencies of
Belenios into a single directory. You can chose the directory by
setting the `OPAMROOT` environment variable, or it will take `~/.opam`
by default. Just run:
./opam-boostap.sh
On a modern desktop system, this needs approximately 10 minutes and 1
gigabyte of disk space.
If everything goes successfully, follow the given instructions to
update your shell environment, then run:
make all
and you can skip the next two sections.
Command-line tool
-----------------
......@@ -20,22 +47,11 @@ To compile the command-line tool, you will need:
* [Atdgen](http://mjambon.com/atdgen)
* [Yojson](http://mjambon.com/yojson.html)
If you use [OPAM](http://opam.ocamlpro.com/), these dependencies can
be installed with the following command:
With OPAM, these dependencies can be installed with the following
command:
opam install atdgen zarith cryptokit uuidm calendar
On [Debian](http://www.debian.org)-based systems, they can be
installed with the following command:
sudo apt-get install libatdgen-ocaml-dev libzarith-ocaml-dev libcryptokit-ocaml-dev libuuidm-ocaml-dev libcalendar-ocaml-dev
On [Ubuntu](http://www.ubuntu.com), you need to enable the "Universe"
repository. This can be done with the following command-line (run it
before running the command above):
sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) universe"
Once all the dependencies have been installed, the command-line tool
can be compiled with:
......@@ -57,16 +73,6 @@ With OPAM, you can install them with:
opam install eliom csv
On Debian-based systems, you can install it with:
sudo apt-get install ocsigenserver eliom libcsv-ocaml-dev
But keep in mind that Belenios needs a very recent version of these
packages (in particular, eliom version 3 which is not in Debian stable
at the time of writing), so the ones available on your system might be
too old. If you are in this case, and want to run the server, we
advise you to use OPAM.
Once all the dependencies have been installed, the Eliom module can be
compiled with:
......@@ -95,3 +101,24 @@ Once all the dependencies have been installed, the documentation can
be compiled with:
make doc
Compilation using only official Debian packages
-----------------------------------------------
At the time of writing (07 Jan 2014), you need the development version
of Debian (or Ubuntu) to be able to compile Belenios using only
official Debian packages. On Ubuntu, you need to enable the "Universe"
repository. Instead of using OPAM, the dependencies of Belenios can
then be installed with:
sudo apt-get install libatdgen-ocaml-dev libzarith-ocaml-dev libcryptokit-ocaml-dev libuuidm-ocaml-dev libcalendar-ocaml-dev
sudo apt-get install ocsigenserver eliom libcsv-ocaml-dev
Troubleshooting
---------------
OCamlDuce is an optional transitive dependency of Belenios, but
Belenios does not use it. If OCamlDuce was installed outside of OPAM
(e.g. via your system package manager), you may face issues. You can
work around them by uninstalling OCamlDuce and restarting the
installation procedure.
#!/bin/sh
set -e
# 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
export OPAMROOT="${OPAMROOT:-$HOME/.opam}"
if [ -e "$OPAMROOT" ]; then
echo "$OPAMROOT already exists."
echo "Please set OPAMROOT to a non-existent directory first."
exit 1
fi
mkdir -p "$OPAMROOT/bootstrap/src"
# Download and check tarballs
cd "$OPAMROOT/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
ea1751deff454f5c738d10d8a0ad135afee0852d391cf95766b726c0faf7cfdb ocaml-4.01.0.tar.gz
c0ab5e85b6cd26e533a40686e08aea173387d15bead817026f5b08f264642583 opam-full-1.1.0.tar.gz
EOF
# Install OCaml from source
cd "$OPAMROOT/bootstrap/src"
tar -xzf ocaml-4.01.0.tar.gz
cd ocaml-4.01.0
./configure -prefix "$OPAMROOT/bootstrap"
make world
make opt
make opt.opt
make install
export PATH="$OPAMROOT/bootstrap/bin:$PATH"
# Install OPAM from source
cd "$OPAMROOT/bootstrap/src"
tar -xzf opam-full-1.1.0.tar.gz
cd opam-full-1.1.0
./configure -prefix "$OPAMROOT/bootstrap"
make
make install
# Installation of Belenios build-dependencies
opam init --no-setup
eval `opam config env`
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 "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 OPAMROOT=$OPAMROOT"
echo " eval \`opam config env\`"
echo
echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
echo
\ No newline at end of file
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