thelema/odb — Issue #33: bootstrap bash script proposal
Author: HappyCrow
Created: 2012-02-17 06:17:13+00:00
State: open

Hello,

Please find attached a script to get from source and compile
the required dependencies so that odb.ml can be used.

Regards,
F.

--- bootstrap_odb.sh
#!/bin/bash

#set -x # debug

# TODO
# - odb.ml should have an md5 check also, for the moment I rewind to
# a given tag, it seems that github forbids git archive to create
# a .tar.gz of a given revision

command -v curl >/dev/null
if [ $? -eq 1 ]; then
echo "curl must be installed"
exit 1
fi
command -v git >/dev/null
if [ $? -eq 1 ]; then
echo "git must be installed"
exit 1
fi

mkdir -p bootstrap_odb
cd bootstrap_odb
here=`pwd`

# get OCaml from sources, install it in ~/.odb
curl http://caml.inria.fr/pub/distrib/ocaml-3.12/ocaml-3.12.1.tar.bz2 \
-o ocaml-3.12.1.tar.bz2
echo "227a3daaedb150bf5037a3db01f5bf42 ocaml-3.12.1.tar.bz2" > md5sum
md5sum -c md5sum
if [ $? -eq 1 ] ; then
echo "problem with the downloaded ocaml"
exit 1
fi
tar xjf ocaml-3.12.1.tar.bz2
cd ocaml-3.12.1
./configure -prefix ~/.odb
make opt.opt && make install
cd $here

# get odb and source its bashrc file for PATH and all
git clone --depth 1 git://github.com/thelema/odb.git
cd odb
git checkout 050def074a
source odb.bashrc
cd $here

# get findlib, install it in ~/.odb
curl http://download.camlcity.org/download/findlib-1.2.7.tar.gz \
-o findlib-1.2.7.tar.gz
echo "000bff723e8d3d727a7edd5b5901b540 findlib-1.2.7.tar.gz" > md5sum
md5sum -c md5sum
if [ $? -eq 1 ] ; then
echo "problem with the downloaded findlib"
exit 1
fi
tar xzf findlib-1.2.7.tar.gz
cd findlib-1.2.7
./configure -bindir ~/.odb/bin \
-mandir ~/.odb/man \
-sitelib ~/.odb/lib/ocaml/site-lib \
-config ~/.odb/etc/findlib.conf
make all && make opt && make -k install
cp src/findlib/topfind ~/.odb/lib/ocaml/
cd $here

# get batteries using odb.ml (FINAL CHECK)
ocaml odb/odb.ml batteries