2015-01-09 16:44:29 +00:00
|
|
|
class ClangFormat < Formula
|
2015-06-24 18:28:45 +00:00
|
|
|
desc "C, C++, Obj-C, Java, JavaScript, TypeScript formatting tools and editor plugins"
|
2015-01-09 16:44:29 +00:00
|
|
|
homepage "http://clang.llvm.org/docs/ClangFormat.html"
|
2015-08-01 17:18:37 +00:00
|
|
|
version "2015-07-31"
|
2015-01-09 16:44:29 +00:00
|
|
|
|
2015-01-12 22:35:26 +00:00
|
|
|
bottle do
|
|
|
|
cellar :any
|
2015-08-01 19:13:06 +00:00
|
|
|
sha256 "23f3215f23cd4bc36d9b37ee566a3482f7b70a3baa887730a83067934a300b10" => :yosemite
|
|
|
|
sha256 "c645415feb57129f30247ade34fc25ca17fc9e72619d52f1b93b086cca411426" => :mavericks
|
|
|
|
sha256 "280f1a6c6c1d7823739027582c568f32bd88ca5d96d946230e6a7bfeddd46962" => :mountain_lion
|
2015-01-12 22:35:26 +00:00
|
|
|
end
|
|
|
|
|
2015-01-09 16:44:29 +00:00
|
|
|
stable do
|
2015-08-01 17:18:37 +00:00
|
|
|
url "http://llvm.org/svn/llvm-project/llvm/tags/google/testing/2015-07-31/", :using => :svn
|
2015-01-09 16:44:29 +00:00
|
|
|
|
|
|
|
resource "clang" do
|
2015-08-01 17:18:37 +00:00
|
|
|
url "http://llvm.org/svn/llvm-project/cfe/tags/google/testing/2015-07-31/", :using => :svn
|
2015-01-09 16:44:29 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
resource "libcxx" do
|
2015-08-01 17:18:37 +00:00
|
|
|
url "http://llvm.org/releases/3.6.2/libcxx-3.6.2.src.tar.xz"
|
|
|
|
sha256 "52f3d452f48209c9df1792158fdbd7f3e98ed9bca8ebb51fcd524f67437c8b81"
|
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-08-01 17:18:37 +00:00
|
|
|
url "http://llvm.org/releases/3.6.2/libcxx-3.6.2.src.tar.xz"
|
|
|
|
sha256 "52f3d452f48209c9df1792158fdbd7f3e98ed9bca8ebb51fcd524f67437c8b81"
|
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-06-08 17:04:39 +00:00
|
|
|
(share/"clang").install Dir["tools/clang/tools/clang-format/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
|