class Mono < Formula
desc "Cross platform, open source .NET development framework"
homepage "http://www.mono-project.com/"
url "http://download.mono-project.com/sources/mono/mono-4.2.1.102.tar.bz2"
sha256 "b7b461fe04375f621d88166ba8c6f1cb33c439fd3e17136460f7d087a51ed792"
revision 1
# xbuild requires the .exe files inside the runtime directories to
# be executable
skip_clean "lib/mono"
bottle do
sha256 "af939c83b4896ef34306b310deade23530d195749bb868dc1dd504cc9f1acc5b" => :el_capitan
sha256 "aa3ae4ac79b5b8c502c9d43449332e04b7d6cc69c4380b00e2c5f033ea1ffbc9" => :yosemite
sha256 "54e408d1a43ffbf6c023bb608c6785996c810305551b3d296f34e1126900e55c" => :mavericks
end
conflicts_with "czmq", :because => "both install `makecert` binaries"
option "without-fsharp", "Build without support for the F# language."
resource "fsharp" do
url "https://github.com/fsharp/fsharp.git", :tag => "4.0.1.0",
:revision => "b22167013d1f4f0c41107fd40935dc1a8fe46386"
end
depends_on "automake" => :build
depends_on "autoconf" => :build
depends_on "pkg-config" => :build
link_overwrite "bin/fsharpi"
link_overwrite "bin/fsharpiAnyCpu"
link_overwrite "bin/fsharpc"
link_overwrite "bin/fssrgen"
link_overwrite "lib/mono"
link_overwrite "lib/cli"
conflicts_with "disco", :because => "both install `disco` binaries"
conflicts_with "xsd", :because => "both install `xsd` binaries"
def install
args = %W[
--prefix=#{prefix}
--disable-dependency-tracking
--disable-silent-rules
--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"
# Now build and install fsharp as well
if build.with? "fsharp"
resource("fsharp").stage do
ENV.prepend_path "PATH", bin
ENV.prepend_path "PKG_CONFIG_PATH", lib/"pkgconfig"
system "./autogen.sh", "--prefix=#{prefix}"
system "make"
system "make", "install"
end
end
end
test do
test_str = "Hello Homebrew"
test_name = "hello.cs"
(testpath/test_name).write <<-EOS.undent
public class Hello1
{
public static void Main()
{
System.Console.WriteLine("#{test_str}");
}
}
EOS
shell_output "#{bin}/mcs #{test_name}"
output = shell_output "#{bin}/mono hello.exe"
assert_match test_str, output.strip
# Tests that xbuild is able to execute lib/mono/*/mcs.exe
(testpath/"test.csproj").write <<-EOS.undent
HomebrewMonoTest
v4.5
EOS
system "#{bin}/xbuild", "test.csproj"
if build.with? "fsharp"
# Test that fsharpi is working
ENV.prepend_path "PATH", bin
output = pipe_output("#{bin}/fsharpi", "printfn \"#{test_str}\"; exit 0")
assert_match test_str, output
# Tests that xbuild is able to execute fsc.exe
(testpath/"test.fsproj").write <<-EOS.undent
8.0.30703
2.0
{B6AB4EF3-8F60-41A1-AB0C-851A6DEB169E}
Exe
$(MSBuildExtensionsPath32)\\Microsoft\\VisualStudio\\v$(VisualStudioVersion)\\FSharp\\Microsoft.FSharp.Targets
EOS
(testpath/"Main.fs").write <<-EOS.undent
[]
let main _ = printfn "#{test_str}"; 0
EOS
system "#{bin}/xbuild", "test.fsproj"
end
end
def caveats; <<-EOS.undent
To use the assemblies from other formulae you need to set:
export MONO_GAC_PREFIX="#{HOMEBREW_PREFIX}"
Note that the 'mono' formula now includes F#. If you have
the 'fsharp' formula installed, remove it with 'brew uninstall fsharp'.
EOS
end
end