require "formula" class Mono < Formula homepage "http://www.mono-project.com/" url "http://download.mono-project.com/sources/mono/mono-3.6.0.tar.bz2" sha1 "54150bf88d6ebdaaa40c474c66680b06a875f060" # xbuild requires the .exe files inside the runtime directories to # be executable skip_clean "lib/mono" bottle do sha1 "722d16d7fd1546fab4a3514e726a5f0e0255470c" => :mavericks sha1 "8bbc7ba72f9cd758aced741502db4494d8d350fe" => :mountain_lion sha1 "6e166b2b5f51086750a67a561103c996df18e55b" => :lion end resource "monolite" do url "http://storage.bos.xamarin.com/mono-dist-master/latest/monolite-111-latest.tar.gz" sha1 "af90068351895082f03fdaf2840b7539e23e3f32" end # help mono find its MonoPosixHelper lib when it is not in a system path # see https://bugzilla.xamarin.com/show_bug.cgi?id=18555 patch do url "https://bugzilla.xamarin.com/attachment.cgi?id=6399" sha1 "d011dc55f341feea0bdb8aa645688b815910b734" end def install # a working mono is required for the the build - monolite is enough # for the job (buildpath+"mcs/class/lib/monolite").install resource("monolite") args = %W[ --prefix=#{prefix} --enable-nls=no ] args << "--build=" + (MacOS.prefer_64_bit? ? "x86_64": "i686") + "-apple-darwin" system "./configure", *args system "make" system "make", "install" # mono-gdb.py and mono-sgen-gdb.py are meant to be loaded by gdb, not to be # run directly, so we move them out of bin libexec.install bin/"mono-gdb.py", bin/"mono-sgen-gdb.py" end test do test_str = "Hello Homebrew" test_name = "hello.cs" hello = testpath/test_name hello.write <<-EOS.undent public class Hello1 { public static void Main() { System.Console.WriteLine("#{test_str}"); } } EOS `#{bin}/mcs #{hello}` assert $?.success? output = `#{bin}/mono hello.exe` assert $?.success? assert_equal test_str, output.strip # Tests that xbuild is able to execute lib/mono/*/mcs.exe xbuild = testpath/"test.csproj" xbuild.write <<-EOS.undent HomebrewMonoTest EOS system "#{bin}/xbuild", xbuild assert $?.success? end def caveats; <<-EOS.undent To use the assemblies from other formulae you need to set: export MONO_GAC_PREFIX="#{HOMEBREW_PREFIX}" EOS end end