camlp5: improve camlp5 formula test

By ensuring that the ocaml compiler provided by the package ocaml is up to
date enough.  We do that by adding a random compiled file from the ocaml
package ( bigarray.cma ) to the command line of the current test, so camlp5
will try to link it in with the others.  If that compiled file is too old, then
the magic number stored in it will be smaller than the magic number in the
compiled files used by camlp5.

There is a discussion about this issue here:

  https://discourse.brew.sh/t/prebuilt-bottle-dependencies/3853

Closes #35916.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
This commit is contained in:
Daniel R. Grayson 2019-01-11 15:13:10 -06:00 committed by Mike McQuaid
parent 883412bae0
commit b428f713fa
No known key found for this signature in database
GPG key ID: 48A898132FD8EE70

View file

@ -4,6 +4,7 @@ class Camlp5 < Formula
url "https://github.com/camlp5/camlp5/archive/rel707.tar.gz"
version "7.07"
sha256 "a2c493b833b217adf94d2000eb19015b990c4e441beb35cf36b1d33ed2351991"
revision 1
head "https://gforge.inria.fr/anonscm/git/camlp5/camlp5.git"
bottle do
@ -22,8 +23,13 @@ class Camlp5 < Formula
end
test do
ocaml = Formula["ocaml"]
(testpath/"hi.ml").write "print_endline \"Hi!\";;"
assert_equal "let _ = print_endline \"Hi!\"",
shell_output("#{bin}/camlp5 #{lib}/ocaml/camlp5/pa_o.cmo #{lib}/ocaml/camlp5/pr_o.cmo hi.ml")
# The purpose of linking with the file "bigarray.cma" is to ensure that the
# ocaml files are in sync with the camlp5 files. If camlp5 has been
# compiled with an older version of the ocaml compiler, then an error
# "interface mismatch" will occur.
shell_output("#{bin}/camlp5 #{lib}/ocaml/camlp5/pa_o.cmo #{lib}/ocaml/camlp5/pr_o.cmo #{ocaml.opt_lib}/ocaml/bigarray.cma hi.ml")
end
end