2014-03-14 10:35:33 +00:00
|
|
|
require "formula"
|
|
|
|
|
|
|
|
class Mono < Formula
|
|
|
|
homepage "http://www.mono-project.com/"
|
2014-10-22 07:25:37 +00:00
|
|
|
url "http://download.mono-project.com/sources/mono/mono-3.10.0.tar.bz2"
|
|
|
|
sha1 "74e43604ea48e941c39a43ebc153abee4ddba56c"
|
2014-08-08 19:22:00 +00:00
|
|
|
|
|
|
|
# xbuild requires the .exe files inside the runtime directories to
|
|
|
|
# be executable
|
|
|
|
skip_clean "lib/mono"
|
2014-03-14 10:35:33 +00:00
|
|
|
|
2014-03-24 15:13:58 +00:00
|
|
|
bottle do
|
2014-10-22 09:15:46 +00:00
|
|
|
sha1 "b30c33f4fee61ab76bbd66fd482a6fb389b58dd3" => :yosemite
|
|
|
|
sha1 "fa0b56a4cfa2e48dc1c71573ced4c08c835e19cd" => :mavericks
|
|
|
|
sha1 "2b1b55b8a8b9e0825538a64722234ddd84e72ee2" => :mountain_lion
|
2014-03-24 15:13:58 +00:00
|
|
|
end
|
|
|
|
|
2014-03-14 10:35:33 +00:00
|
|
|
resource "monolite" do
|
|
|
|
url "http://storage.bos.xamarin.com/mono-dist-master/latest/monolite-111-latest.tar.gz"
|
2014-06-09 13:14:36 +00:00
|
|
|
sha1 "af90068351895082f03fdaf2840b7539e23e3f32"
|
2014-05-14 18:38:33 +00:00
|
|
|
end
|
|
|
|
|
2014-03-14 10:35:33 +00:00
|
|
|
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"
|
2014-08-08 19:22:00 +00:00
|
|
|
test_name = "hello.cs"
|
|
|
|
hello = testpath/test_name
|
2014-03-14 10:35:33 +00:00
|
|
|
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
|
2014-08-08 19:22:00 +00:00
|
|
|
|
|
|
|
# Tests that xbuild is able to execute lib/mono/*/mcs.exe
|
|
|
|
xbuild = testpath/"test.csproj"
|
|
|
|
xbuild.write <<-EOS.undent
|
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
|
|
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
|
|
<PropertyGroup>
|
|
|
|
<AssemblyName>HomebrewMonoTest</AssemblyName>
|
|
|
|
</PropertyGroup>
|
|
|
|
<ItemGroup>
|
|
|
|
<Compile Include="#{test_name}" />
|
|
|
|
</ItemGroup>
|
|
|
|
<Import Project="$(MSBuildBinPath)\\Microsoft.CSharp.targets" />
|
|
|
|
</Project>
|
|
|
|
EOS
|
|
|
|
system "#{bin}/xbuild", xbuild
|
|
|
|
assert $?.success?
|
2014-03-14 10:35:33 +00:00
|
|
|
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
|