2014-11-04 20:11:27 +00:00
|
|
|
require "language/haskell"
|
|
|
|
|
|
|
|
class Idris < Formula
|
|
|
|
include Language::Haskell::Cabal
|
|
|
|
|
|
|
|
homepage "http://www.idris-lang.org"
|
2015-03-21 22:37:39 +00:00
|
|
|
url "https://github.com/idris-lang/Idris-dev/archive/v0.9.17.tar.gz"
|
|
|
|
sha1 "d51d68227b3e3d3967769749314d3a75755a68ef"
|
2014-11-04 20:11:27 +00:00
|
|
|
head "https://github.com/idris-lang/Idris-dev.git"
|
|
|
|
|
2014-11-05 17:22:21 +00:00
|
|
|
bottle do
|
2015-03-21 23:14:15 +00:00
|
|
|
sha256 "bb4ac9869a6dc76d6b4a8ecb4e6edc2ae476872432f71509134d1c47e51abdee" => :yosemite
|
|
|
|
sha256 "69b0bbf45713c1819696bffd870c2f74fa7ff3e8b5d68dc1b96e194579ce3f13" => :mavericks
|
|
|
|
sha256 "bb2d159e3626c95e2f23c20b1e3020151a6ab928b7606fb6790b701360735769" => :mountain_lion
|
2014-11-05 17:22:21 +00:00
|
|
|
end
|
|
|
|
|
2014-11-04 20:11:27 +00:00
|
|
|
depends_on "ghc" => :build
|
|
|
|
depends_on "cabal-install" => :build
|
|
|
|
depends_on "gmp"
|
|
|
|
|
2015-01-15 22:24:35 +00:00
|
|
|
depends_on "libffi" => :recommended
|
|
|
|
depends_on "pkg-config" => :build if build.with? "libffi"
|
|
|
|
|
2014-11-04 20:11:27 +00:00
|
|
|
def install
|
2015-01-15 22:24:35 +00:00
|
|
|
flags = []
|
|
|
|
flags << "-f FFI" if build.with? "libffi"
|
|
|
|
flags << "-f release" if build.stable?
|
|
|
|
install_cabal_package flags
|
2014-11-04 20:11:27 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
|
|
|
(testpath/"hello.idr").write <<-EOS.undent
|
|
|
|
module Main
|
|
|
|
main : IO ()
|
|
|
|
main = putStrLn "Hello, Homebrew!"
|
|
|
|
EOS
|
2014-11-06 22:40:28 +00:00
|
|
|
shell_output "#{bin}/idris #{testpath}/hello.idr -o #{testpath}/hello"
|
|
|
|
result = shell_output "#{testpath}/hello"
|
2014-11-04 20:11:27 +00:00
|
|
|
assert_match /Hello, Homebrew!/, result
|
2015-01-15 22:24:35 +00:00
|
|
|
|
|
|
|
if build.with? "libffi"
|
2015-03-21 22:37:39 +00:00
|
|
|
cmd = "#{bin}/idris --exec 'putStrLn {ffi=FFI_C} \"Hello, interpreter!\"'"
|
2015-01-15 22:24:35 +00:00
|
|
|
result = shell_output cmd
|
|
|
|
assert_match /Hello, interpreter!/, result
|
|
|
|
end
|
2014-11-04 20:11:27 +00:00
|
|
|
end
|
|
|
|
end
|