class RakudoStar < Formula desc "Perl 6 compiler" homepage "http://rakudo.org/" url "http://rakudo.org/downloads/star/rakudo-star-2015.09.tar.gz" sha256 "99b0332c4a05d444876efff58714104fc3cbf5f875174c1e410bedca03a6880d" bottle do sha256 "b845f58e8f3fdeb79314d416519dd4162a32e035744f428350e2bc14821a2ece" => :el_capitan sha256 "97e0e5670dfaf1d4c475634708c002cd2d2568d455ee9c02422dc78f8ea36c03" => :yosemite sha256 "c57d83c71966970ed6d7630a6a80f07532be75b80b264abc165bb00030442d7e" => :mavericks end option "with-jvm", "Build also for jvm as an alternate backend." conflicts_with "parrot" depends_on "gmp" => :optional depends_on "icu4c" => :optional depends_on "pcre" => :optional depends_on "libffi" def install libffi = Formula["libffi"] ENV.remove "CPPFLAGS", "-I#{libffi.include}" ENV.prepend "CPPFLAGS", "-I#{libffi.lib}/libffi-#{libffi.version}/include" ENV.j1 # 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" # 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. if File.directory?("#{prefix}/man") mv "#{prefix}/man", share end end test do out = `#{bin}/perl6 -e 'loop (my $i = 0; $i < 10; $i++) { print $i }'` assert_equal "0123456789", out assert_equal 0, $?.exitstatus end end