require "formula" class Mono < Formula homepage "http://www.mono-project.com/" url "http://download.mono-project.com/sources/mono/mono-3.10.0.tar.bz2" sha1 "74e43604ea48e941c39a43ebc153abee4ddba56c" # xbuild requires the .exe files inside the runtime directories to # be executable skip_clean "lib/mono" bottle do revision 1 sha1 "c2cb9253a6d3b69ed6b916bf0071a698e7c12c04" => :yosemite sha1 "c1b47e3c54c6617a968405c24ced6489d50e79e1" => :mavericks sha1 "ffa3cf10d50caa8bba3e8a6b9ae85964ef73be55" => :mountain_lion end resource "monolite" do url "http://storage.bos.xamarin.com/mono-dist-master/cb/cb33b94c853049a43222288ead1e0cb059b22783/monolite-111-latest.tar.gz" sha1 "a674c47cd60786c49185fb3512410c43689be43e" 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