homebrew-core/Formula/idris.rb

58 lines
1.7 KiB
Ruby
Raw Normal View History

2014-11-04 20:11:27 +00:00
require "language/haskell"
class Idris < Formula
include Language::Haskell::Cabal
desc "Pure functional programming language with dependent types"
2014-11-04 20:11:27 +00:00
homepage "http://www.idris-lang.org"
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"
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
(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
if build.with? "libffi"
shell_output "#{bin}/idris #{testpath}/ffi.idr -o #{testpath}/ffi"
result = shell_output "#{testpath}/ffi"
assert_match /Hello, interpreter!/, result
end
2014-11-04 20:11:27 +00:00
end
end