diff options
| author | Henrik Feldt | 2015-02-08 15:18:09 +0100 | 
|---|---|---|
| committer | Mike McQuaid | 2015-02-26 12:35:57 +0000 | 
| commit | a1f4127cb164b40459c8b7b610b8c71d1a4b83a9 (patch) | |
| tree | a4d1e885de549d3314df7f5b21ea2b80ef61e73f /Library/Formula/fsharp.rb | |
| parent | 9891e7839b2a61061d2ac5bcfbbe6cacaeef94f7 (diff) | |
| download | homebrew-a1f4127cb164b40459c8b7b610b8c71d1a4b83a9.tar.bz2 | |
fsharp: fix issues with .Targets files.
Closes #35286.
Closes #36651.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Diffstat (limited to 'Library/Formula/fsharp.rb')
| -rw-r--r-- | Library/Formula/fsharp.rb | 30 | 
1 files changed, 23 insertions, 7 deletions
| diff --git a/Library/Formula/fsharp.rb b/Library/Formula/fsharp.rb index db6393f67..8f2423399 100644 --- a/Library/Formula/fsharp.rb +++ b/Library/Formula/fsharp.rb @@ -21,25 +21,41 @@ class Fsharp < Formula      system "make", "install"    end +  def post_install +    mono_ver = Formula["mono"].version +    %w|3.0 3.1|.each do |fsharp_ver| +      %w|Microsoft.Portable.FSharp.Targets +         Microsoft.FSharp.Targets|.each do |fsharp_targ| + +        tree_dir   = "lib/mono/Microsoft\ SDKs/F\#/#{fsharp_ver}/Framework/v4.0" +        source_dir = File.expand_path "#{prefix}/../../mono/#{mono_ver}/#{tree_dir}" + +        # variables: +        #  - tree_dir: the 'convoluted' non-absolute path the the installation, inside mono's prefix +        #  - source_dir: tree_dir, inside mono's prefix, expanded to a full path +        #  - fsharp_targ: the target file (for xbuild) +        mkdir_p source_dir +        ln_sf "#{prefix}/#{tree_dir}/#{fsharp_targ}", "#{source_dir}/#{fsharp_targ}" +      end +    end +  end +    test do      test_str = "Hello Homebrew"      # fsharpi and fsharpc needs mono to be in the PATH      ENV.prepend_path 'PATH', Formula["mono"].bin -    output = `echo 'printfn "#{test_str}"; exit 0' | #{bin}/fsharpi` -    assert $?.success? +    output = shell_output %{echo 'printfn "#{test_str}"; exit 0' | #{bin}/fsharpi}      assert output.include? test_str      hello = (testpath/"hello.fs")      hello.write("printfn \"#{test_str}\"\n") -    `#{bin}/fsharpc #{hello}` -    assert $?.success? +    compiler_output = shell_output "#{bin}/fsharpc #{hello}"      # make sure to find the fsharp assemblies even if the user has not set      # MONO_GAC_PREFIX to HOMEBREW_PREFIX      ENV["MONO_GAC_PREFIX"] = prefix -    output = `#{Formula["mono"].bin}/mono hello.exe` -    assert $?.success? -    assert_equal test_str, output.strip +    output = shell_output "#{Formula["mono"].bin}/mono hello.exe" +    assert_match test_str, output.strip    end    def caveats; <<-EOS.undent | 
