aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/ldc.rb
blob: 0ce062177b09dde11d0548332772c9a4206b4071 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
require "formula"

class Ldc < Formula
  homepage "http://wiki.dlang.org/LDC"
  url "https://github.com/ldc-developers/ldc/releases/download/v0.15.1/ldc-0.15.1-src.tar.gz"
  sha1 "06db0c07d73bf714e6fc7a4aca4c44123e4a585a"

  devel do
    url "https://github.com/ldc-developers/ldc/releases/download/v0.15.2-beta1/ldc-0.15.2-beta1-src.tar.gz"
    sha1 "cf5b22ea98f4905ad3ba468aedfdce78d194e59d"
    version "0.15.2-beta1"
  end

  bottle do
    sha1 "bc329c6a0f9f52d634c99877a6c020436307b941" => :yosemite
    sha1 "86d65479ffc178437ed3f0dd0ea05549eede13ed" => :mavericks
    sha1 "7a89443907b3d2af67d46f273c0949f0a587c456" => :mountain_lion
  end

  needs :cxx11

  depends_on "cmake" => :build
  depends_on "llvm" => :build
  depends_on "libconfig"

  def install
    ENV.cxx11
    mkdir "build"
    cd "build" do
      system "cmake", "..", *std_cmake_args
      system "make"
      system "make", "install"
    end
  end

  test do
    (testpath/"test.d").write <<-EOS.undent
      import std.stdio;

      void main() {
        writeln("Hello, world!");
      }
    EOS

    system "#{bin}/ldc2", 'test.d'
    system "./test"
    system "#{bin}/ldmd2", 'test.d'
    system "./test"
  end
end