homebrew-core/Formula/rakudo-star.rb
2018-05-07 21:38:35 -07:00

52 lines
1.8 KiB
Ruby

class RakudoStar < Formula
desc "Perl 6 compiler"
homepage "https://rakudo.org/"
url "https://rakudo.perl6.org/downloads/star/rakudo-star-2018.04.tar.gz"
sha256 "7c20b3f711675ec597d94470cb8212b44eedcd3ab2e7e47430aa4329aa16761a"
bottle do
sha256 "ba565600debebff47366065d27b9e6183d3873d0f509899af5ee35661431e659" => :high_sierra
sha256 "5367a84f4151f7980d4b5f0cc893eefe73c10c5593722c63c58232e919ca05f6" => :sierra
sha256 "30301527dba2bbcfc034f5a4da0bb542ce842cba6729cadad28d2109bb6e41ca" => :el_capitan
end
option "with-jvm", "Build also for jvm as an alternate backend."
depends_on "gmp" => :optional
depends_on "icu4c" => :optional
depends_on "pcre" => :optional
depends_on "libffi"
conflicts_with "parrot"
def install
libffi = Formula["libffi"]
ENV.remove "CPPFLAGS", "-I#{libffi.include}"
ENV.prepend "CPPFLAGS", "-I#{libffi.lib}/libffi-#{libffi.version}/include"
ENV.deparallelize # An intermittent race condition causes random build failures.
backends = ["moar"]
generate = ["--gen-moar"]
backends << "jvm" if build.with? "jvm"
system "perl", "Configure.pl", "--prefix=#{prefix}", "--backends=" + backends.join(","), *generate
system "make"
system "make", "install"
# Panda is now in share/perl6/site/bin, so we need to symlink it too.
bin.install_symlink Dir[share/"perl6/site/bin/*"]
# Move the man pages out of the top level into share.
# Not all backends seem to generate man pages at this point (moar does not, parrot does),
# so we need to check if the directory exists first.
mv "#{prefix}/man", share if File.directory?("#{prefix}/man")
end
test do
out = `#{bin}/perl6 -e 'loop (my $i = 0; $i < 10; $i++) { print $i }'`
assert_equal "0123456789", out
assert_equal 0, $CHILD_STATUS.exitstatus
end
end