jackett 0.22.1382
[Homebrew/homebrew-core.git] / Formula / c / camlp5.rb
blob5718c5f2e6d9bedda2ad9ffbe920baf575d3182b
1 class Camlp5 < Formula
2   desc "Preprocessor and pretty-printer for OCaml"
3   homepage "https://camlp5.github.io/"
4   url "https://github.com/camlp5/camlp5/archive/refs/tags/8.03.01.tar.gz"
5   sha256 "057b8e06590cf29a1bd22b6c83aa5daa816d5cbb2ba2548409d474d7dc10c5b8"
6   license "BSD-3-Clause"
7   head "https://github.com/camlp5/camlp5.git", branch: "master"
9   livecheck do
10     url :stable
11     regex(/^(?:rel[._-]?)?v?(\d+(?:\.\d+)+)$/i)
12   end
14   bottle do
15     sha256 arm64_sequoia: "8eb1bd182dff1a1f93c7cad292a550a0ff6a7700dd383d344e605661413b1f73"
16     sha256 arm64_sonoma:  "2b7feece68d3595e22218a9532a50cad7a835bf55555b8ae2acbe0aa001b206a"
17     sha256 arm64_ventura: "baac175d9fc1d95967bbd534fe163ed06461993f1fffa2a601c5a2daeb960942"
18     sha256 sonoma:        "32bedf850db730633846714e007e702464370f6bfe5018bc387ee3e55744466e"
19     sha256 ventura:       "b42b8272468115f0bc0fc793937a41f965dd09bf2cabd548d7fcbd974433042c"
20     sha256 x86_64_linux:  "40fdc0d4a01d13250fc2dfa8b8c1d7feaac99894e6deecd74b662d0dca58b812"
21   end
23   depends_on "ocaml-findlib" => :build
24   depends_on "opam" => :build
25   depends_on "camlp-streams"
26   depends_on "ocaml"
28   uses_from_macos "m4" => :build
30   def install
31     opamroot = buildpath/".opam"
32     ENV["OPAMROOT"] = opamroot
33     ENV["OPAMYES"] = "1"
35     system "opam", "init", "--no-setup", "--disable-sandboxing"
36     system "opam", "exec", "--", "opam", "install", ".", "--deps-only", "-y", "--no-depexts"
38     system "./configure", "--prefix", prefix, "--mandir", man
39     system "opam", "exec", "--", "make", "world.opt"
40     system "opam", "exec", "--", "make", "install"
41     (lib/"ocaml/camlp5").install "etc/META"
42   end
44   test do
45     ocaml = Formula["ocaml"]
46     (testpath/"hi.ml").write "print_endline \"Hi!\";;"
47     assert_equal "let _ = print_endline \"Hi!\"",
48       # The purpose of linking with the file "str.cma" is to ensure that the
49       # ocaml files are in sync with the camlp5 files.  If camlp5 has been
50       # compiled with an older version of the ocaml compiler, then an error
51       # "interface mismatch" will occur.
52       shell_output("#{bin}/camlp5 #{lib}/ocaml/camlp5/pa_o.cmo " \
53                    "#{lib}/ocaml/camlp5/o_keywords.cmo " \
54                    "#{lib}/ocaml/camlp5/pr_o.cmo " \
55                    "#{ocaml.opt_lib}/ocaml/str/str.cma hi.ml")
56   end
57 end