49 lines
1.9 KiB
Ruby
49 lines
1.9 KiB
Ruby
class Mlkit < Formula
|
|
desc "Compiler for the Standard ML programming language"
|
|
homepage "https://melsman.github.io/mlkit"
|
|
url "https://github.com/melsman/mlkit/archive/mlkit-4.4.2.tar.gz"
|
|
sha256 "193a8cb590d8b28a3d850de29999f2d121aeebfef919c4c70e83ea8f47855af9"
|
|
head "https://github.com/melsman/mlkit.git"
|
|
|
|
bottle do
|
|
sha256 "a4853a5e64ca0d9d5aafb4d5fc1caa42b2d066ad53a51e3658469cd209a91d05" => :mojave
|
|
sha256 "474a28eb9f02a2736d35ee330a4459256ac5bb1a64482a3e1e8ab12849a0a678" => :high_sierra
|
|
sha256 "ecd39ba0355d3b52bcc5ee380d6fa8fadcaa36258f2ec835f2d07ab21b5ddd65" => :sierra
|
|
end
|
|
|
|
depends_on "autoconf" => :build
|
|
depends_on "mlton" => :build
|
|
depends_on "gmp"
|
|
|
|
def install
|
|
system "sh", "./autobuild"
|
|
system "./configure", "--prefix=#{prefix}"
|
|
|
|
# The ENV.permit_arch_flags specification is needed on 64-bit
|
|
# machines because the mlkit compiler generates 32-bit machine
|
|
# code whereas the mlton compiler generates 64-bit machine
|
|
# code. Because of this difference, the ENV.m64 and ENV.m32 flags
|
|
# are not sufficient for the formula as clang is used by both
|
|
# tools in a single makefile target. For the mlton-compilation of
|
|
# sml-code, no arch flags are used for the clang assembler
|
|
# invocation. Thus, on a 32-bit machine, both the mlton-compiled
|
|
# binary (the mlkit compiler) and the 32-bit native code generated
|
|
# by the mlkit compiler will be running 32-bit code.
|
|
ENV.permit_arch_flags
|
|
system "make", "mlkit"
|
|
system "make", "mlkit_libs"
|
|
system "make", "install"
|
|
end
|
|
|
|
test do
|
|
(testpath/"test.sml").write <<~EOS
|
|
fun f(x) = x + 2
|
|
val a = [1,2,3,10]
|
|
val b = List.foldl (op +) 0 (List.map f a)
|
|
val res = if b = 24 then "OK" else "ERR"
|
|
val () = print ("Result: " ^ res ^ "\\n")
|
|
EOS
|
|
system "#{bin}/mlkit", "-o", "test", "test.sml"
|
|
assert_equal "Result: OK\n", shell_output("./test")
|
|
end
|
|
end
|