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.11.tar.gz"
sha256 "759eafb5f5cb01ce891e611be49da55f56878e7ce4549c0339ae9b901eb90b5d"
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
2016-03-27 22:05:31 +00:00
sha256 "26ad3069842ab7f5cec28374b1871c5c632d0a8e937fa06f29edaca4b08d8273" => :el_capitan
sha256 "157bbd32de94ee929dc86819d47847dff77c1504ed4946a08a234095af9f6c77" => :yosemite
sha256 "5dc7e9ea4fd50fef6d95144a239c848022af3ae6a6b2bde29340ec2070e37879" => :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