better instructions for first-time users

Summary:
public
The instructions to install opam from the web on linux were not enough:
you need to install opam somewhere on the PATH. Moreover, the wget
command could erase "opam" if launched from the infer repo, which
already has an "opam" file.

./build-infer.sh's "opam init" command would fail if ocaml was not already
installed, instead of installing a default compiler.

Finally, check that ocamlfind is installed using the same logic as other
ocamlfind packages, to get an error message explaining how to get it
using opam if it's not installed, instead of just a failure.

Reviewed By: jeremydubreil

Differential Revision: D2760678

fb-gh-sync-id: 678178e
master
Jules Villard 9 years ago committed by facebook-github-bot-1
parent 44de91f84b
commit 03ccd9d5f3

@ -106,6 +106,8 @@ compile Infer on a few Linux distributions.
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install -y \
autoconf \
automake \
build-essential \
git \
libgmp-dev \
@ -125,6 +127,8 @@ sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install -y \
autoconf \
automake \
build-essential \
g++-4.8 \
gcc-4.8 \
@ -148,8 +152,10 @@ Unfortunately, the version of opam that ships with some Linux
distributions is broken, so you'll have to get it from the web:
```sh
wget -O opam https://github.com/ocaml/opam/releases/download/1.2.2/opam-1.2.2-x86_64-Linux
chmod +x opam
wget https://github.com/ocaml/opam/releases/download/1.2.2/opam-1.2.2-x86_64-Linux
chmod +x opam-1.2.2-x86_64-Linux
sudo cp opam-1.2.2-x86_64-Linux /usr/local/bin/opam
opam init --comp=4.02.3
```
Alternatively, follow the instructions [from the opam

@ -96,15 +96,19 @@ check_installed () {
echo "initializing opam... "
check_installed opam
# opam is noisy
opam init --no-setup --yes > /dev/null
# if the first command doesn't succeed it means that ocaml is not even
# installed on the system, so we have to pick a compiler version ourselves
#
# opam is noisy, so we silence the first invocation which typically would be a
# no-op
opam init --no-setup --yes > /dev/null || \
opam init --no-setup --yes --comp=4.02.3
eval $(opam config env)
echo "preparing build... "
if [ ! -f .release ]; then
./autogen.sh > /dev/null
elif [ ! -d .git ] && [ ! -f .release ]; then
git submodule update --init --recursive
fi
TARGETS=""

@ -149,7 +149,6 @@ AC_ASSERT_PROG([ocamlc], [$OCAMLC])
AC_ASSERT_PROG([ocamlopt], [$OCAMLOPT])
AC_ASSERT_PROG([ocamlbuild], [$OCAMLBUILD])
AC_PROG_FINDLIB
AC_ASSERT_PROG([ocamlfind], [$OCAMLFIND])
AC_PROG_OCAMLLEX
AC_ASSERT_PROG([ocamllex], [$OCAMLLEX])
AC_PROG_OCAMLYACC

@ -9,16 +9,33 @@ dnl AC_ASSERT_OCAML_PKG([pkg_name], [pkg_version])
dnl
dnl fails if $pkg_name is not installed; also fails if it is not
dnl installed at version $pkg_version if specified
dnl
dnl assumes that AC_PROG_FINDLIB has been called
AC_DEFUN([AC_ASSERT_OCAML_PKG],
[dnl
AC_CHECK_OCAML_PKG_PATH([$1], [$2], [$3])
unset has_pkg
unset pkg
unset version
AS_IF([test "$OCAMLFIND" = "no"], [dnl
# trick to detect if ocamlfind is correctly installed and give the
# right opam instructions to install it if not since they're the
# same as when any other opam package is missing.
has_pkg=no
pkg=ocamlfind
version=
], [dnl
has_pkg=$AS_TR_SH[OCAML_PKG_$1]
pkg=$1
version=
AS_IF([test "x$3" = "x"], [dnl
version=" version $3"
])
])
AS_IF([test "$has_pkg" = "no"], [dnl
AC_MSG_ERROR([missing dependency: $1$version.
AC_MSG_ERROR([missing dependency: $pkg$version.
If you are using opam, please run

Loading…
Cancel
Save