aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorDavid Holm2014-06-29 12:42:53 +0200
committerMike McQuaid2014-07-13 11:05:01 -0700
commit9d7bc27b5076eda8e57687a7ddf28187580f0910 (patch)
treec648d78d4c12c5971a19c6e076ea9122b7ed9fb4 /Library
parent6899f980d871480bd1321b0b3ec7516ed433f48a (diff)
downloadhomebrew-9d7bc27b5076eda8e57687a7ddf28187580f0910.tar.bz2
mercury 14.01
Diffstat (limited to 'Library')
-rw-r--r--Library/Formula/mercury.rb57
1 files changed, 57 insertions, 0 deletions
diff --git a/Library/Formula/mercury.rb b/Library/Formula/mercury.rb
new file mode 100644
index 000000000..18464e079
--- /dev/null
+++ b/Library/Formula/mercury.rb
@@ -0,0 +1,57 @@
+require "formula"
+
+class Mercury < Formula
+ homepage "http://mercurylang.org/"
+ url "http://dl.mercurylang.org/release/mercury-srcdist-14.01.tar.gz"
+ sha1 "619680675c68a0b953024b7ee4d3886a885d94de"
+
+ bottle do
+ end
+
+ depends_on "erlang" => :optional
+ depends_on "homebrew/science/hwloc" => :optional
+ depends_on "mono" => :optional
+
+ def install
+ args = ["--prefix=#{prefix}",
+ "--mandir=#{man}",
+ "--infodir=#{info}",
+ "--disable-dependency-tracking",
+ "--enable-java-grade"]
+
+ args << "--enable-erlang-grade" if build.with? "erlang"
+ args << "--with-hwloc" if build.with? "hwloc"
+ args << "--enable-dotnet-grades" << "--enable-csharp-grade" if build.with? "mono"
+
+ system "./configure", *args
+
+ # The build system doesn't quite honour the mandir/infodir autoconf
+ # parameters.
+ system "make", "install", "PARALLEL=-j", "INSTALL_MAN_DIR=#{man}", "INSTALL_INFO_DIR=#{info}"
+
+ # Remove batch files for windows.
+ Dir.glob("#{bin}/*.bat") do |path|
+ rm path
+ end
+ end
+
+ test do
+ test_string = "Hello Homebrew\n"
+ path = testpath/"hello.m"
+ path.write <<-EOS
+ :- module hello.
+ :- interface.
+ :- import_module io.
+ :- pred main(io::di, io::uo) is det.
+ :- implementation.
+ main(IOState_in, IOState_out) :-
+ io.write_string("#{test_string}", IOState_in, IOState_out).
+ EOS
+ system "#{bin}/mmc", "--make", "hello"
+ assert File.exist?(testpath/"hello")
+
+ output = `#{testpath}/hello`
+ assert_equal test_string, output
+ assert_equal 0, $?.exitstatus
+ end
+end