class RakudoStar < Formula desc "Perl 6 compiler" homepage "http://rakudo.org/" url "http://rakudo.org/downloads/star/rakudo-star-2015.06.tar.gz" sha256 "126491a2c9f408239fb8ed94d5369c9839e3fbe284fdfbfc4e45160ce2db5bc7" bottle do sha256 "7c4607d5b4180eb9b361af35cdcfa71cba1f97e7f8333743e7a42f8e888d566a" => :yosemite sha256 "d88519efcd261f8576bb50f4efddbf091424aedfeed865d974de747cefca3f68" => :mavericks sha256 "f8e802cb028f97e6c2894f487c5a229a8d7ca1039bd6f3c770518dc6c90221da" => :mountain_lion 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