diff --git a/INSTALL.md b/INSTALL.md index 2e980f9b6..ad31a711b 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -40,7 +40,7 @@ Once you have all the dependencies above installed, configure opam as follows: ```sh -opam init -y --comp=4.01.0 +opam init -y eval $(opam config env) opam update opam install -y \ @@ -121,7 +121,7 @@ webpage](https://opam.ocaml.org/doc/Install.html). Once opam is installed, run the following commands: ```sh -./opam init -y --comp=4.01.0 +./opam init -y eval $(./opam config env) ./opam update ./opam install -y \ @@ -142,7 +142,9 @@ these steps to get Infer up and running: git clone https://github.com/facebook/infer.git cd infer # Compile Infer -make -C infer java +./autogen.sh +./configure +make java # Install Infer into your PATH export PATH=`pwd`/infer/bin:$PATH ``` @@ -162,13 +164,14 @@ Infer. # Checkout Infer git clone https://github.com/facebook/infer.git cd infer -git submodule update --init --recursive +./autogen.sh # Compile clang facebook-clang-plugins/clang/setup.sh # go have a coffee :) # Compile the clang plugin ./compile-fcp.sh # Compile Infer -make -C infer +./configure +make # Install Infer into your PATH export PATH=`pwd`/infer/bin:$PATH ``` diff --git a/m4/ac_assert_ocaml_pkg.m4 b/m4/ac_assert_ocaml_pkg.m4 index 84c0b080f..7aaaec152 100644 --- a/m4/ac_assert_ocaml_pkg.m4 +++ b/m4/ac_assert_ocaml_pkg.m4 @@ -17,21 +17,14 @@ AC_DEFUN([AC_ASSERT_OCAML_PKG], unset pkg has_pkg=$AS_TR_SH[OCAML_PKG_$1] - AS_IF([test "$has_pkg" = "no"], - [dnl - unset opam_command - unset version - opam_command="opam pin add $1 $3" - version=".$3" - AS_IF([test "x$3" = "x"], - [opam_command="opam install $1" - version=""]) + AS_IF([test "$has_pkg" = "no"], [dnl AC_MSG_ERROR([missing dependency: $1$version. If you are using opam, please run - $opam_command]) + \# create an "infer" opam package + opam pin add --no-action --yes -k path . + \# install dependencies + opam install --deps-only infer]) ]) ]) - - diff --git a/m4/ac_check_ocaml_pkg_path.m4 b/m4/ac_check_ocaml_pkg_path.m4 index 9a6ae5831..62f2cdf53 100644 --- a/m4/ac_check_ocaml_pkg_path.m4 +++ b/m4/ac_check_ocaml_pkg_path.m4 @@ -26,12 +26,37 @@ AC_DEFUN([AC_CHECK_OCAML_PKG_PATH], found=no if test "x$pkg" != "xno"; then path=`$OCAMLFIND query $pkg 2>/dev/null` - version=`$OCAMLFIND query -format '%v' $pkg 2>/dev/null` - if test "x$3" = "x" || test "x$version" = "x$3"; then + if test "x$3" != "x"; then + version=`$OCAMLFIND query -format '%v' $pkg 2>/dev/null` + unset major_req + unset minor_req + unset patch_req + unset major_inst + unset minor_inst + unset patch_inst + + major_req=$(printf $3 | cut -d . -f 1) + minor_req=$(printf $3 | cut -d . -f 2) + patch_req=$(printf $3 | cut -d . -f 3) + + major_inst=$(printf $version | cut -d . -f 1) + minor_inst=$(printf $version | cut -d . -f 2) + # discard trailing characters after patch number, eg 1.2.3+4~5 -> 3 + patch_inst=$(printf $version | cut -d . -f 3 | grep -o -e '^[[:digit:]]*') + if test $major_inst -gt $major_req || \ + (test $major_inst -eq $major_req && \ + (test $minor_inst -gt $minor_req || \ + (test $minor_inst -eq $minor_req && \ + test $path_inst -ge $path_req))); then + found=yes + fi + else + found=yes + fi + if test "$found" = "yes" ; then AC_MSG_RESULT([$path]) AS_TR_SH([OCAML_PKG_$1])=$pkg AS_TR_SH([OCAML_PKG_PATH_$1])=$path - found=yes fi fi diff --git a/opam b/opam index bfb071e0e..ba8f660af 100644 --- a/opam +++ b/opam @@ -16,10 +16,10 @@ install: [] remove: [] depends: [ "ocamlfind" {build} - "sawja" {="1.5.1"} - "atdgen" {="1.6.0"} - "javalib" {="2.3.1"} - "extlib" {="1.5.4"} + "sawja" {>="1.5.1"} + "atdgen" {>="1.6.0"} + "javalib" {>="2.3.1"} + "extlib" {>="1.5.4"} ] depexts: [ [ ["ubuntu"] ["python2.7-dev"] ]