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-05-18 18:56:06 +00:00
|
|
|
url "https://github.com/idris-lang/Idris-dev/archive/v0.9.18.tar.gz"
|
|
|
|
sha1 "08b863ab13c306b2643e63a2bb76a01b0305c20d"
|
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-05-18 23:58:00 +00:00
|
|
|
sha256 "f7452fb8719478d033473dc7a655f1ffae44bbccf2a2999a2b42c483363de318" => :yosemite
|
|
|
|
sha256 "5c0d4067a4284b4d551ed05824151071463d07493ffb406145e118d7f537d522" => :mavericks
|
|
|
|
sha256 "96c8ee3754b782fddfb879ab6db9a8ad0b247b9b5a83fb91943c07fc767ed101" => :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"
|
|
|
|
|
2015-05-29 02:30:10 +00:00
|
|
|
setup_ghc_compilers
|
|
|
|
|
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
|