2015-01-09 16:44:29 +00:00
|
|
|
class ClangFormat < Formula
|
|
|
|
homepage "http://clang.llvm.org/docs/ClangFormat.html"
|
2015-04-28 17:16:02 +00:00
|
|
|
version "2015-04-21"
|
2015-01-09 16:44:29 +00:00
|
|
|
|
2015-01-12 22:35:26 +00:00
|
|
|
bottle do
|
|
|
|
cellar :any
|
2015-04-29 06:11:11 +00:00
|
|
|
sha256 "5abc150562cdde9a2a430da7c6fbdda5fa7d891adf4c9ef0a297b991972053ee" => :yosemite
|
|
|
|
sha256 "5e6a52851120f411ef20b3c7888399dbe54ce62966b665e9c018b4272ff16238" => :mavericks
|
|
|
|
sha256 "1c57ea1bd29c1702bf574ab4121b0f6e7a3c8851dc32cf8da53a2d90b9446c18" => :mountain_lion
|
2015-01-12 22:35:26 +00:00
|
|
|
end
|
|
|
|
|
2015-01-09 16:44:29 +00:00
|
|
|
stable do
|
2015-04-28 17:16:02 +00:00
|
|
|
url "http://llvm.org/svn/llvm-project/llvm/tags/google/testing/2015-04-21/", :using => :svn
|
2015-01-09 16:44:29 +00:00
|
|
|
|
|
|
|
resource "clang" do
|
2015-04-28 17:16:02 +00:00
|
|
|
url "http://llvm.org/svn/llvm-project/cfe/tags/google/testing/2015-04-21/", :using => :svn
|
2015-01-09 16:44:29 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
resource "libcxx" do
|
2015-04-01 22:32:58 +00:00
|
|
|
url "http://llvm.org/releases/3.6.0/libcxx-3.6.0.src.tar.xz"
|
|
|
|
sha1 "5445194366ae2291092fd2204030cb3d01ad6272"
|
2015-01-09 16:44:29 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-02-18 17:31:43 +00:00
|
|
|
head do
|
|
|
|
url "http://llvm.org/svn/llvm-project/llvm/trunk/", :using => :svn
|
|
|
|
|
|
|
|
resource "clang" do
|
|
|
|
url "http://llvm.org/svn/llvm-project/cfe/trunk/", :using => :svn
|
|
|
|
end
|
|
|
|
|
|
|
|
resource "libcxx" do
|
2015-04-01 22:32:58 +00:00
|
|
|
url "http://llvm.org/releases/3.6.0/libcxx-3.6.0.src.tar.xz"
|
|
|
|
sha1 "5445194366ae2291092fd2204030cb3d01ad6272"
|
2015-02-18 17:31:43 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-01-09 16:44:29 +00:00
|
|
|
depends_on "cmake" => :build
|
|
|
|
depends_on "ninja" => :build
|
|
|
|
depends_on "subversion" => :build
|
|
|
|
|
|
|
|
def install
|
|
|
|
(buildpath/"projects/libcxx").install resource("libcxx")
|
|
|
|
(buildpath/"tools/clang").install resource("clang")
|
|
|
|
|
|
|
|
mkdir "build" do
|
2015-04-01 22:32:58 +00:00
|
|
|
args = std_cmake_args
|
|
|
|
args << "-DLLVM_ENABLE_LIBCXX=ON"
|
|
|
|
args << ".."
|
|
|
|
system "cmake", "-G", "Ninja", *args
|
2015-01-09 16:44:29 +00:00
|
|
|
system "ninja", "clang-format"
|
|
|
|
bin.install "bin/clang-format"
|
|
|
|
end
|
2015-02-11 09:00:37 +00:00
|
|
|
bin.install "tools/clang/tools/clang-format/git-clang-format"
|
2015-01-09 16:44:29 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
|
|
|
# NB: below C code is messily formatted on purpose.
|
|
|
|
(testpath/"test.c").write <<-EOS
|
|
|
|
int main(char *args) { \n \t printf("hello"); }
|
|
|
|
EOS
|
|
|
|
|
|
|
|
assert_equal "int main(char *args) { printf(\"hello\"); }\n",
|
|
|
|
shell_output("#{bin}/clang-format -style=Google test.c")
|
|
|
|
end
|
|
|
|
end
|