2014-03-14 10:35:33 +00:00
|
|
|
require "formula"
|
|
|
|
|
|
|
|
class Mono < Formula
|
|
|
|
homepage "http://www.mono-project.com/"
|
2015-01-27 15:06:34 +00:00
|
|
|
url "http://download.mono-project.com/sources/mono/mono-3.12.0.tar.bz2"
|
|
|
|
sha1 "cec83efd13ffc1e212c632395a5aac75772a09e7"
|
|
|
|
head "https://github.com/mono/mono.git"
|
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
|
2015-01-28 15:45:06 +00:00
|
|
|
sha1 "5c6fe51dac9396ec10e8d45efdae24cf9e88bc3e" => :yosemite
|
|
|
|
sha1 "7d47061cb4f731398d2114a86010ab60e6dc88b4" => :mavericks
|
|
|
|
sha1 "48ccd72d404ef3a20255ed87c5fbc8a14ac10fb5" => :mountain_lion
|
2014-03-24 15:13:58 +00:00
|
|
|
end
|
|
|
|
|
2014-03-14 10:35:33 +00:00
|
|
|
resource "monolite" do
|
2014-12-30 05:20:09 +00:00
|
|
|
url "http://storage.bos.xamarin.com/mono-dist-master/cb/cb33b94c853049a43222288ead1e0cb059b22783/monolite-111-latest.tar.gz"
|
|
|
|
sha1 "a674c47cd60786c49185fb3512410c43689be43e"
|
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"
|
2015-01-27 15:06:34 +00:00
|
|
|
(testpath/test_name).write <<-EOS.undent
|
2014-03-14 10:35:33 +00:00
|
|
|
public class Hello1
|
|
|
|
{
|
|
|
|
public static void Main()
|
|
|
|
{
|
|
|
|
System.Console.WriteLine("#{test_str}");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
EOS
|
2015-01-27 15:06:34 +00:00
|
|
|
shell_output "#{bin}/mcs #{test_name}"
|
|
|
|
output = shell_output "#{bin}/mono hello.exe"
|
|
|
|
assert_match test_str, output.strip
|
2014-08-08 19:22:00 +00:00
|
|
|
|
|
|
|
# Tests that xbuild is able to execute lib/mono/*/mcs.exe
|
2015-01-27 15:06:34 +00:00
|
|
|
(testpath/"test.csproj").write <<-EOS.undent
|
2014-08-08 19:22:00 +00:00
|
|
|
<?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
|
2015-01-27 15:06:34 +00:00
|
|
|
shell_output "#{bin}/xbuild test.csproj"
|
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
|