# OCaml does not preserve binary compatibility across compiler releases, # so when updating it you should ensure that all dependent packages are # also updated by incrementing their revisions. # # Specific packages to pay attention to include: # - camlp4 # - opam # # Applications that really shouldn't break on a compiler update are: # - mldonkey # - coq # - coccinelle # - unison class Ocaml < Formula desc "General purpose programming language in the ML family" homepage "https://ocaml.org/" url "https://caml.inria.fr/pub/distrib/ocaml-4.07/ocaml-4.07.1.tar.xz" sha256 "dfe48b1da31da9c82d77612582fae74c80e8d1ac650e1c24f5ac9059e48307b8" head "https://github.com/ocaml/ocaml.git", :branch => "trunk" bottle do cellar :any sha256 "f8490faa0dc3814633cb2eb5f6c5af00e4e8996c867f485cca4844b460966868" => :mojave sha256 "d18ce3b54b85ffe8a6ea32c6079fbdfcfdd4cda852b32919a87644ca2153e5b0" => :high_sierra sha256 "6477940a49ea3a5d262a12e559a296511f5445c921ff3fdf304e0f039485b6a3" => :sierra end pour_bottle? do # The ocaml compilers embed prefix information in weird ways that the default # brew detection doesn't find, and so needs to be explicitly blacklisted. reason "The bottle needs to be installed into /usr/local." satisfy { HOMEBREW_PREFIX.to_s == "/usr/local" } end option "with-x11", "Install with the Graphics module" option "with-flambda", "Install with flambda support" depends_on :x11 => :optional def install ENV.deparallelize # Builds are not parallel-safe, esp. with many cores # the ./configure in this package is NOT a GNU autoconf script! args = ["-prefix", HOMEBREW_PREFIX.to_s, "-with-debug-runtime", "-mandir", man] args << "-no-graph" if build.without? "x11" args << "-flambda" if build.with? "flambda" system "./configure", *args system "make", "world.opt" system "make", "install", "PREFIX=#{prefix}" end test do output = shell_output("echo 'let x = 1 ;;' | #{bin}/ocaml 2>&1") assert_match "val x : int = 1", output assert_match HOMEBREW_PREFIX.to_s, shell_output("#{bin}/ocamlc -where") end end