147 lines
5 KiB
Ruby
147 lines
5 KiB
Ruby
class Mono < Formula
|
|
desc "Cross platform, open source .NET development framework"
|
|
homepage "http://www.mono-project.com/"
|
|
url "https://download.mono-project.com/sources/mono/mono-4.8.0.520.tar.bz2"
|
|
sha256 "d5f5b3e096a4eec1ae6bc2fb8b78c8c9376c1e6673371b577d80b1eeaf3940c9"
|
|
|
|
bottle do
|
|
sha256 "2ac39baa78967daac81147a8f28cfd8e379f348317044d268966e7e34ed10fa8" => :sierra
|
|
sha256 "e9a15e00b2fef73f67b80d0d462f9185fef921b94420d9dd7cd456b00f74dcd1" => :el_capitan
|
|
sha256 "8656dfa498f2138de0c0cee11f60aa27d88ce4dac7cdcab702d54842396b4c19" => :yosemite
|
|
end
|
|
|
|
# xbuild requires the .exe files inside the runtime directories to
|
|
# be executable
|
|
skip_clean "lib/mono"
|
|
|
|
link_overwrite "bin/fsharpi"
|
|
link_overwrite "bin/fsharpiAnyCpu"
|
|
link_overwrite "bin/fsharpc"
|
|
link_overwrite "bin/fssrgen"
|
|
link_overwrite "lib/mono"
|
|
link_overwrite "lib/cli"
|
|
|
|
option "without-fsharp", "Build without support for the F# language."
|
|
|
|
depends_on "automake" => :build
|
|
depends_on "autoconf" => :build
|
|
depends_on "pkg-config" => :build
|
|
depends_on "cmake" => :build
|
|
|
|
conflicts_with "xsd", :because => "both install `xsd` binaries"
|
|
conflicts_with "czmq", :because => "both install `makecert` binaries"
|
|
|
|
resource "fsharp" do
|
|
url "https://github.com/fsharp/fsharp.git",
|
|
:tag => "4.1.0.2",
|
|
:revision => "6ce41a922dd9ebb9766ca4b89b7a32f6a82e43e9"
|
|
end
|
|
|
|
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
|
|
|
|
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
|
|
|
|
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
|
|
<?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>
|
|
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
|
</PropertyGroup>
|
|
<ItemGroup>
|
|
<Compile Include="#{test_name}" />
|
|
</ItemGroup>
|
|
<Import Project="$(MSBuildBinPath)\\Microsoft.CSharp.targets" />
|
|
</Project>
|
|
EOS
|
|
system bin/"xbuild", "test.csproj"
|
|
|
|
if build.with? "fsharp"
|
|
# Test that fsharpi is working
|
|
ENV.prepend_path "PATH", bin
|
|
(testpath/"test.fsx").write <<-EOS.undent
|
|
printfn "#{test_str}"; 0
|
|
EOS
|
|
output = pipe_output("#{bin}/fsharpi test.fsx")
|
|
assert_match test_str, output
|
|
|
|
# Tests that xbuild is able to execute fsc.exe
|
|
(testpath/"test.fsproj").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>
|
|
<ProductVersion>8.0.30703</ProductVersion>
|
|
<SchemaVersion>2.0</SchemaVersion>
|
|
<ProjectGuid>{B6AB4EF3-8F60-41A1-AB0C-851A6DEB169E}</ProjectGuid>
|
|
<OutputType>Exe</OutputType>
|
|
<FSharpTargetsPath>$(MSBuildExtensionsPath32)\\Microsoft\\VisualStudio\\v$(VisualStudioVersion)\\FSharp\\Microsoft.FSharp.Targets</FSharpTargetsPath>
|
|
</PropertyGroup>
|
|
<Import Project="$(FSharpTargetsPath)" Condition="Exists('$(FSharpTargetsPath)')" />
|
|
<ItemGroup>
|
|
<Compile Include="Main.fs" />
|
|
</ItemGroup>
|
|
<ItemGroup>
|
|
<Reference Include="mscorlib" />
|
|
<Reference Include="System" />
|
|
<Reference Include="FSharp.Core" />
|
|
</ItemGroup>
|
|
</Project>
|
|
EOS
|
|
(testpath/"Main.fs").write <<-EOS.undent
|
|
[<EntryPoint>]
|
|
let main _ = printfn "#{test_str}"; 0
|
|
EOS
|
|
system bin/"xbuild", "test.fsproj"
|
|
end
|
|
end
|
|
end
|