homebrew-core/Formula/ocaml.rb
Josh Watzman a995aa20ef ocaml: fix bottles with nonstandard prefix
Unfortunately ocaml embeds the prefix into a bunch of its files, meaning
that bottles can only be used if they were built for exactly the prefix
they're being installed into.

The location of `ocamlrun` is the most obvious place the prefix is
embedded, but it seems there are others -- `ocamlc` seems to use the
hardcoded prefix for the location of `caml.h`, for instance. There are
probably others.

Closes #586.

Signed-off-by: Dominyk Tiller <dominyktiller@gmail.com>
2016-05-07 18:56:08 +01:00

60 lines
2.1 KiB
Ruby

# 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/"
head "http://caml.inria.fr/svn/ocaml/trunk", :using => :svn
stable do
url "http://caml.inria.fr/pub/distrib/ocaml-4.03/ocaml-4.03.0.tar.gz"
sha256 "7fdf280cc6c0a2de4fc9891d0bf4633ea417046ece619f011fd44540fcfc8da2"
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
bottle do
cellar :any_skip_relocation
sha256 "5a9ad99085350c0ac9a81bb9eb82543580c57069c2e1f6ca85efaf17ad2ab9f6" => :el_capitan
sha256 "495a9536a4b6a3b5bb8d4988f5c2c50d2e961a8cd1bc3b133b5d4f90425bc828" => :yosemite
sha256 "0d7ffe037bb862f141368110578f4c3aed01692ad5473bc222ea18d0cfcbac4a" => :mavericks
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
assert_match "val x : int = 1", shell_output("echo 'let x = 1 ;;' | ocaml 2>&1")
assert_match HOMEBREW_PREFIX.to_s, shell_output("ocamlc -where")
end
end