2014-11-04 20:11:27 +00:00
|
|
|
require "language/haskell"
|
|
|
|
|
|
|
|
class Idris < Formula
|
|
|
|
include Language::Haskell::Cabal
|
|
|
|
|
2015-05-19 00:00:59 +00:00
|
|
|
desc "Pure functional programming language with dependent types"
|
2014-11-04 20:11:27 +00:00
|
|
|
homepage "http://www.idris-lang.org"
|
2015-12-23 11:55:01 +00:00
|
|
|
url "https://github.com/idris-lang/Idris-dev/archive/v0.9.20.2.tar.gz"
|
|
|
|
sha256 "3b89b24d07c6cd647c83b45fdede3f12fe3d07fbdefdd0b9023020beae3ad74e"
|
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-12-24 15:30:51 +00:00
|
|
|
sha256 "ac4f5907e49ccf6289f64abe999e76f5d3ec4172e36445d8a7333cd6f55d4f37" => :el_capitan
|
|
|
|
sha256 "97ebe63827aa4b3ae9d6c23ba4fc2369f0c7a415542d8acc69b3a28d1cc7e956" => :yosemite
|
|
|
|
sha256 "dc924f92f5de15482cc2305b79a68a677be2fb7eade752bbc2898893f9033153" => :mavericks
|
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-12-23 13:21:56 +00:00
|
|
|
args = []
|
|
|
|
args << "-f FFI" if build.with? "libffi"
|
|
|
|
args << "-f release" if build.stable?
|
|
|
|
install_cabal_package *args
|
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
|
2015-11-08 16:58:03 +00:00
|
|
|
|
|
|
|
(testpath/"ffi.idr").write <<-EOS.undent
|
|
|
|
module Main
|
|
|
|
puts: String -> IO ()
|
|
|
|
puts x = foreign FFI_C "puts" (String -> IO ()) x
|
|
|
|
|
|
|
|
main : IO ()
|
|
|
|
main = puts "Hello, interpreter!"
|
|
|
|
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-11-08 16:58:03 +00:00
|
|
|
shell_output "#{bin}/idris #{testpath}/ffi.idr -o #{testpath}/ffi"
|
|
|
|
result = shell_output "#{testpath}/ffi"
|
2015-01-15 22:24:35 +00:00
|
|
|
assert_match /Hello, interpreter!/, result
|
|
|
|
end
|
2014-11-04 20:11:27 +00:00
|
|
|
end
|
|
|
|
end
|