75 lines
2.1 KiB
Ruby
75 lines
2.1 KiB
Ruby
class Ldc < Formula
|
|
desc "Portable D programming language compiler"
|
|
homepage "https://wiki.dlang.org/LDC"
|
|
|
|
stable do
|
|
url "https://github.com/ldc-developers/ldc/releases/download/v1.1.0/ldc-1.1.0-src.tar.gz"
|
|
sha256 "3b95216cd664e140dca321a6364c2238c442c972d6ccca8b9a65cb02d2e47112"
|
|
|
|
resource "ldc-lts" do
|
|
url "https://github.com/ldc-developers/ldc/releases/download/v0.17.2/ldc-0.17.2-src.tar.gz"
|
|
sha256 "8498f0de1376d7830f3cf96472b874609363a00d6098d588aac5f6eae6365758"
|
|
end
|
|
end
|
|
|
|
bottle do
|
|
sha256 "c90dc124f76b17207b98292c9465a8ff51171f2548a17bb6084cdd01364a7fea" => :sierra
|
|
sha256 "d8af5a6c932ff8ec723cc7c1221e9249d6b34209af031a7a653722bd07b447eb" => :el_capitan
|
|
sha256 "aa47565a0f7714bb0795b017a294f586b68510e4c10a93776c2c54f5cf2d65c4" => :yosemite
|
|
end
|
|
|
|
head do
|
|
url "https://github.com/ldc-developers/ldc.git", :shallow => false
|
|
|
|
resource "ldc-lts" do
|
|
url "https://github.com/ldc-developers/ldc.git", :shallow => false, :branch => "ltsmaster"
|
|
end
|
|
end
|
|
|
|
needs :cxx11
|
|
|
|
depends_on "cmake" => :build
|
|
depends_on "llvm"
|
|
depends_on "libconfig"
|
|
|
|
def install
|
|
ENV.cxx11
|
|
(buildpath/"ldc-lts").install resource("ldc-lts")
|
|
cd "ldc-lts" do
|
|
mkdir "build" do
|
|
args = std_cmake_args + %W[
|
|
-DLLVM_ROOT_DIR=#{Formula["llvm"].opt_prefix}
|
|
]
|
|
system "cmake", "..", *args
|
|
system "make"
|
|
end
|
|
end
|
|
mkdir "build" do
|
|
args = std_cmake_args + %W[
|
|
-DLLVM_ROOT_DIR=#{Formula["llvm"].opt_prefix}
|
|
-DINCLUDE_INSTALL_DIR=#{include}/dlang/ldc
|
|
-DD_COMPILER=#{buildpath}/ldc-lts/build/bin/ldmd2
|
|
]
|
|
|
|
system "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", "-flto=full", "test.d"
|
|
|
|
assert_match "Hello, world!", shell_output("./test")
|
|
system bin/"ldmd2", "test.d"
|
|
assert_match "Hello, world!", shell_output("./test")
|
|
end
|
|
end
|