#!/bin/bash -xue PATH=~/ocaml/bin:$PATH; export PATH TARGET="$1"; shift case "$TARGET" in prepare) if [ ! -e ~/ocaml/cached-version -o "$(cat ~/ocaml/cached-version)" != "$OCAML_VERSION.$OCAML_RELEASE" ] ; then rm -rf ~/ocaml mkdir -p ~/ocaml/src cd ~/ocaml/src wget http://caml.inria.fr/pub/distrib/ocaml-$OCAML_VERSION/ocaml-$OCAML_VERSION.$OCAML_RELEASE.tar.gz tar -xzf ocaml-$OCAML_VERSION.$OCAML_RELEASE.tar.gz cd ocaml-$OCAML_VERSION.$OCAML_RELEASE ./configure -prefix ~/ocaml make world.opt make install cd .. rm -rf src echo "$OCAML_VERSION.$OCAML_RELEASE" > ~/ocaml/cached-version fi ;; build) ocaml bootstrap.ml ./boot.exe --subst ./boot.exe --dev ;; *) echo "bad command $TARGET">&2; exit 1 esac