[setup] opam 2

Summary:
Switches from opam 1 to opam 2.

Opam2 has some cool new features that simplify some of the scripting.

Notable changes:
1. Use the new `opam lock` *plugin* from https://github.com/AltGr/opam-lock/ instead of https://github.com/rgrinberg/opam-lock. This has a simpler interface for our purposes.
2. Change the way `./build-infer.sh` can be called to use an already existing switch: simply pass `--user-opam-switch` to the script and it won't attempt to create/set the current switch. This can be used to build infer in a local switch for instance.
3. Take advantage of automatic pinning where possible, eg to install infer deps without using opam.locked.

Reviewed By: ngorogiannis

Differential Revision: D13167863

fbshipit-source-id: 1a667c270
master
Jules Villard 6 years ago committed by Facebook Github Bot
parent 94e723bc82
commit c00b076a05

1
.gitignore vendored

@ -16,7 +16,6 @@
/_build /_build
/_build_logs /_build_logs
/infer/tests/codetoanalyze/java/*/codetoanalyze /infer/tests/codetoanalyze/java/*/codetoanalyze
/dependencies/infer-deps-*
_build_infer _build_infer
*.exp.test* *.exp.test*
*.test.dot *.test.dot

@ -2,6 +2,7 @@ sudo: required
language: c language: c
os: os:
- linux - linux
- osx
services: docker services: docker
osx_image: xcode7.3 osx_image: xcode7.3
before_install: before_install:
@ -11,10 +12,9 @@ before_install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew unlink python; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew unlink python; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install opam; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install opam; fi
install: install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then travis_wait 60 ./build-infer.sh --yes java --opam-switch 4.06.1 --only-setup-opam; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then travis_wait 60 ./build-infer.sh --yes java --user-opam-switch --only-setup-opam; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then eval `opam config env`; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then eval `opam env`; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then opam pin add -y --no-action -k git infer .; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then opam install --yes infer .; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then opam install -y infer; fi
script: script:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./.travis/local_install_tests.sh; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./.travis/local_install_tests.sh; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./.travis/docker_tests.sh; fi - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./.travis/docker_tests.sh; fi

@ -233,13 +233,13 @@ $ infer --debug -- clang -c examples/hello.c
$ firefox infer-out/captured/hello.c.*.html $ firefox infer-out/captured/hello.c.*.html
``` ```
## Updating opam and opam.lock ## Updating opam and opam.locked
tl; dr: Run `make opam.lock`. tl; dr: Run `make opam.locked`.
opam.lock records fixed versions of the opam dependencies known to work with infer and to respect opam.locked records fixed versions of the opam dependencies known to work with infer and to respect
the constraints in opam. This prevents unpredictable breakages of infer or its dependencies, the constraints in opam. This prevents unpredictable breakages of infer or its dependencies,
especially for infer releases, for which it is more difficult to change their package constraints especially for infer releases, for which it is more difficult to change their package constraints
after the fact. after the fact.
To add an opam package or update its version constraints, edit 'opam' then run `make opam.lock`. To add an opam package or update its version constraints, edit 'opam' then run `make opam.locked`.

@ -14,7 +14,7 @@ page to install Infer.
Here are the prerequisites to be able to compile Infer on MacOSX. This Here are the prerequisites to be able to compile Infer on MacOSX. This
is required to compile everything from source. is required to compile everything from source.
- opam 1.2.2 (instructions [here](https://opam.ocaml.org/doc/Install.html#OSX)) - opam >= 2.0.0 (instructions [here](https://opam.ocaml.org/doc/Install.html#OSX))
- Python 2.7 - Python 2.7
- sqlite - sqlite
- pkg-config - pkg-config
@ -41,7 +41,7 @@ brew cask install java
Here are the prerequisites to be able to compile Infer on Linux. This Here are the prerequisites to be able to compile Infer on Linux. This
is required to compile everything from source. is required to compile everything from source.
- opam 1.2.2 - opam >= 2.0.0
- Python 2.7 - Python 2.7
- pkg-config - pkg-config
- Java (only needed for the Java analysis) - Java (only needed for the Java analysis)

@ -689,33 +689,20 @@ conf-clean: clean
$(REMOVE_DIR) $(MODELS_DIR)/objc/out/ $(REMOVE_DIR) $(MODELS_DIR)/objc/out/
# opam package to hold infer dependencies
INFER_PKG_OPAMLOCK=infer-lock-deps
# phony because it depends on opam's internal state # phony because it depends on opam's internal state
.PHONY: opam.lock .PHONY: opam.locked
opam.lock: opam opam.locked: opam
$(QUIET)if test x"$$(git status --porcelain -- opam)" != "x"; then \
echo "ERROR: Changes to 'opam' detected." 1>&2; \
echo "ERROR: Please commit or revert your changes before updating opam.lock." 1>&2; \
echo "ERROR: This is because opam.lock is generated from the HEAD commit." 1>&2; \
exit 1; \
fi
# allow users to not force a run of opam update since it's very slow # allow users to not force a run of opam update since it's very slow
ifeq ($(NO_OPAM_UPDATE),) ifeq ($(NO_OPAM_UPDATE),)
$(QUIET)$(call silent_on_success,opam update,$(OPAM) update) $(QUIET)$(call silent_on_success,opam update,$(OPAM) update)
endif endif
$(QUIET)$(call silent_on_success,installing dependencies $(INFER_PKG_OPAMLOCK) opam package,\ $(QUIET)$(call silent_on_success,generating opam.locked,\
OPAMSWITCH=$(OPAMSWITCH); \ $(OPAM) lock .)
$(OPAM) pin add --yes --no-action -k git $(INFER_PKG_OPAMLOCK) .#HEAD; \
$(OPAM) install --deps-only --yes $(INFER_PKG_OPAMLOCK))
$(QUIET)$(call silent_on_success,generating opam.lock,\
$(OPAM) lock --pkg $(INFER_PKG_OPAMLOCK) > opam.lock)
# This is a magical version number that doesn't reinstall the world when added on top of what we # This is a magical version number that doesn't reinstall the world when added on top of what we
# have in opam.lock. To upgrade this version number, manually try to install several utop versions # have in opam.locked. To upgrade this version number, manually try to install several utop versions
# until you find one that doesn't recompile the world. TODO(t20828442): get rid of magic # until you find one that doesn't recompile the world. TODO(t20828442): get rid of magic
OPAM_DEV_DEPS = ocp-indent merlin utop.2.2.0 webbrowser OPAM_DEV_DEPS = ocamlformat.0.8 ocp-indent merlin utop.2.2.0 webbrowser
ifneq ($(EMACS),no) ifneq ($(EMACS),no)
OPAM_DEV_DEPS += tuareg OPAM_DEV_DEPS += tuareg
@ -726,10 +713,6 @@ devsetup: Makefile.autoconf
$(QUIET)[ $(OPAM) != "no" ] || (echo 'No `opam` found, aborting setup.' >&2; exit 1) $(QUIET)[ $(OPAM) != "no" ] || (echo 'No `opam` found, aborting setup.' >&2; exit 1)
$(QUIET)$(call silent_on_success,installing $(OPAM_DEV_DEPS),\ $(QUIET)$(call silent_on_success,installing $(OPAM_DEV_DEPS),\
OPAMSWITCH=$(OPAMSWITCH); $(OPAM) install --yes --no-checksum user-setup $(OPAM_DEV_DEPS)) OPAMSWITCH=$(OPAMSWITCH); $(OPAM) install --yes --no-checksum user-setup $(OPAM_DEV_DEPS))
$(QUIET)echo '$(TERM_INFO)*** Running `opam config setup -a`$(TERM_RESET)' >&2
$(QUIET)OPAMSWITCH=$(OPAMSWITCH); $(OPAM) config --yes setup -a
$(QUIET)$(call silent_on_success,installing ocamlformat,\
OPAMSWITCH=$(OPAMSWITCH); $(OPAM) pin add --yes ocamlformat.$$(grep version .ocamlformat | cut -d ' ' -f 3) https://github.com/ocaml-ppx/ocamlformat.git#$$(grep version .ocamlformat | cut -d ' ' -f 3)-opam1)
$(QUIET)echo '$(TERM_INFO)*** Running `opam user-setup`$(TERM_RESET)' >&2 $(QUIET)echo '$(TERM_INFO)*** Running `opam user-setup`$(TERM_RESET)' >&2
$(QUIET)OPAMSWITCH=$(OPAMSWITCH); OPAMYES=1; $(OPAM) user-setup install $(QUIET)OPAMSWITCH=$(OPAMSWITCH); OPAMYES=1; $(OPAM) user-setup install
$(QUIET)if [ "$(PLATFORM)" = "Darwin" ] && [ x"$(GNU_SED)" = x"no" ]; then \ $(QUIET)if [ "$(PLATFORM)" = "Darwin" ] && [ x"$(GNU_SED)" = x"no" ]; then \
@ -791,7 +774,7 @@ devsetup: Makefile.autoconf
echo '$(TERM_INFO)*** NOTE: The current shell is not set up for the right opam switch.$(TERM_RESET)' >&2; \ echo '$(TERM_INFO)*** NOTE: The current shell is not set up for the right opam switch.$(TERM_RESET)' >&2; \
echo '$(TERM_INFO)*** NOTE: Please run:$(TERM_RESET)' >&2; \ echo '$(TERM_INFO)*** NOTE: Please run:$(TERM_RESET)' >&2; \
echo >&2; \ echo >&2; \
echo "$(TERM_INFO) eval \$$($(OPAM) config env)$(TERM_RESET)" >&2; \ echo "$(TERM_INFO) eval \$$($(OPAM) env)$(TERM_RESET)" >&2; \
fi fi
GHPAGES ?= no GHPAGES ?= no

@ -13,12 +13,10 @@ set -u
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
INFER_ROOT="$SCRIPT_DIR" INFER_ROOT="$SCRIPT_DIR"
INFER_DEPS_DIR="$INFER_ROOT/dependencies/infer-deps"
PLATFORM="$(uname)" PLATFORM="$(uname)"
NCPU="$(getconf _NPROCESSORS_ONLN 2>/dev/null || echo 1)" NCPU="$(getconf _NPROCESSORS_ONLN 2>/dev/null || echo 1)"
OCAML_VERSION_DEFAULT="4.06.1+flambda" INFER_OPAM_DEFAULT_SWITCH="ocaml-variants.4.06.1+flambda"
INFER_OPAM_SWITCH_DEFAULT=infer-"$OCAML_VERSION_DEFAULT" INFER_OPAM_SWITCH=${INFER_OPAM_SWITCH:-$INFER_OPAM_DEFAULT_SWITCH}
function usage() { function usage() {
echo "Usage: $0 [-y] [targets]" echo "Usage: $0 [-y] [targets]"
@ -30,9 +28,9 @@ function usage() {
echo echo
echo " options:" echo " options:"
echo " -h,--help show this message" echo " -h,--help show this message"
echo " --no-opam-lock do not use the opam.lock file and let opam resolve dependencies" echo " --no-opam-lock do not use the opam.locked file and let opam resolve dependencies"
echo " --only-setup-opam initialize opam, install the opam dependencies of infer, and exit" echo " --only-setup-opam initialize opam, install the opam dependencies of infer, and exit"
echo " --opam-switch specify the opam switch where to install infer (default: $INFER_OPAM_SWITCH_DEFAULT)" echo " --user-opam-switch use the current opam switch to install infer (default: $INFER_OPAM_DEFAULT_SWITCH)"
echo " -y,--yes automatically agree to everything" echo " -y,--yes automatically agree to everything"
echo echo
echo " examples:" echo " examples:"
@ -48,10 +46,9 @@ INFER_CONFIGURE_OPTS=${INFER_CONFIGURE_OPTS:-""}
INFER_OPAM_SWITCH=${INFER_OPAM_SWITCH:-$INFER_OPAM_SWITCH_DEFAULT} INFER_OPAM_SWITCH=${INFER_OPAM_SWITCH:-$INFER_OPAM_SWITCH_DEFAULT}
INTERACTIVE=${INTERACTIVE:-yes} INTERACTIVE=${INTERACTIVE:-yes}
JOBS=${JOBS:-$NCPU} JOBS=${JOBS:-$NCPU}
OCAML_VERSION=${OCAML_VERSION:-$OCAML_VERSION_DEFAULT}
ONLY_SETUP_OPAM=${ONLY_SETUP_OPAM:-no} ONLY_SETUP_OPAM=${ONLY_SETUP_OPAM:-no}
OPAM_LOCK_URL=${OPAM_LOCK_URL:-https://github.com/rgrinberg/opam-lock}
USE_OPAM_LOCK=${USE_OPAM_LOCK:-yes} USE_OPAM_LOCK=${USE_OPAM_LOCK:-yes}
USER_OPAM_SWITCH=no
ORIG_ARGS="$*" ORIG_ARGS="$*"
@ -83,10 +80,8 @@ while [[ $# > 0 ]]; do
shift shift
continue continue
;; ;;
--opam-switch) --user-opam-switch)
shift USER_OPAM_SWITCH=yes
[[ $# > 0 ]] || (usage; exit 1)
INFER_OPAM_SWITCH="$1"
shift shift
continue continue
;; ;;
@ -108,115 +103,90 @@ while [[ $# > 0 ]]; do
done done
# if no arguments then build both clang and Java # if no arguments then build both clang and Java
if [ "$BUILD_CLANG" = "no" ] && [ "$BUILD_JAVA" = "no" ]; then if [ "$BUILD_CLANG" == "no" ] && [ "$BUILD_JAVA" == "no" ]; then
BUILD_CLANG=yes BUILD_CLANG=yes
BUILD_JAVA=yes BUILD_JAVA=yes
fi fi
# enable --yes option for some commands in non-interactive mode # enable --yes option for some commands in non-interactive mode
YES= YES=
if [ "$INTERACTIVE" = "no" ]; then if [ "$INTERACTIVE" == "no" ]; then
YES=--yes YES=--yes
fi fi
# --yes by default for opam commands # --yes by default for opam commands except if we are using the user's opam switch
export OPAMYES=1 if [ "$INTERACTIVE" == "no" ] || [ "$USER_OPAM_SWITCH" == "no" ]; then
export OPAMYES=true
check_installed () { fi
local cmd="$1"
if ! which "$cmd" >/dev/null 2>&1; then
echo "dependency not found: '$cmd'" >&2
exit 1
fi
}
opam_retry () {
"$@" || ( \
echo >&2; \
printf '*** `%s` failed\n' "$*" >&2; \
echo '*** Updating opam then retrying' >&2; \
opam update && \
"$@" || ( \
echo >&2; \
printf '*** ERROR: `%s` failed\n' "$*" >&2; \
exit 1 \
) \
) \
}
setup_opam () { setup_opam () {
opam_retry opam init --compiler="$OCAML_VERSION" -j "$JOBS" --no-setup opam var root 1>/dev/null 2>/dev/null || opam init --reinit --bare --no-setup
if [ "$INFER_OPAM_SWITCH" = "$INFER_OPAM_SWITCH_DEFAULT" ]; then opam_switch_create_if_needed "$INFER_OPAM_SWITCH"
opam_retry opam switch set -j "$JOBS" "$INFER_OPAM_SWITCH" --alias-of "$OCAML_VERSION" opam switch set "$INFER_OPAM_SWITCH"
else
opam_retry opam switch set -j "$JOBS" "$INFER_OPAM_SWITCH"
fi
}
# Install and record the infer dependencies in opam. The main trick is to install the
# $INFER_DEPS_DIR directory instead of the much larger infer repository. That directory contains
# just enough to pretend it installs infer.
install_infer-deps () {
# remove previous infer-deps pin, which might have conflicting dependencies
opam pin remove infer-deps --no-action
INFER_TMP_DEPS_DIR="$(mktemp -d "$INFER_ROOT"/dependencies/infer-deps-XXXX)"
INFER_TMP_PACKAGE_NAME="$(basename "$INFER_TMP_DEPS_DIR")"
cp -a "$INFER_DEPS_DIR"/* "$INFER_TMP_DEPS_DIR"
# give unique name to the package to force opam to recheck the dependencies are all installed
opam pin add --no-action "$INFER_TMP_PACKAGE_NAME" "$INFER_TMP_DEPS_DIR"
opam install -j "$JOBS" --deps-only "$INFER_TMP_PACKAGE_NAME"
opam pin remove "$INFER_TMP_PACKAGE_NAME"
rm -fr "$INFER_TMP_DEPS_DIR"
# pin infer so that opam doesn't violate its package constraints when the user does
# "opam upgrade"
opam pin add infer-deps "$INFER_DEPS_DIR"
} }
install_locked_deps() { install_opam_deps () {
if ! opam lock 2> /dev/null; then local locked=
echo "opam-lock not found in the current switch, installing from '$OPAM_LOCK_URL'..." >&2 if [ "$USE_OPAM_LOCK" == yes ]; then
opam pin add -k git lock "$OPAM_LOCK_URL" locked=--locked
fi fi
opam lock --install < "$INFER_ROOT"/opam.lock opam install --deps-only $locked infer "$INFER_ROOT"
} }
install_opam_deps() { # temporary
if [ "$USE_OPAM_LOCK" = yes ]; then # https://github.com/ocaml/opam-repository/issues/13040
install_locked_deps warn_javalib_sandbox () {
else echo "*** Did opam just fail to install javalib? If so you need to disable sandboxing." >&2
install_infer-deps echo "*** Delete the following lines in $(opam var root)/config:" >&2
fi echo >&2
echo ' wrap-build-commands:' >&2
echo ' ["%{hooks}%/sandbox.sh" "build"] {os = "linux" | os = "macos"}' >&2
echo ' wrap-install-commands:' >&2
echo ' ["%{hooks}%/sandbox.sh" "install"] {os = "linux" | os = "macos"}' >&2
echo ' wrap-remove-commands:' >&2
echo ' ["%{hooks}%/sandbox.sh" "remove"] {os = "linux" | os = "macos"}' >&2
echo >&2
echo "*** once you are done don't forget to enable sandboxing again with" >&2
echo >&2
echo " opam init --reinit -ni" >&2
exit 1
} }
echo "initializing opam... " >&2 echo "initializing opam... " >&2
check_installed opam . "$INFER_ROOT"/scripts/opam_utils.sh
setup_opam # workaround bug in opam regarding symlinks
eval $(SHELL=bash opam config env --switch="$INFER_OPAM_SWITCH") # https://github.com/ocaml/opam/issues/3622
OPAMROOT=${OPAMROOT:-"$HOME"/.opam}
OPAMROOT=$(realpath "$OPAMROOT")
export OPAMROOT
if [ "$USER_OPAM_SWITCH" == "no" ]; then
setup_opam
fi
eval $(SHELL=bash opam env)
echo >&2 echo >&2
echo "installing infer dependencies; this can take up to 30 minutes... " >&2 echo "installing infer dependencies; this can take up to 30 minutes... " >&2
opam_retry install_opam_deps opam_retry install_opam_deps || warn_javalib_sandbox
if [ "$ONLY_SETUP_OPAM" = "yes" ]; then if [ "$ONLY_SETUP_OPAM" == "yes" ]; then
exit 0 exit 0
fi fi
echo "preparing build... " >&2 echo "preparing build... " >&2
if [ "$BUILD_CLANG" = "no" ]; then if [ "$BUILD_CLANG" == "no" ]; then
SKIP_SUBMODULES=true ./autogen.sh > /dev/null SKIP_SUBMODULES=true ./autogen.sh > /dev/null
else else
./autogen.sh > /dev/null ./autogen.sh > /dev/null
fi fi
if [ "$BUILD_CLANG" = "no" ]; then if [ "$BUILD_CLANG" == "no" ]; then
INFER_CONFIGURE_OPTS+=" --disable-c-analyzers" INFER_CONFIGURE_OPTS+=" --disable-c-analyzers"
fi fi
if [ "$BUILD_JAVA" = "no" ]; then if [ "$BUILD_JAVA" == "no" ]; then
INFER_CONFIGURE_OPTS+=" --disable-java-analyzers" INFER_CONFIGURE_OPTS+=" --disable-java-analyzers"
fi fi
./configure $INFER_CONFIGURE_OPTS ./configure $INFER_CONFIGURE_OPTS
if [ "$BUILD_CLANG" = "yes" ] && ! facebook-clang-plugins/clang/setup.sh --only-check-install; then if [ "$BUILD_CLANG" == "yes" ] && ! facebook-clang-plugins/clang/setup.sh --only-check-install; then
echo "" echo ""
echo " Warning: you are not using a release of Infer. The C and" echo " Warning: you are not using a release of Infer. The C and"
echo " Objective-C analyses require a custom clang to be compiled" echo " Objective-C analyses require a custom clang to be compiled"
@ -235,7 +205,7 @@ if [ "$BUILD_CLANG" = "yes" ] && ! facebook-clang-plugins/clang/setup.sh --only-
confirm="n" confirm="n"
printf "Are you sure you want to compile clang? (y/N) " printf "Are you sure you want to compile clang? (y/N) "
if [ "$INTERACTIVE" = "no" ]; then if [ "$INTERACTIVE" == "no" ]; then
confirm="y" confirm="y"
echo "$confirm" echo "$confirm"
else else

@ -189,7 +189,7 @@ AC_ASSERT_OCAML_PKG([atdgen], [], [])
AC_ASSERT_OCAML_PKG([biniou]) AC_ASSERT_OCAML_PKG([biniou])
AC_ASSERT_OCAML_PKG([camlzip], [zip]) AC_ASSERT_OCAML_PKG([camlzip], [zip])
AC_ASSERT_OCAML_PKG([easy-format]) AC_ASSERT_OCAML_PKG([easy-format])
AC_ASSERT_OCAML_PKG([oUnit], [], [2.0.0]) AC_ASSERT_OCAML_PKG([oUnit], [], [2.0.5])
AC_CHECK_TOOL([UTOP], [utop], [no]) AC_CHECK_TOOL([UTOP], [utop], [no])
AC_ASSERT_OCAML_PKG([yojson]) AC_ASSERT_OCAML_PKG([yojson])
@ -202,6 +202,12 @@ AC_ARG_VAR([OPAMSWITCH], [Opam switch used for building infer.])
AC_CHECK_TOOL([OPAM], [opam], [no]) AC_CHECK_TOOL([OPAM], [opam], [no])
AS_IF([test "$OPAM" != "no"], [ AS_IF([test "$OPAM" != "no"], [
AC_MSG_CHECKING([opam version])
opam_version=$(opam --version)
case $opam_version in
2.*) AC_MSG_RESULT([$opam_version]); break;;
*) AC_MSG_ERROR([opam version $opam_version is not supported, please install opam version 2 instead]); break;;
esac
AC_MSG_CHECKING([current opam root]) AC_MSG_CHECKING([current opam root])
OPAMROOT=$("$OPAM" config var root) OPAMROOT=$("$OPAM" config var root)
AC_MSG_RESULT([$OPAMROOT]) AC_MSG_RESULT([$OPAMROOT])
@ -222,7 +228,6 @@ if test "x$enable_java_analyzers" = "xyes"; then
AC_ASSERT_PROG([java], [$JAVA]) AC_ASSERT_PROG([java], [$JAVA])
AC_ASSERT_OCAML_PKG([javalib], [], [2.3.3]) AC_ASSERT_OCAML_PKG([javalib], [], [2.3.3])
AC_ASSERT_OCAML_PKG([sawja], [], [1.5.2]) AC_ASSERT_OCAML_PKG([sawja], [], [1.5.2])
AC_ASSERT_OCAML_PKG([ptrees])
AC_MSG_CHECKING([for JAVA_HOME]) AC_MSG_CHECKING([for JAVA_HOME])
cat - <<_ACEOF >conftest.java cat - <<_ACEOF >conftest.java

@ -1,10 +0,0 @@
# Copyright (c) 2017-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# This file exists to make opam happy, it should not do anything useful besides that.
.PHONY: install uninstall
install uninstall:
@:

@ -1,8 +0,0 @@
#!/bin/bash
# Copyright (c) 2017-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# This file exists just to make opam happy, it should not do anything useful besides that.

@ -1,8 +0,0 @@
#!/bin/bash
# Copyright (c) 2017-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# This file exists just to make opam happy, it should not do anything useful besides that.

@ -1 +0,0 @@
../../opam

@ -57,7 +57,7 @@ let common_cflags =
let common_optflags = match build_mode with Opt -> ["-O3"] | Default | Test -> [] let common_optflags = match build_mode with Opt -> ["-O3"] | Default | Test -> []
let common_libraries = let common_libraries =
(if java then ["javalib"; "ptrees"; "sawja"] else []) (if java then ["javalib"; "sawja"] else [])
@ [ "ANSITerminal" @ [ "ANSITerminal"
; "apron" ; "apron"
; "apron.octMPQ" ; "apron.octMPQ"

@ -15,6 +15,6 @@ AC_DEFUN([AC_ASSERT_OCAML_MIN_VERSION],
m4_newline([ Please upgrade to OCaml >= $1. If you are using opam, you can run]) m4_newline([ Please upgrade to OCaml >= $1. If you are using opam, you can run])
m4_newline([dnl m4_newline([dnl
opam switch $1 opam switch $1
eval \$(opam config env)]) eval \$(opam env)])
])])]) ])])])
]) ])

@ -38,7 +38,6 @@ AC_DEFUN([AC_ASSERT_OCAML_PKG],
If you are using opam, please run If you are using opam, please run
opam update opam update
opam pin add --yes --no-action infer . opam install --deps-only infer .])
opam install --deps-only infer])
]) ])
]) ])

20
opam

@ -1,30 +1,23 @@
opam-version: "1.2" opam-version: "2.0"
name: "infer" name: "infer"
version: "0.15.0" version: "0.15.0"
maintainer: "opam-devel@lists.ocaml.org" synopsis: "A static analyzer for Java, C, C++, and Objective-C"
maintainer: "the infer team"
authors: "Facebook" authors: "Facebook"
homepage: "https://github.com/facebook/infer" homepage: "https://github.com/facebook/infer"
bug-reports: "https://github.com/facebook/infer/issues" bug-reports: "https://github.com/facebook/infer/issues"
dev-repo: "https://github.com/facebook/infer.git" dev-repo: "git://github.com/facebook/infer.git"
license: "MIT" license: "MIT"
build: [ build: [
["./autogen.sh"] ["./autogen.sh"]
["./configure" ["./configure"
"--disable-c-analyzers" "--disable-c-analyzers"
"--prefix=%{prefix}%"] "--prefix=%{prefix}%"]
["make" "-j%{jobs}%"] [make "-j%{jobs}%"]
] ]
install: [ install: [
["make" "install"] [make "install"]
] ]
remove: [
["./autogen.sh"]
["./configure"
"--disable-c-analyzers"
"--prefix=%{prefix}%"]
["make" "uninstall"]
]
ocaml-version: [ >= "4.04.2" ]
depends: [ depends: [
"ANSITerminal" {>="0.7"} "ANSITerminal" {>="0.7"}
"apron" "apron"
@ -42,6 +35,7 @@ depends: [
"elina" {>="1.1"} "elina" {>="1.1"}
"javalib" {>="2.3.5"} "javalib" {>="2.3.5"}
"mtime" "mtime"
"ocaml" {>="4.06.0"}
"ocamlfind" {build} "ocamlfind" {build}
"ocamlgraph" "ocamlgraph"
"ounit" {="2.0.5"} "ounit" {="2.0.5"}

@ -1,95 +0,0 @@
ANSITerminal = 0.8
apron = 20160125
atd = 2.0.0
atdgen = 2.0.0
atdgen-runtime = 2.0.0
base = v0.11.0
base64 = 2.2.0
bin_prot = v0.11.0
biniou = 1.2.0
camlidl = 1.05
camlp4 = 4.06+1
camlzip = 1.07
camomile = 1.0.1
cmdliner = 1.0.2
conf-autoconf = 0.1
conf-gmp = 1
conf-m4 = 1
conf-mpfr = 1
conf-perl = 1
conf-pkg-config = 1.0
conf-sqlite3 = 1
conf-which = 1
conf-zlib = 1
configurator = v0.11.0
core = v0.11.2
core_kernel = v0.11.1
cppo = 1.6.4
cppo_ocamlbuild = 1.6.0
ctypes = 0.14.0
dune = 1.1.1
easy-format = 1.3.1
elina = 1.1
extlib = 1.7.5
fieldslib = v0.11.0
integers = 0.2.2
jane-street-headers = v0.11.0
javalib = 2.3.5
jbuilder = transition
menhir = 20180703
mlgmpidl = 1.2.7
mtime = 1.1.0
num = 1.1
ocaml-compiler-libs = v0.11.0
ocaml-migrate-parsetree = 1.0.11
ocamlbuild = 0.12.0
ocamlfind = 1.8.0
ocamlgraph = 1.8.8
octavius = 1.2.0
ounit = 2.0.5
parmap = 1.0-rc10
parsexp = v0.11.0
ppx_assert = v0.11.0
ppx_base = v0.11.0
ppx_bench = v0.11.0
ppx_bin_prot = v0.11.0
ppx_compare = v0.11.0
ppx_custom_printf = v0.11.0
ppx_derivers = 1.0
ppx_deriving = 4.2.1
ppx_enumerate = v0.11.0
ppx_expect = v0.11.0
ppx_fail = v0.11.0
ppx_fields_conv = v0.11.0
ppx_hash = v0.11.0
ppx_here = v0.11.0
ppx_inline_test = v0.11.0
ppx_jane = v0.11.0
ppx_js_style = v0.11.0
ppx_let = v0.11.0
ppx_optcomp = v0.11.0
ppx_optional = v0.11.0
ppx_pipebang = v0.11.0
ppx_sexp_conv = v0.11.1
ppx_sexp_message = v0.11.0
ppx_sexp_value = v0.11.0
ppx_tools = 5.1+4.06.0
ppx_typerep_conv = v0.11.0
ppx_variants_conv = v0.11.0
ppxlib = 0.2.1
re = 1.8.0
result = 1.3
sawja = 1.5.4
seq = 0.1
sexplib = v0.11.0
sexplib0 = v0.11.0
spawn = v0.12.0
splittable_random = v0.11.0
sqlite3 = 4.4.0
stdio = v0.11.0
topkg = 0.9.1
typerep = v0.11.0
variantslib = v0.11.0
xmlm = 1.3.0
yojson = 1.4.1
zarith = 1.7

@ -0,0 +1,127 @@
opam-version: "2.0"
name: "infer"
version: "0.15.0"
synopsis: "A static analyzer for Java, C, C++, and Objective-C"
maintainer: "the infer team"
authors: "Facebook"
homepage: "https://github.com/facebook/infer"
bug-reports: "https://github.com/facebook/infer/issues"
dev-repo: "git://github.com/facebook/infer.git"
license: "MIT"
build: [
["./autogen.sh"]
["./configure"
"--disable-c-analyzers"
"--prefix=%{prefix}%"]
[make "-j%{jobs}%"]
]
install: [
[make "install"]
]
depends: [
"ANSITerminal" {= "0.8"}
"apron" {= "20160125"}
"atd" {= "2.0.0"}
"atdgen" {= "2.0.0"}
"atdgen-runtime" {= "2.0.0"}
"base" {= "v0.11.0"}
"base-bytes" {= "base"}
"base-threads" {= "base"}
"base-unix" {= "base"}
"base64" {= "2.2.0"}
"bin_prot" {= "v0.11.0"}
"biniou" {= "1.2.0"}
"camlidl" {= "1.05"}
"camlp4" {= "4.06+1"}
"camlzip" {= "1.07"}
"camomile" {= "1.0.1"}
"cmdliner" {= "1.0.2"}
"conf-autoconf" {= "0.1"}
"conf-gmp" {= "1"}
"conf-m4" {= "1"}
"conf-mpfr" {= "1"}
"conf-perl" {= "1"}
"conf-pkg-config" {= "1.0"}
"conf-sqlite3" {= "1"}
"conf-which" {= "1"}
"conf-zlib" {= "1"}
"configurator" {= "v0.11.0"}
"core" {= "v0.11.2"}
"core_kernel" {= "v0.11.1"}
"cppo" {= "1.6.4"}
"cppo_ocamlbuild" {= "1.6.0"}
"ctypes" {= "0.14.0"}
"dune" {= "1.1.1"}
"easy-format" {= "1.3.1"}
"elina" {= "1.1"}
"extlib" {= "1.7.5"}
"fieldslib" {= "v0.11.0"}
"integers" {= "0.2.2"}
"jane-street-headers" {= "v0.11.0"}
"javalib" {= "2.3.5"}
"jbuilder" {= "transition"}
"menhir" {= "20180703"}
"mlgmpidl" {= "1.2.7"}
"mtime" {= "1.1.0"}
"num" {= "1.1"}
"ocaml" {= "4.06.1"}
"ocaml-compiler-libs" {= "v0.11.0"}
"ocaml-migrate-parsetree" {= "1.0.11"}
"ocamlbuild" {= "0.12.0"}
"ocamlfind" {= "1.8.0"}
"ocamlgraph" {= "1.8.8"}
"octavius" {= "1.2.0"}
"ounit" {= "2.0.5"}
"parmap" {= "1.0-rc10"}
"parsexp" {= "v0.11.0"}
"ppx_assert" {= "v0.11.0"}
"ppx_base" {= "v0.11.0"}
"ppx_bench" {= "v0.11.0"}
"ppx_bin_prot" {= "v0.11.0"}
"ppx_compare" {= "v0.11.0"}
"ppx_custom_printf" {= "v0.11.0"}
"ppx_derivers" {= "1.0"}
"ppx_deriving" {= "4.2.1"}
"ppx_enumerate" {= "v0.11.0"}
"ppx_expect" {= "v0.11.0"}
"ppx_fail" {= "v0.11.0"}
"ppx_fields_conv" {= "v0.11.0"}
"ppx_hash" {= "v0.11.0"}
"ppx_here" {= "v0.11.0"}
"ppx_inline_test" {= "v0.11.0"}
"ppx_jane" {= "v0.11.0"}
"ppx_js_style" {= "v0.11.0"}
"ppx_let" {= "v0.11.0"}
"ppx_optcomp" {= "v0.11.0"}
"ppx_optional" {= "v0.11.0"}
"ppx_pipebang" {= "v0.11.0"}
"ppx_sexp_conv" {= "v0.11.1"}
"ppx_sexp_message" {= "v0.11.0"}
"ppx_sexp_value" {= "v0.11.0"}
"ppx_tools" {= "5.1+4.06.0"}
"ppx_typerep_conv" {= "v0.11.0"}
"ppx_variants_conv" {= "v0.11.0"}
"ppxlib" {= "0.2.1"}
"re" {= "1.8.0"}
"result" {= "1.3"}
"sawja" {= "1.5.4"}
"seq" {= "0.1"}
"sexplib" {= "v0.11.0"}
"sexplib0" {= "v0.11.0"}
"spawn" {= "v0.12.0"}
"splittable_random" {= "v0.11.0"}
"sqlite3" {= "4.4.0"}
"stdio" {= "v0.11.0"}
"topkg" {= "0.9.1"}
"typerep" {= "v0.11.0"}
"variantslib" {= "v0.11.0"}
"xmlm" {= "1.3.0"}
"yojson" {= "1.4.1"}
"zarith" {= "1.7"}
]
depexts: [
[ ["ubuntu"] ["python2.7-dev"] ]
[ ["debian"] ["python2.7-dev"] ]
[ ["ubuntu"] ["default-jdk"] ]
[ ["debian"] ["default-jdk"] ]
]

@ -39,7 +39,7 @@ pushd "$ROOT_DIR"
rm -fr "$RELEASE_NAME" rm -fr "$RELEASE_NAME"
./build-infer.sh --only-setup-opam ./build-infer.sh --only-setup-opam
eval $(opam config env) eval $(opam env)
touch .release touch .release
./autogen.sh ./autogen.sh
./configure --prefix="/$RELEASE_NAME" ./configure --prefix="/$RELEASE_NAME"

@ -0,0 +1,65 @@
#!/bin/bash
# Copyright (c) 2018-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# source this script to import its utility functions
opam_retry () {
"$@" || ( \
echo >&2; \
printf '*** `%s` failed\n' "$*" >&2; \
echo '*** Updating opam then retrying' >&2; \
opam update && \
"$@" || ( \
echo >&2; \
printf '*** ERROR: `%s` failed\n' "$*" >&2; \
exit 1 \
) \
)
}
opam_failed () {
local command=$1
echo
printf '*** ERROR: %s failed\n' "$command" >&2
printf "*** ERROR: Try running \$(opam update) then running this script again\n" >&2
exit 1
}
opam_require_version_2 () {
local status=0
local version=0
{ version=$(opam --version 2>/dev/null); status=$?; }
if [ "$status" != 0 ]; then
printf '*** ERROR: `opam --version` failed, please install opam version 2\n' >&2
env >&2
exit 1
fi
case $version in
2*) ;;
*)
printf '*** ERROR: opam version "%s" is not supported, please install opam version 2\n' "$version" >&2
printf '*** NOTE: opam is "%s"\n' "$(which opam)" >&2
env >&2
exit 1
esac
}
# assumes opam is available and initialized
opam_switch_create_if_needed () {
local switch=$1
local switch_exists=no
for installed_switch in $(opam switch list --short); do
if [ "$installed_switch" == "$switch" ]; then
switch_exists=yes
break
fi
done
if [ "$switch_exists" = "no" ]; then
opam switch create "$switch"
fi
}
opam_require_version_2
Loading…
Cancel
Save