76 lines
2.1 KiB
Ruby
76 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.3.0/ldc-1.3.0-src.tar.gz"
|
|
sha256 "efe31a639bcb44e1f5b752da21713376d9410a01279fecc8aab8572065a3050b"
|
|
|
|
resource "ldc-lts" do
|
|
url "https://github.com/ldc-developers/ldc/releases/download/v0.17.4/ldc-0.17.4-src.tar.gz"
|
|
sha256 "48428afde380415640f3db4e38529345f3c8485b1913717995547f907534c1c3"
|
|
end
|
|
|
|
depends_on "libconfig"
|
|
end
|
|
|
|
bottle do
|
|
sha256 "67455f9aa1fda1e83eab9ca8e0a859b0529d3dd38fa388024ab065e7fb87dbbb" => :sierra
|
|
sha256 "013e1eb1dd837f938f9a70d859dc3ed583d87eb40b8817b06dae2852237149ef" => :el_capitan
|
|
sha256 "f9c8ef995bfcff7a3a26ab889d069c5ffbd0e6b38014b5666ecdaddc5d44b72f" => :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"
|
|
|
|
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
|